Skip to content

fix(serve): keep cross-repo calls edges when a query filters on call - #5257

Open
LHopitalOne wants to merge 1 commit into
Graphify-Labs:v8from
LHopitalOne:fix/call-filter-keeps-cross-repo-calls
Open

LHopitalOne wants to merge 1 commit into
Graphify-Labs:v8from
LHopitalOne:fix/call-filter-keeps-cross-repo-calls

Conversation

@LHopitalOne

Copy link
Copy Markdown
Contributor

What does this PR do?

merge-graphs finishes a member call into another repo as a calls edge with context="cross_repo" (#3152). The call context filter in serve.py kept an edge only when its context was call, so "who calls X" (which infers the call filter) and context_filter=["call"] silently 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 (#5178). Shared-type links (same_type_as, also context="cross_repo") stay out of a call filter, and an explicit cross_repo filter still matches by context as before.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Tests or CI
  • Refactor
  • Security fix

Verification & Invariants

Invariant: a call context filter keeps every call edge, wherever the call was found; it drops non-call edges, including other cross_repo edges.

  • Read the CONTRIBUTING.md guide.
  • Reproduced the issue and identified the invariant.
  • Made the smallest fix necessary.
  • Added a regression test (if bug fix) or isolated boundary test.
  • Kept the PR description synchronized with the final implementation.
  • Documented any limitations / unsupported cases explicitly.

Limitation: indirect_call edges (context argument) are left out of a call filter, 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.py on a two-repo graph shaped like merge-graphs output. test_call_filter_keeps_calls_resolved_across_repos and test_who_calls_question_reaches_a_caller_in_another_repo fail with serve.py reverted and pass with the fix; test_cross_repo_filter_still_matches_by_context pins the unchanged cross_repo filter.

uv run pytest tests/test_serve.py -q          # all pass
uv run pytest tests -q                         # 7 failures locally, the same 7 on a clean origin/v8 checkout
                                               # (markdown section CLI, merge-graphs external nodes, cpp
                                               # conditions, skill cache tests): environment, not this change
uv run ruff check graphify/serve.py tests/test_serve.py   # clean
uv run pyright graphify/serve.py               # same count as origin/v8 (missing optional imports)

Graphify-specific checklist

  • I updated generated skill artifacts (uv run python -m tools.skillgen --bless) when changing their source fragments. (No skill sources changed.)
  • I confirmed that AST/structural extraction remains deterministic (no ambient state dependencies like ENV variables).
  • I reviewed changes for security implications (no unsafe interpolation into shell/Python).
  • I confirmed no API keys or local-only graph data are included.
  • (If applicable) I disclosed AI authorship in my commit messages.

🤖 Generated with Claude Code

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]>
@github-actions

Copy link
Copy Markdown

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.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — impact
  • tests/test_affected_cli.py — impact
  • tests/test_affected_path_file_node.py — impact
  • tests/test_affected_seed_reference_forms.py — impact
  • tests/test_benchmark.py — impact
  • tests/test_benchmark_raw_graph.py — impact
  • tests/test_benchmark_real_query.py — impact
  • tests/test_confidence_score_output.py — impact
  • tests/test_edge_also_seen.py — impact
  • tests/test_explain_same_file_tie.py — impact
  • tests/test_extract.py — impact
  • tests/test_file_label_disambiguation.py — impact
  • tests/test_graph_context_cache_reload.py — impact
  • tests/test_markdown_sections.py — impact
  • tests/test_mcp_graph_view_cache.py — impact
  • tests/test_path_cli.py — impact
  • tests/test_path_confidence.py — impact
  • tests/test_path_type_member.py — impact
  • tests/test_query_induced_edges.py — impact
  • tests/test_query_mcp_direction.py — impact
  • tests/test_query_names_its_graph.py — impact
  • tests/test_query_seed_order.py — impact
  • tests/test_query_seeds.py — impact
  • tests/test_query_source_first.py — impact
  • tests/test_serve.py — impact, changed-test
  • tests/test_serve_http.py — impact
  • tests/test_terraform.py — impact
  • tests/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).

mvanhorn added a commit to mvanhorn/graphify that referenced this pull request Nov 21, 2026
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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant