chore(graph-builder): remove five shadowed/orphaned methods (-552 lines, no behaviour change) - #1619
Conversation
Removed 552 lines of unreachable dead code from graph_builder.py
(lines 202–753), containing five class-scope methods:
1. add_file_to_graph (lines 203–499)
— shadowed by live definition at line 768; stale item_mappings had
drifted from the active one in writer.py:290-313
2. _resolve_function_call (lines 501–510)
— shadowed by identical survival copy at line 154
3. _create_all_function_calls (lines 512–652)
— shadowed by later definition at line 828
4. _resolve_inheritance_link (lines 654–694)
— no call sites in src/; live equivalent is in
indexing/resolution/inheritance.py:9
5. _create_csharp_inheritance_and_interfaces (lines 696–752)
— no call sites in graph_builder.py; live version is on GraphWriter
in indexing/persistence/writer.py:891 (called from writer.py:1021)
All verified dead with live equivalents elsewhere. Zero behavioral impact.
Tests pass identically before and after (12 pre-existing failures only).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
@rrodriguesNutrium is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
Shashankss1205
left a comment
There was a problem hiding this comment.
Approving. For a 552-line deletion I wanted to trace every removed name myself rather than take the claim on trust:
Three shadowed names — one definition each remains after removal, and it's the live one:
add_file_to_graph 1 remaining
_resolve_function_call 1 remaining
_create_all_function_calls 1 remaining
Two orphans — live equivalents confirmed elsewhere:
_resolve_inheritance_link→ zero references anywhere insrc/after removal; the live one is the free functionresolve_inheritance_linkatindexing/resolution/inheritance.py:9._create_csharp_inheritance_and_interfaces→ live onGraphWriteratwriter.py:930, called fromwriter.py:1081. No remaining reference fromgraph_builder.
Suites green: 1204 unit, 44 integration.
The item_mappings drift you pointed out is the real justification here — the dead copy silently taught readers the wrong set of node types, which is worse than the dead code itself.
One thing left over: add_repository_to_graph is still defined twice (graph_builder.py:187 and :202), which you'd flagged in the original report as the third shadowed name. Not a blocker for this PR, but worth a follow-up — and #1604 stays open until it's done. Happy to take it if you'd rather move on to the Android stack.
…P graph_name, JS/TS imports, .NET ignore defaults and dev-env pins (#1646) * fix(jobs): stop cleanup_old_jobs deleting jobs that are still active (#1537) Active jobs with recent progress survive the sweep; a RUNNING/PENDING job with no update for the whole window is flipped to FAILED (still visible to check_job_status) instead of vanishing, and ages out via the terminal path. * fix(watcher): clear watched_paths and watches in stop() (#1519) A stopped Observer cannot be restarted; stale entries made watch_directory answer 'Already watching' for a dead observer. * fix(validator): stop rejecting read queries that mention write keywords as identifiers (#1511) Keywords in provably-safe positions (property access, label/rel-type, parameter, AS-alias) no longer trip the read-only gate; clause-position writes are still rejected, including a real SET/DELETE following an alias. * fix(simulator): make simulate_metrics work on embedded backends (#1512) labels(<var>)[0] is now rewritten for any variable name (the literal labels(n)[0] replace missed n1/n2), and the relationship query's bare pattern predicate is restructured as a CONTAINS*0.. match. * feat(mcp): honour add_code_to_graph graph_name on multi-graph backends (#1558); drop last shadowed method (#1604) GraphBuilder accepts a graph_name and binds its writer to get_driver(graph_name); the handler builds a scoped builder on FalkorDB and refuses explicitly on single-graph backends instead of silently indexing into the default graph. Also removes the remaining shadowed add_repository_to_graph definition #1619 missed. * fix(ignore): exclude .NET obj/ from the default ignore patterns (#1585) obj/ contains generated source (AssemblyInfo.cs, GlobalUsings.g.cs) that added phantom File/Module/IMPORTS rows to the graph. The golden test already masks obj/ via GENERATED_BUILD_DIRS, so the drift never failed the test — it only rotted the recorded golden. With the indexer itself excluding obj/, raw output matches the comparison scope and the C# golden regenerates with zero logical drift (the CALLS 12→7 loss reported in #1585 no longer reproduces on current main; it was fixed by intervening parser merges). * fix(js/ts): extract named, default and namespace ES import bindings (#1526) import_clause is an unnamed child of import_statement, so child_by_field_name('import') always returned None and every ES import collapsed into the bare-module fallback — the entire binding-extraction block was dead code, and would have tested the wrong node types anyway. The clause's children are now walked (a single clause can carry a default and named bindings together), the namespace alias is read from the identifier child, and both grammars are covered by binding-level tests. Downstream effects, captured in the regenerated goldens: IMPORTS edges carry the real binding in imported_name (was the module path), and 4 TypeScript call edges upgraded from HEURISTIC_CALLS to resolved CALLS because named-import bindings now reach the imports map. * test(env): fail loudly when tree-sitter-language-pack violates the pyproject pin (#1625) A stale venv holding an out-of-pin grammar pack makes the parser suite pass while disagreeing with CI (the #1600 misparse exists on 1.14.x but not 0.13.x, which nearly got a correct fix closed as a no-op). The divergence is now a named test failure pointing at the venv, not the parser.
graph_builder.pydefinesadd_file_to_graphtwice — at line 203 and again at line 768. Python keeps the second, so the first ~550 lines are unreachable.It is worse than redundant. The dead copy's
item_mappingshas drifted from the live one inindexing/persistence/writer.py: the live list handlesobjects,mixins,extensions,modulesandenum_members, the dead one handles none of them. Anyone reading the file top-to-bottom to learn which node types reach the graph gets a wrong answer, and nothing in the file signals which copy wins. It cost me a wrong conclusion before I noticed.What this removes
The unreachable region turned out to contain five class-scope methods, not one. Each was traced across the repo before removal:
add_file_to_graph_resolve_function_call_create_all_function_calls_resolve_inheritance_linkindexing/resolution/inheritance.py_create_csharp_inheritance_and_interfacesGraphWriter(writer.py, called fromwriter.py)Verified before deleting that
inspect.getsourcelines(GraphBuilder.add_file_to_graph)reported the second definition, and after deleting that it resolves to the single remaining one.Verification
Pure deletion, so the bar is that nothing changes. Test results are byte-identical before and after — same failures, same pass count. On a change like this a newly passing test would be as suspicious as a new failure, since it would mean the code was not actually dead.
Note there is at least one further shadowed pair still in the file (
add_repository_to_graph, defined twice), left alone here to keep this reviewable. Reported with the rest on #1595.One file, −552 lines, no behaviour change.