Repository navigation
fix: same-named files from two repos are not one file in explain and path (#4512) - #4520
Deepjyoti-Sarmah wants to merge 2 commits into
Conversation
…th (Graphify-Labs#4512) The tests build a merged graph where web/dup.py and ml/dup.py hold a node with the same label, and check that explain and path name both repos, give the full node id as the retry, and leave a graph with no repo attribute unchanged. Three of the five fail before the fix.
…path (Graphify-Labs#4512) The same-file check used the bare source_file, so web/dup.py and ml/dup.py read as one file, with bare line numbers and a hint that could not tell them apart. A file is now its repo plus source_file. A repo is shown only when the candidates span more than one repo, so a graph with no repo attribute reads as before. When the path is shared across repos, the hint says to use the full node id.
|
Thanks for the pull request, @Deepjyoti-Sarmah. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Not checked: tests were not run; formal verification proved 0 of 3 changed function(s) (3 sampled, not proven).
Formal verification. PR-changed functions: 3/3 verified (0 proven, 3 may-equivalent, 0 distinguished) · 0 not verified.
Graphify review — findings
Fixes ambiguity detection in merged multi-repo graphs, where two repos each holding dup.py were treated as one file and silently resolved to whichever node came first. _rivals_across_files now keys on repo plus source_file, and graphs with no repo attribute group by path alone, so single-repo wording is unchanged. Updates _ambiguity_message to prefix candidates with their repo only when they span several repos, and to tell the user to retry with the full node id when the same path appears in more than one repo. The repo-prefixed listing is a new path form that the path::symbol retry hint has to stay consistent with. Adds tests covering the two-repo refusal text, the node-id hint, full-id resolution, the graphify path CLI exit code, and the untagged-graph fallback.
Worth a look
- Repo-prefixed paths in the refusal break the suggested path::symbol retry —
graphify/serve.py:1826· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 653 functions depend on the 166 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
main()— 111 callers, 3 callees
Verification — 653 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 553 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
17 of 433 test file(s) selected (4%) via static blast radius.
tests/test_benchmark.py— impacttests/test_benchmark_raw_graph.py— impacttests/test_benchmark_real_query.py— impacttests/test_explain_same_file_tie.py— impacttests/test_file_label_disambiguation.py— impacttests/test_mcp_graph_view_cache.py— impacttests/test_path_cli.py— impacttests/test_query_induced_edges.py— impacttests/test_query_mcp_direction.py— impacttests/test_query_names_its_graph.py— impacttests/test_query_seed_order.py— impacttests/test_query_seeds.py— impacttests/test_same_basename_repos.py— impact, changed-testtests/test_serve.py— impacttests/test_serve_http.py— impacttests/test_terraform.py— impacttests/test_truncation_full_answer.py— impact
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Docs that may be stale (advisory)
CHANGELOG.md§ 0.9.85 (2026-10-10) (lines 147-169): references changed symbolswhereCHANGELOG.md§ 0.9.64 (2026-09-18) (lines 454-465): references changed symbolswhereCHANGELOG.md§ 0.9.6 (2026-07-04) (lines 1209-1234): references changed symbolswheregraphify/skill-agents.md§ Step 1 - Ensure graphify is installed (lines 65-112): references changed symbolswheregraphify/skill-agents.md§ Part A - Structural extraction for code files (lines 178-206): references changed symbolswheregraphify/skill-agents.md§ Part B - Semantic extraction (parallel subagents) (lines 207-370): references changed symbolswheregraphify/skill-aider.md§ Step 1 - Ensure graphify is installed (lines 59-106): references changed symbolswheregraphify/skill-amp.md§ Step 1 - Ensure graphify is installed (lines 65-112): references changed symbolswheregraphify/skill-amp.md§ Part A - Structural extraction for code files (lines 178-206): references changed symbolswheregraphify/skill-amp.md§ Part B - Semantic extraction (parallel subagents) (lines 207-370): references changed symbolswhere
…and 10 more.
Formal verification
No difference found (not proven): No behavior difference found in \_ambiguity\_message (not a proof).
The verifier ran both versions of \_ambiguity\_message on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
No difference found (not proven): No behavior difference found in \_rivals\_across\_files (not a proof).
The verifier ran both versions of \_rivals\_across\_files on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
No difference found (not proven): No behavior difference found in find\_node\_ambiguity (not a proof).
The verifier ran both versions of find\_node\_ambiguity on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
· 1 more finding(s) on lines outside this diff (see the check run).
|
Landed in 0.9.93, cherry-picked to preserve your authorship. Two same-path files from different repos in a merged graph are kept distinct in |
What does this PR do?
Fixes #4512.
In a merged multi-repo graph, two nodes can share a label and a repo-relative
source_file, for exampleweb/dup.pyandml/dup.py. Both appear asdup.py. The same-file check used the baresource_file, so the two nodes counted as one file.explainandpaththen refused with "matches 2 nodes in dup.py", listed bareL1lines, and gave a hint that could not tell the candidates apart.This PR makes a file the pair (repo, source_file). The refusal names each candidate's file with its repo, and when the same path exists in more than one repo, the hint says so and asks for the full node id.
repoattribute) keep the old wording.Type of change
Verification & Invariants
A same-named file from two repos is never silently merged into one file. A single-repo graph gives the same refusal text as before.
Merge Danger
Door: two-way. Only the wording of one refusal and the file key used to detect ambiguity change. No schema, cache or file-format change. Reverting restores the old wording.
Blast Radius: ambiguity refusals in merged graphs.
_resolve_single_nodeis shared, soexplain,path, and theget_nodeandget_neighborstools all show the new wording.queryand--seedare not changed here. Single-repo output is unchanged.Limitations
queryand--seedstill answer silently for same-named files from two repos. That is tracked by the [Bug]:graphify querysilently guesses an ambiguous node name instead of refusing it #4511 fix, which is a separate PR.web/dup.py::Configdo not resolve. The refusal does not suggest them; it gives the node id.repoattribute and others do not is not covered by tests.How was this tested?
tests/test_same_basename_repos.py(5 tests). Before the fix, 3 fail: the explain message, the explain hint, and the path message. The node-id lookup and the single-repo wording pass before and after.Repro: two repos, each with
dup.pydefiningConfig, merged withgraphify merge-graphs.Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (N/A: no skill fragments touched.)