You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extractor produces edges missing required field source_file #1279
After extraction completes, the following warning is printed:
[graphify] Extraction warning (8 issues): Edge N missing required field 'source_file'
The same warning repeats on subsequent cluster-only runs, confirming the affected edges are persisted in graph.json.
Why it matters
source_file is listed as a required field by graphify itself. Edges missing it cannot be traced back to a source location. If graphify query returns a result that traverses one of these edges, the response will have no file reference — making it harder to navigate to the relevant code.
Expected behavior
All edges produced by the extractor should have source_file populated. If an edge genuinely cannot be attributed to a source file, the warning should identify which extractor (AST or semantic LLM) produced it to help narrow down the root cause.
Root cause: I audited every edge-construction site in the AST extractor - all set source_file, so the AST path is clean. The offending edges come from the semantic/LLM extractor: _parse_llm_response returns the model's JSON as-is, and when the model omits source_file on an edge nothing repairs it. build_from_json only normalizedsource_file when already present, so the empty field reached graph.json and validate flagged it (Edge N missing required field 'source_file') - re-flagged on every cluster-only run.
Fix: backfill source_file from the edge's source node (then target; every node reliably carries one) in build_from_json, and mirror it in the --no-cluster raw-write path which bypasses build_from_json.
Verified: a --no-cluster build now produces edges with zero missing source_file; unit test added (test_edge_missing_source_file_backfilled_from_node) plus a guard that the AST path stays clean. Full suite green (2113 passed).
Note: this is a defensive backfill since the source is external LLM output. The backfilled value is the endpoint node's file, which is the correct provenance for these relation edges.
Activity
Backfill edge source_file from endpoint nodes (#1279)
safishamsi commentedon Jun 17, 2026
Fixed in
8437ef4(branch v8).Root cause: I audited every edge-construction site in the AST extractor - all set
source_file, so the AST path is clean. The offending edges come from the semantic/LLM extractor:_parse_llm_responsereturns the model's JSON as-is, and when the model omitssource_fileon an edge nothing repairs it.build_from_jsononly normalizedsource_filewhen already present, so the empty field reachedgraph.jsonandvalidateflagged it (Edge N missing required field 'source_file') - re-flagged on everycluster-onlyrun.Fix: backfill
source_filefrom the edge's source node (then target; every node reliably carries one) inbuild_from_json, and mirror it in the--no-clusterraw-write path which bypassesbuild_from_json.Verified: a
--no-clusterbuild now produces edges with zero missingsource_file; unit test added (test_edge_missing_source_file_backfilled_from_node) plus a guard that the AST path stays clean. Full suite green (2113 passed).Note: this is a defensive backfill since the source is external LLM output. The backfilled value is the endpoint node's file, which is the correct provenance for these relation edges.
Document this session's fixes in changelog and add JSON-truncation tr…
Backfill edge source_file from endpoint nodes (Graphify-Labs#1279)
Document this session's fixes in changelog and add JSON-truncation tr…