Repository navigation
fix(mcp): enforce deterministic get_node resolution & graceful list_p… - #3920
A-P-Shukla wants to merge 5 commits into
Conversation
|
Thanks for the pull request, @A-P-Shukla. 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.
Formal verification. 1 change(s) tested, no difference found (not proven).
Graphify review — findings
Tightens get_node to resolve only exact label/ID matches; an ambiguous label returns a JSON list of {path, line} candidates, and a miss or empty argument returns {"error": "no exact match found"} instead of falling back to prefix or substring guesses. fetch_prs and _detect_default_branch now fail fast with "could not detect repository; pass repo=" when no repo is given and the working directory has no .git, before calling gh. list_prs moves base-branch detection inside its error handling, so that failure comes back as an MCP tool error rather than escaping the handler.
Worth a look
- Repo detection rejects valid repository subdirectories —
graphify/prs.py:186· Escalate · high- 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 — 671 functions depend on the 305 functions this change touches.
Health — this change adds coupling hotspots:
- new:
main()— 98 callers, 3 callees - new:
_query_graph_text()— 27 callers, 10 callees - new:
dispatch_command()— 2 callers, 125 callees - new:
_score_query()— 15 callers, 7 callees - new:
_query_terms()— 20 callers, 3 callees - new:
run_benchmark()— 16 callers, 3 callees - new:
_load_graph()— 16 callers, 3 callees - new:
fetch_prs()— 7 callers, 5 callees - …and 18 more — each is listed as a finding
Verification — 671 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: 486 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
10 of 304 test file(s) selected (3%) via static blast radius.
tests/test_benchmark.py— impacttests/test_benchmark_raw_graph.py— impacttests/test_file_label_disambiguation.py— impacttests/test_prs.py— impact, changed-testtests/test_query_induced_edges.py— impacttests/test_query_mcp_direction.py— impacttests/test_query_names_its_graph.py— impacttests/test_serve.py— impacttests/test_serve_http.py— impact, changed-testtests/test_terraform.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.
Formal verification
No difference found (not proven): No behavior difference found in \_detect\_default\_branch (not a proof).
The verifier ran both versions of \_detect\_default\_branch 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.
Could not verify: Could not verify fetch\_prs.
The verifier did not have enough to check fetch\_prs, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: all 200 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly RuntimeError — names the real obstacle, not a sampling gap)
Could not verify: Could not verify \_build\_server.
The verifier did not have enough to check \_build\_server, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: all 23 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous
· 1 grounded finding(s) anchored inline below; 25 more finding(s) on lines outside this diff (see the check run).
|
Thanks for this @A-P-Shukla — the diagnosis of #3917 is right and the The
The core goal (no silent wrong match on a near-miss) is right; the fix just needs to live in the shared path and keep the tool outputs consistent. Happy to re-review once that's in. Marking changes-requested. |
|
@safishamsi All review points addressed and verified: 1. Shared Resolver Invariant Restored
2. Text Contract & Error Handling
3. Test Suite & Invariants
Validation Run
Note: The existing successor-first output ordering in Ready for re-review. |
…rs handling (#3917)
What does this PR do?
Fixes two MCP failure modes:
get_nodenow returns only exact-match results, listing candidates as JSON when ambiguous and returning{"error": "no exact match found"}otherwise.list_prsnow checks for a local.gitmarker before callingghwhen norepo=is provided, and reports the resulting error as an MCP tool error.Repository detection checks
.gitrelative to the current working directory. Passrepo=when running outside a directory containing that marker.Type of change
Verification & Invariants
How was this tested?
Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (No skill source fragments changed.)