Skip to content

Replace fixed-point iteration cap with content-cycle guard - #8722

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-fileprocessor-cap-2
Oct 19, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-fileprocessor-cap-2

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Remove the hard MAX_ITERATIONS cap 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, RectorOrder fixtures) 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.

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
TomasVotruba force-pushed the tv-fileprocessor-cap-2 branch from d4552a9 to 34e3372 Compare October 19, 2026 21:16
@TomasVotruba TomasVotruba changed the title Lower FileProcessor fixed-point cap to 2 iterations Replace fixed-point iteration cap with content-cycle guard Oct 19, 2026
@TomasVotruba
TomasVotruba merged commit f058c6e into main Oct 19, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-fileprocessor-cap-2 branch October 19, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant