Skip to content

fix(extract): regenerate cross-file edges via one-hop context files (#2230) - #2382

Open
HaoChiBao wants to merge 2 commits into
Graphify-Labs:v8from
HaoChiBao:fix/incremental-context-resolution-2230
Open

fix(extract): regenerate cross-file edges via one-hop context files (#2230)#2382
HaoChiBao wants to merge 2 commits into
Graphify-Labs:v8from
HaoChiBao:fix/incremental-context-resolution-2230

Conversation

@HaoChiBao

Copy link
Copy Markdown

Summary

  • On incremental extracts, load one-hop in-root import targets ( arget_file) for resolution facts only so cross-file imports/calls into unchanged neighbors regenerate
  • Reuse _extract_single_file for cache/bypass; omit context
    aw_calls; strip context ownership before return so merge keeps the neighbor's chunk
  • Add unit + CLI edge-parity tests for --no-cluster and clustered paths

Test plan

…raphify-Labs#2230)

Incremental batches only extract changed files, so symbol resolution could not see unchanged neighbors. Load import-target context for facts only, then strip ownership before return.
…ments for review

Explain why incremental batches need one-hop neighbor facts, what is omitted, and why ownership is stripped before return.

@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.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR modifies the extract function in graphify/extract.py to load one-hop neighbor files (in-root import targets referenced by edges but not in the batch) so their symbols can participate in cross-file resolution. After resolution completes, the ownership nodes/edges for those context files are stripped from the returned result, so only resolution facts (e.g., A→B import/call edges) remain while B's own nodes/edges are excluded. The change targets incremental extraction scenarios where re-extracting a single file should still regenerate its edges to neighbors. Two new tests are added in tests/test_incremental.py verifying edge parity between full and incremental extraction at both the API level and the CLI level (with and without clustering). The surface area is primarily the neighbor-context loading loop and final ownership-stripping step in extract, plus the new test coverage.

Worth a look

  • relative_to(root) may raise if root is not resolved consistently with resolved targetgraphify/extract.py:5768 · 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 — 1262 functions depend on the 216 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: extract() — 360 callers, 30 callees
  • worse: _extract_single_file() — 1 callers, 6 callees

Verification — 1262 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: 1134 function(s) in the blast radius were not formally verified this run

· 2 more finding(s) on lines outside this diff (see the check run).

@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.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR addresses an incremental-extraction issue (#2230) where running extract() on only the changed files caused cross-file edges (e.g. A imports/calls B.helper) to be dropped when the neighbor file B was unchanged. The change adds a step in extract() that discovers one hop of in-root neighbor files via target_file, loads them to provide symbol-resolution facts, then strips those neighbor-owned nodes/edges (by source_file) before returning so ownership stays with the unchanged file for the merge to preserve. It also adds tests in tests/test_incremental.py covering both the direct extract() API (asserting incremental A-edges match a full extract and that B's nodes/edges aren't returned) and the CLI flow across clustered and --no-cluster modes. Surface area is concentrated in graphify/extract.py (the new context-file collection/loading and post-processing filter) and the two new incremental tests.

No blocking issues surfaced. 7 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 1262 functions depend on the 216 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: extract() — 360 callers, 30 callees
  • worse: _extract_single_file() — 1 callers, 6 callees

Verification — 1262 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: 1134 function(s) in the blast radius were not formally verified this run

· 2 more finding(s) on lines outside this diff (see the check run).

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