Skip to content

[Testing] Isolate ApplicationFileProcessorTest cache dir to fix parallel flake - #8360

Merged
TomasVotruba merged 1 commit into
mainfrom
fix-application-file-processor-cache-isolation
Aug 22, 2026
Merged

[Testing] Isolate ApplicationFileProcessorTest cache dir to fix parallel flake#8360
TomasVotruba merged 1 commit into
mainfrom
fix-application-file-processor-cache-isolation

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Problem

ApplicationFileProcessorTest asserts that files are cached as unchanged on disk, using the shared default cache dir sys_get_temp_dir()/rector_cached_files. Cache is a process-wide singleton and that dir is shared across every parallel fastunit -tia chunk process.

Other tests wipe that whole dir mid-run:

  • ChangedFilesDetector::clear() in teardown (rm -rf the dir),
  • config-change invalidation in the many rule tests.

When a parallel process wipes the dir between this test's processFiles() and its assertion, hasFileChanged() defensively returns true, so the assertFalse(...) calls flip:

Failed asserting that true is false.

It is a latent flake. It surfaced in #8358 because that PR touches the central ConfigurationRuleFilter, so TIA marked this test impacted and co-scheduled it with cache-wiping tests. main was green only by scheduling luck.

Fix

Isolate this test's cache dir, mirroring the existing _rector_cached_files_test pattern used by the caching tests. The container is reset in setUp() (same pattern as SkipperRectorRuleTest) so the isolated dir is applied before the Cache singleton is built.

Proof

Background loop wiping the default dir while running the test 8x:

version result under wipe race
before pass=3 fail=5
after pass=8 fail=0

@TomasVotruba
TomasVotruba merged commit 9a5dde6 into main Aug 22, 2026
51 checks passed
@TomasVotruba
TomasVotruba deleted the fix-application-file-processor-cache-isolation branch August 22, 2026 11:10
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