Skip to content

[Caching] Cache dry-run files whose FileDiff has no content change - #8523

Merged
TomasVotruba merged 1 commit into
rectorphp:mainfrom
ianrodrigues:fix-dry-run-cache-unchanged-file-diff
Oct 1, 2026
Merged

TomasVotruba merged 1 commit into
rectorphp:mainfrom
ianrodrigues:fix-dry-run-cache-unchanged-file-diff

Conversation

@ianrodrigues

Copy link
Copy Markdown
Contributor

Since #6794, FileProcessor creates a FileDiff when rules report line changes, even if the printed content is unchanged (e.g. NameImportingPostRector on an aliased import with the same short name). The dry-run cache gate treats any FileDiff as a change, so these files are never cached and are re-processed on every --dry-run.

This gates caching on FileProcessResult::hasChanged() instead.

Tests:

  • testDryRunCachesFileWhoseReportedChangesLeaveContentUnchanged: fails on main
  • testDryRunDoesNotCacheFileWithPendingChanges: files with real changes stay uncached

FileProcessor creates a FileDiff for reported line changes even when the
printed content is unchanged, so such files were never cached in dry-run.
Gate caching on FileProcessResult::hasChanged() instead.
@TomasVotruba

Copy link
Copy Markdown
Member

Thank you 👍

@TomasVotruba
TomasVotruba merged commit 9024bc5 into rectorphp:main Oct 1, 2026
50 checks passed
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.

2 participants