Repository navigation
Description
Summary
On an AST-only rebuild (graphify update / the watch path), watch.py preserves semantic nodes (any node with file_type != "code") but only preserves edges whose confidence is INFERRED/AMBIGUOUS or whose both endpoints are non-code. As a result, EXTRACTED edges that connect a code node to a preserved semantic node (e.g. a script node → an external service/database node) are silently dropped on every update, even though both endpoints remain in the graph.
Impact
Cross-file semantic relationships (script → external system, code → doc concept) vanish on the next graphify update, so the graph loses information the semantic pass had already extracted. They only come back after another full semantic run. This is easy to miss because the update still prints a successful rebuild.
Reproduction
- Build a graph with a semantic pass that adds, for example:
- node
Salient_Cloud_SFTPwithfile_type: document(any non-codetype) - edge
script_py -> Salient_Cloud_SFTPwithconfidence: EXTRACTED
- node
- Run
graphify update .. - The node survives; the edge is gone.
sem_nodes keeps anything non-code, so the node persists. sem_edges requires source not in code_ids and target not in code_ids, so a code→semantic edge fails the predicate and is discarded.
Relevant code
graphify/watch.py (AST-only merge, preserving semantic nodes/edges):
code_ids = {n["id"] for n in existing.get("nodes", []) if n.get("file_type") == "code"}
sem_nodes = [n for n in existing.get("nodes", []) if n.get("file_type") != "code"]
sem_edges = [e for e in existing.get("links", existing.get("edges", []))
if e.get("confidence") in ("INFERRED", "AMBIGUOUS")
or (e.get("source") not in code_ids and e.get("target") not in code_ids)]Suggested fix
Keep any edge attached to a preserved semantic node:
code_ids = {n["id"] for n in existing.get("nodes", []) if n.get("file_type") == "code"}
sem_nodes = [n for n in existing.get("nodes", []) if n.get("file_type") != "code"]
sem_ids = {n["id"] for n in sem_nodes}
sem_edges = [e for e in existing.get("links", existing.get("edges", []))
if e.get("confidence") in ("INFERRED", "AMBIGUOUS")
or e.get("source") in sem_ids
or e.get("target") in sem_ids
or (e.get("source") not in code_ids and e.get("target") not in code_ids)]I verified locally that this keeps code→semantic EXTRACTED edges across an AST-only rebuild.
Related observations
graphify/validate.py::validate_extractiononly warns and never coerces or rejects invalid values, andgraphify/build.pyprints onlyreal_errors[0]. So many invalidfile_typevalues can accumulate and stay invisible. In one real corpus the single reported error hid 83 issues (71 invalidfile_type, 6 missingfile_type, 6 edges missingsource_file).- The shipped skill prompt defines
file_typeascode|document|paper|image(e.g.skill-windows.md,skill-codex.md,skill-trae.md). That vocabulary omitsrationale, which the validator accepts, and is not enforced, so models emit ad-hoc values (python,doc,concept,service,database). Aligning the prompt withVALID_FILE_TYPES(and mentioningrationale) would prevent most of these.
Activity
SrijanSriv commentedon Oct 5, 2026
i checked on v8 at 35adf43. graphify update keeps Salient_Cloud_SFTP and the EXTRACTED edge from the script node. the confidence filter in the issue is not in watch.py anymore. we can safely close this issue
cc: @safishamsi
omsenjalia commentedon Oct 18, 2026
This looks fixed on the
v8branch by 4ac5f07e (fix(watch): preserve semantic edges of re-extracted sources (#1865)). Could a maintainer confirm and close?ayushcodes10 commentedon Oct 20, 2026
Checked this against current
v8(b90b9df7) and the bug no longer reproduces — it looks fixed as a side effect of the tier-aware merge rewrite in 4ac5f07 (#1865) and 97656fa (#2333/#2334/#2336), neither of which cites this issue.watch.py's reconciliation no longer filters preserved edges byconfidence/file_typethe way the quoted snippet does. It now stamps every item with_origin("ast" or "semantic", backfilled for legacy items via_is_ast_tier's shape fallback — asource_locationofL<line>means AST, anything else means semantic) and only drops a semantic-tier edge when its owning source is actually deleted/excluded; AST-tier edges are additionally dropped when their source was re-extracted this run. Confidence and endpointfile_typeplay no part in that decision any more, so anEXTRACTEDcode→semantic edge (stamped_origin: semanticsince it carries no AST line location) now survives an AST-only incremental update exactly like anINFERREDone does.Reproduced directly: built a real graph for a
script.py+notes.mdcorpus, hand-added ascript_run --uses(EXTRACTED)--> Salient_Cloud_SFTPedge (mirroring the shape in the issue) with the semantic node's backing file physically present on disk, then ran an incrementalgraphify extract . --code-onlyafter adding an unrelatedother.py. Both the semantic node and the EXTRACTED edge survived ingraphify-out/graph.json, now carrying_origin: semantic.The two "related observations" in the issue (validate.py only warning on invalid
file_type, and the shipped skill prompts'file_typevocabulary omittingrationale) are separate from the primary bug and still worth a look, but I didn't investigate those — just the edge-drop bug itself, which is already resolved. Not opening a PR; closing this out as already fixed, unless the related observations should stay open as their own issue.