Skip to content

md quick-scan and semantic extraction mint duplicate document nodes for the same file: bare slug vs slug_doc #1799

Description

@jerp86

Summary

When a corpus file has been through semantic extraction (producing a document node with the _doc suffix, e.g. docs_xmap_language_reference_doc) and a later graphify update runs the markdown quick-scan over the same corpus, the quick-scan mints a second file-level node under the bare slug (docs_xmap_language_reference) instead of reusing the existing _doc node. Every markdown document ends up as two disconnected nodes with the graph's edges split between them.

Environment

  • graphify 0.9.12 (reproduced today after upgrading from 0.9.9, where it also occurred)
  • macOS, TS/React repo with docs/*.md corpus previously extracted semantically (host-agent pipeline, no API key)

Reproduction

  1. Full build with semantic extraction over a repo containing docs/xmap/*.md → each doc becomes <slug>_doc (e.g. docs_xmap_readme_doc), with semantic references edges to code.
  2. Run graphify update . (AST-only path).
  3. Inspect graph.json:
docs_xmap_language_reference: bare=YES | _doc=YES
docs_xmap_readme:             bare=YES | _doc=YES
docs_xmap_quickstart:         bare=YES | _doc=YES
docs_xmap_style_reference:    bare=YES | _doc=YES

4/4 markdown docs checked are duplicated (systematic, not incidental).

Observed edge split

The two nodes partition the file's relationships:

  • the bare node receives the md quick-scan's cross-link edges (e.g. docs_xmap_readme → docs_xmap_language_reference, docs_xmap_quickstart → docs_xmap_language_reference, plus fragment edges like docs_xmap_language_reference → docs_xmap_language_reference_referência_da_linguagem_xmap);
  • the _doc node keeps the semantic-extraction edges (references to real code symbols, membership in hyperedges such as a documentation reading-path).

Consequences: path/query traversals starting from one twin miss the other twin's neighborhood (a docs→code path query dead-ends on the bare node), community detection clusters the twins separately, and doc-file degree/centrality is split roughly in half.

Expected

The quick-scan should resolve to the existing _doc node (or both extractors should agree on one canonical ID scheme for file-level document nodes), so a document file is one node regardless of which pipeline touched it last.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions