graphify icon indicating copy to clipboard operation
graphify copied to clipboard

fix(watch): widen semantic-doc gate to the doc-shaped file_type subset (#1954)

Open alphanury opened this issue 4 months ago • 0 comments

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_type enum: {"document", "concept", "rationale", "paper"} (i.e. everything except code and image) — the issue's own minimal suggested fix.
  • Both downstream consumers (incremental path and full-rebuild path) key off the single semantic_doc_files set 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 defaults file_type to "document", so legacy AST doc nodes can never carry concept/rationale/paper and the widened set does not increase the legacy misread risk. (Verified against graphify/validate.py's VALID_FILE_TYPES and every add_node call 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 in test_ollama_retry_cap.py/test_skillgen.py are pre-existing on a clean v8 checkout (verified identical with the fix stashed).

🤖 Generated with Claude Code

alphanury avatar Jul 16 '26 23:07 alphanury