graphify
graphify copied to clipboard
fix(watch): widen semantic-doc gate to the doc-shaped file_type subset (#1954)
Fixes #1954.
The #1915 semantic-doc gate in _rebuild_code (graphify/watch.py) recognized a doc as semantic-backed only when it had a node with file_type == "document". A doc whose LLM layer is made of concept/rationale nodes — the extraction spec's preferred shape — failed the check, so every rebuild AST-quick-scanned it again and re-minted heading nodes alongside the semantic ones: the same double-representation #1915 fixed, just for the other (and recommended) node shape.
Change
- The gate now accepts the full doc-shaped subset of the canonical six-value
file_typeenum:{"document", "concept", "rationale", "paper"}(i.e. everything exceptcodeandimage) — the issue's own minimal suggested fix. - Both downstream consumers (incremental path and full-rebuild path) key off the single
semantic_doc_filesset the gate produces, so they stay in lockstep; nothing else in the rebuild flow changes. - The pre-#1865 legacy-graph safeguard is preserved: the markdown extractor's
add_node()always defaultsfile_typeto"document", so legacy AST doc nodes can never carryconcept/rationale/paperand the widened set does not increase the legacy misread risk. (Verified againstgraphify/validate.py'sVALID_FILE_TYPESand everyadd_nodecall site in the markdown extractor.)
Tests
- New fixture (
_seed_semantic_doc_graph_concept_only) plus three tests mirroring the existing #1915 suite: full-rebuild non-duplication and incremental preservation (doc-only and doc-plus-code variants). All three red before the fix, green after. tests/test_watch.py: 72 passed, 2 skipped.test_detect.py+test_build.py: 203 passed. Full suite: 3270 passed; the 15 failures intest_ollama_retry_cap.py/test_skillgen.pyare pre-existing on a clean v8 checkout (verified identical with the fix stashed).
🤖 Generated with Claude Code