[Caching] Invalidate on configured rule value change, reuse full-run cache for --only - #8400
Merged
Conversation
TomasVotruba
force-pushed
the
tv-cache-config-hash
branch
from
August 29, 2026 16:41
6cc4376 to
ddc24ce
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.
Two independent caching improvements.
1. Configured rule value changes now invalidate the cache
withConfiguredRule()stored its configuration on theRectorConfiginstance only, never in the parameter bag that feeds the cache hash. So changing a rule's configuration - same rule class, different values - did not invalidate the cache and the old result was served.// rector.php return RectorConfig::configure() ->withConfiguredRule(SomeRector::class, [ - 'old value', + 'new value', ]);Before: cache kept, files re-analysed with the stale value.
After: cache dropped, files re-analysed with the new value.
The merged configuration is now pushed into a
RULE_CONFIGURATIONSparameter, so it flows into the strict cache hash automatically. Upgrading invalidates the cache once for projects using configured rules.2.
--only <Rule>reuses the full-run cacheEach
--onlyselection has its own cache namespace (#8075), so a file left clean by a prior full run was re-analysed under--only, even when nothing changed.A scoped run now falls back to the full-run cache: a file the full run left clean (all rules at a fixed point) stays clean under a single rule too, and the file content is still compared, so a real edit is still picked up. The fallback is read only - a scoped run still writes only under its own key, so it never claims a full fixed point.
Before:
--only SomeRectorafter a full run re-analyses every file.After: it skips files the full run already left clean.