Skip to content

fix(extract): recover from per-future BrokenProcessPool - #2461

Closed
Baziar wants to merge 1 commit into
Graphify-Labs:v8from
Baziar:fix/2444-broken-process-pool-fallback
Closed

Baziar wants to merge 1 commit into
Graphify-Labs:v8from
Baziar:fix/2444-broken-process-pool-fallback

Conversation

@Baziar

@Baziar Baziar commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • Re-raise BrokenProcessPool from the per-future exception handler.
  • Allow the existing pool-level handler to return False.
  • Retry the uncached AST batch sequentially instead of returning an empty result.
  • Preserve the existing behavior for ordinary per-file worker failures.
  • Add regression coverage for BrokenProcessPool raised by future.result().

Why

future.result() can raise BrokenProcessPool after successful task submission. The generic per-future exception handler previously swallowed that exception, causing _extract_parallel() to report success and preventing the sequential fallback.

The result could therefore contain zero AST nodes while appearing successful.

Tests

  • 161 passed, 1 skipped
  • Ruff checks passed.
  • graphify update . completed successfully.

Fixes #2444

@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 parallel extraction path in graphify/extract.py so that a BrokenProcessPool raised from future.result() is re-raised rather than caught by the generic per-file exception handler, with the intent of letting the existing pool-level handler trigger a sequential fallback for the batch. It adds a new test in tests/test_extract.py that simulates a worker breaking the pool via a fake executor and future, asserting that extraction falls back to _extract_sequential once and still returns AST nodes. The changed-symbol list is large, but the diff only touches the parallel-extraction except clause and adds one test function; the other listed symbols appear to be surrounding context rather than direct edits.

No blocking issues surfaced.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 1404 functions depend on the 466 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: extract() — 360 callers, 29 callees

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

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

safishamsi added a commit that referenced this pull request Aug 5, 2026
… preservation, extract crash recovery; bump to 0.9.33

#2411 (thanks @JensD-git): key the C# partial-class merge on assembly
(nearest ancestor .csproj/.fsproj/.vbproj) in addition to namespace and
name, so same-name partial classes in different assemblies stay distinct
while genuine partial halves within one project still merge. Fixes a
0.9.32 regression from #2332.

#2437/#2438 (thanks @aryanbonigala, builds on PR #2439): incremental
rebuilds no longer drop member-call and indirect_call edges from a
changed file into an unchanged target. Re-resolution now sees the
unchanged corpus (nodes, contains/method edges, and _callable markers,
which now persist to graph.json like _origin); edges to a genuinely
removed target are still evicted.

#2444/#2445 (thanks @Baziar, builds on PRs #2461/#2458): a
BrokenProcessPool triggers the sequential fallback instead of being
swallowed per future, a failed worker file is retried sequentially
rather than merged as empty, and a whole-pass AST failure on a fresh
build exits non-zero instead of writing a zero-node graph
(--allow-partial opts into a best-effort partial graph).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.33. The core of your fix (re-raising BrokenProcessPool so the sequential fallback engages) is what landed, with a couple of additions: the fallback re-extracts only the not-yet-completed files, and a worker-failed file is retried sequentially and error-marked rather than left as a silent empty. Credited in the release notes. Thanks @Baziar.

@safishamsi safishamsi closed this Aug 5, 2026
PerryLin-0420 pushed a commit to PerryLin-0420/graphify-decouple that referenced this pull request Aug 13, 2026
… preservation, extract crash recovery; bump to 0.9.33

Graphify-Labs#2411 (thanks @JensD-git): key the C# partial-class merge on assembly
(nearest ancestor .csproj/.fsproj/.vbproj) in addition to namespace and
name, so same-name partial classes in different assemblies stay distinct
while genuine partial halves within one project still merge. Fixes a
0.9.32 regression from Graphify-Labs#2332.

Graphify-Labs#2437/Graphify-Labs#2438 (thanks @aryanbonigala, builds on PR Graphify-Labs#2439): incremental
rebuilds no longer drop member-call and indirect_call edges from a
changed file into an unchanged target. Re-resolution now sees the
unchanged corpus (nodes, contains/method edges, and _callable markers,
which now persist to graph.json like _origin); edges to a genuinely
removed target are still evicted.

Graphify-Labs#2444/Graphify-Labs#2445 (thanks @Baziar, builds on PRs Graphify-Labs#2461/Graphify-Labs#2458): a
BrokenProcessPool triggers the sequential fallback instead of being
swallowed per future, a failed worker file is retried sequentially
rather than merged as empty, and a whole-pass AST failure on a fresh
build exits non-zero instead of writing a zero-node graph
(--allow-partial opts into a best-effort partial graph).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.

BrokenProcessPool swallowed per-future, defeating the sequential fallback: extract() returns 0 nodes and reports success (Windows)

2 participants