Repository navigation
Make ResultCacheManagerCollectedDataTest independent of the second boundary - #6898
Merged
Merged
Conversation
…undary saveFullAnalysis() restored the cache with one ResultCacheManager and saved it with another, so the "fresh" save never had the stat signatures the restore recorded and always wrote none. The partial and warm saves record them as soon as the files are older than the second the save begins, so the comparisons failed whenever a second boundary fell between the saves. Restore and save with the same manager, and wait until the files are in the past before saving, like DirectoryWalkerTest and OptimizedDirectorySourceLocatorFactoryTest do, so every save signs every file. Amp-Thread-ID: https://ampcode.com/threads/T-01a1976c-1bde-72f8-b96c-072279109d59
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.
ResultCacheManagerCollectedDataTestfails intermittently on2.3.x. On 92a35f5 it failed in both Tests (PHPUnit 11.x (8.2, ubuntu-latest)) and Compile PHAR (Run with Turbo Extension (ubuntu-latest, 8.2, nts, make tests)), intestPartialSaveEqualsFreshSaveOfMergedData. The only difference was thefileStatentries independencyGraph: the partial save hada/csigned and the fresh save had none.Baseline and first bad commit
testWarmSaveCopiesEveryEntryByteForByte).Root cause (test-only)
saveFullAnalysis()restored with oneResultCacheManagerand processed/saved with another, so the "fresh" save never had the signaturesrestore()recorded and always wroteN. In production, the same manager restores and saves.FileStatSignatureReaderleaves out signatures of files modified in the second the read began. So the partial and warm saves record signatures only when a second boundary has passed since the files were written.The fix restores and saves with the same manager and waits until the files are in the past before saving, the same way
DirectoryWalkerTestandOptimizedDirectorySourceLocatorFactoryTestdo. Nosrc/change.Verification
tests/PHPStan/Analyser/ResultCacheandtests/PHPStan/Filepass.make cspasses, and PHPStan reports no errors on the file.