Repository navigation
Replace fixed-point iteration cap with content-cycle guard - #8722
Merged
Merged
Conversation
Remove the hard MAX_ITERATIONS cap on the FileProcessor fixed-point loop. Legit rule chains (rule A enables rule B enables rule C) and post-rector import passes need several passes to converge, so a fixed numeric cap either trips on valid input or is an arbitrary guess. Instead detect a real non-convergence: hash each file content the loop produces and stop if one repeats, which only happens when rules flip the file between states and would otherwise loop forever.
TomasVotruba
force-pushed
the
tv-fileprocessor-cap-2
branch
from
October 19, 2026 21:16
d4552a9 to
34e3372
Compare
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.
Remove the hard
MAX_ITERATIONScap on the FileProcessor fixed-point loop.A fixed numeric cap is wrong for this loop: legit rule chains (rule A enables rule B enables rule C) and post-rector import passes legitimately take several passes to converge, so any fixed cap either trips on valid input (as a low cap does on the
DeadInstanceFlip,TypedCollections,RectorOrderfixtures) or is just an arbitrary guess.Instead detect genuine non-convergence directly: hash each file content the loop produces and stop only if one repeats. That only happens when the rules flip the file between states - a real infinite loop - and never fires on a run that keeps making forward progress toward a stable result.