fix: stabilize capped rechecks in dependency order#4190
Open
teerthsharma wants to merge 4 commits into
Open
Conversation
A finite chain of cyclic module pairs can consume the incremental epoch budget and reach commit with recorded export changes still pending. Keep the current failure as an expected-panic regression so a separate scheduler fix can remove the annotation and verify propagation reaches the final importer.
The epoch cap discarded its live export-change frontier, so its final invalidation could leave a new change pending at commit. Preserve that frontier, condense its affected reverse-dependency graph into SCCs, and stabilize each component dependency-first before committing.
teerthsharma
force-pushed
the
fix-capped-recheck-propagation-panic
branch
from
July 17, 2026 20:21
550ac4d to
7ffb5a9
Compare
teerthsharma
marked this pull request as ready for review
July 17, 2026 20:25
This comment has been minimized.
This comment has been minimized.
Merging main restored the reproducer's expected-panic marker after the scheduler fix. Remove it again so CI verifies the transaction converges and reaches the final importer error.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
The old fallback reread
TransactionData.changedafter the epoch loop had already drained it, so it invalidated an empty set and could commit with a newly pending change.For the affected graph
G[A], the condensationG[A] / ~is a DAG. With edgesimporter -> dependency, Tarjan's SCC order is dependency-first, so every dependency component reaches a fixed point before its importers run. Pending work for later components is preserved, and no residual transaction state is cleared.No new dependency is added; the normal fine-grained path is unchanged.
Verification
cargo test -p pyrefly --lib test_deep_scc_chain_stabilizes_after_epoch_cap -- --nocapturecargo test -p pyrefly --lib test::incremental(75 passed)cargo check -p pyreflypython3 test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschemaBuilt on #4180. Fixes #4171.