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
Simple-Graph build silently drops 471 of 3178 edges (57 pairs differ in relation type); collapse is only reported after graph.json is written #2791
build_from_json produces a simple networkx.Graph, so every additional edge between an already-connected pair is silently dropped. Step 4.5 measures the loss accurately — but only after Step 4 has already written graph.json:
Seven distinct call sites become one edge with one source_location. And relation_variant_groups: 57 means 57 pairs collapsed edges that did not even share a relation type — a calls and a references between the same two nodes keep only whichever landed first.
Why it matters beyond tidiness
Weight is lost. "Called from 7 places" and "called once" are the same edge afterwards, so anything ranking by coupling strength (god nodes, betweenness, suggest_questions) is computed on a flattened graph.
Provenance is lost.source_location for the surviving edge is arbitrary, so "where exactly does A use B" has one answer out of seven, with nothing marking it as partial.
The warning is unactionable as written. It says graph may be incomplete/corrupt after the fact; there is no flag to re-run without the loss, so the only response is to accept it.
Suggested fix, in order of cost
Aggregate rather than drop. On collision, keep one edge but set weight (or count) to the number of merged edges and carry source_locations as a list. No API change for consumers that ignore the extra fields, and the diagnostic drops to zero for the common case.
Do not merge across relation types — those 57 groups are a different fact being discarded, not a duplicate.
Same bug measured on a directed build, in case the --directed numbers are useful — I hit this via diagnose multigraph on a 110-file Python package (graphifyy 0.9.55, --code-only --no-cluster):
178 edges (3.4% of valid candidates) are lost across 171 pairs — and unlike your run, here every one of the 171 is a relation variant: 0 groups differ by file, line or context. So your fix #2 ("do not merge across relation types") would recover all 178 in this corpus, and source_location is never the distinguishing field. Example:
(My own scan of the raw JSON agrees with the diagnostic: 172 node pairs carry more than one relation — calls+references ×46, inherits+uses ×38, references+uses ×33.)
One related observation about where the collapse shows up: the MCP server's graph_stats reports Edges: 5663 (the raw count) for this file, so the loss isn't visible through that path at all — only through diagnose multigraph. That same call also reports Nodes: 2613 where the file holds 2538, the difference being exactly the 75 distinct dangling endpoints, which god_nodes filters out but graph_stats appears to count.
Activity
waynegault commentedon Sep 21, 2026
Same bug measured on a directed build, in case the
--directednumbers are useful — I hit this viadiagnose multigraphon a 110-file Python package (graphifyy 0.9.55,--code-only --no-cluster):178 edges (3.4% of valid candidates) are lost across 171 pairs — and unlike your run, here every one of the 171 is a relation variant: 0 groups differ by file, line or context. So your fix #2 ("do not merge across relation types") would recover all 178 in this corpus, and
source_locationis never the distinguishing field. Example:(My own scan of the raw JSON agrees with the diagnostic: 172 node pairs carry more than one relation —
calls+references×46,inherits+uses×38,references+uses×33.)One related observation about where the collapse shows up: the MCP server's
graph_statsreportsEdges: 5663(the raw count) for this file, so the loss isn't visible through that path at all — only throughdiagnose multigraph. That same call also reportsNodes: 2613where the file holds 2538, the difference being exactly the 75 distinct dangling endpoints, whichgod_nodesfilters out butgraph_statsappears to count.