Repository navigation
fix(serve): keep cross-repo calls edges when a query filters on call - #5257
LHopitalOne wants to merge 1 commit into
Conversation
merge-graphs finishes a member call into another repo as a `calls` edge with context="cross_repo" (Graphify-Labs#3152). The call context filter kept an edge only when its context was `call`, so "who calls X" and context_filter=["call"] dropped exactly the calls that cross a repo boundary. A call filter now also matches edges whose relation is `calls`, whatever their context, the same way the heritage filter matches by relation (Graphify-Labs#5178). Shared-type links (same_type_as, also context="cross_repo") stay out, and an explicit cross_repo filter still matches by context. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the pull request, @LHopitalOne. 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.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 not verified).
Formal verification. PR-changed functions: 0/1 verified (0 proven, 0 may-equivalent, 0 distinguished) · 1 not verified (1 vacuous).
Not verified on this run: \_filter\_graph\_by\_context (vacuous: never exercised).
Graphify review — findings
Fixes the call context filter dropping calls that cross a repository boundary, so "who calls X" now reaches callers in other repos. _filter_graph_by_context keeps any calls edge when call is requested, whatever its context, via a new _CONTEXT_RELATIONS map. Edges with context="cross_repo" but another relation, like same_type_as, stay excluded, and a cross_repo filter still matches by context as before.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 970 functions depend on the 488 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
_query_graph_text()— 56 callers, 7 callees
Verification — 970 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: 743 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
28 of 581 test file(s) selected (5%) via static blast radius.
tests/test_4874_jvm_resolution.py— impacttests/test_affected_cli.py— impacttests/test_affected_path_file_node.py— impacttests/test_affected_seed_reference_forms.py— impacttests/test_benchmark.py— impacttests/test_benchmark_raw_graph.py— impacttests/test_benchmark_real_query.py— impacttests/test_confidence_score_output.py— impacttests/test_edge_also_seen.py— impacttests/test_explain_same_file_tie.py— impacttests/test_extract.py— impacttests/test_file_label_disambiguation.py— impacttests/test_graph_context_cache_reload.py— impacttests/test_markdown_sections.py— impacttests/test_mcp_graph_view_cache.py— impacttests/test_path_cli.py— impacttests/test_path_confidence.py— impacttests/test_path_type_member.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_query_source_first.py— impacttests/test_serve.py— impact, changed-testtests/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.
Formal verification
Could not verify: Could not verify \_filter\_graph\_by\_context.
The verifier did not have enough to check \_filter\_graph\_by\_context, 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 12 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous
· 1 more finding(s) on lines outside this diff (see the check run).
Conflicts: - CHANGELOG.md: this PR's query --context entry goes last among the Unreleased bullets, before the AST cache note. - graphify/serve.py: keep _edge_matches_context, but fold in Graphify-Labs#5257. A call filter now keeps every calls edge whatever context it carries, and a heritage filter keeps inherits/implements/extends edges that carry another context. Both match before the explicit-context early return. - tests/test_serve.py: the bloc_event calls edge now matches call; the remaining negative cases cover relations outside that mapping, and an inherits edge tagged type matches an inherits filter.
What does this PR do?
merge-graphsfinishes a member call into another repo as acallsedge withcontext="cross_repo"(#3152). Thecallcontext filter inserve.pykept an edge only when itscontextwascall, so "who calls X" (which infers thecallfilter) andcontext_filter=["call"]silently dropped exactly the calls that cross a repo boundary.A
callfilter now also matches edges whose relation iscalls, whatever their context, the same way the heritage filter matches by relation (#5178). Shared-type links (same_type_as, alsocontext="cross_repo") stay out of acallfilter, and an explicitcross_repofilter still matches by context as before.Type of change
Verification & Invariants
Invariant: a
callcontext filter keeps every call edge, wherever the call was found; it drops non-call edges, including othercross_repoedges.Limitation:
indirect_calledges (contextargument) are left out of acallfilter, as before. Happy to add them if "who calls X" should include callbacks. Nothing persisted changes: the filter runs at query time.How was this tested?
Three new tests in
tests/test_serve.pyon a two-repo graph shaped likemerge-graphsoutput.test_call_filter_keeps_calls_resolved_across_reposandtest_who_calls_question_reaches_a_caller_in_another_repofail withserve.pyreverted and pass with the fix;test_cross_repo_filter_still_matches_by_contextpins the unchangedcross_repofilter.Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (No skill sources changed.)🤖 Generated with Claude Code