Refresh stale archive ID cache when archive rows disappear#24246
Merged
Refresh stale archive ID cache when archive rows disappear#24246
Conversation
chippison
approved these changes
Mar 19, 2026
Contributor
chippison
left a comment
There was a problem hiding this comment.
Code looks good.
Can't really do manual smoke/functional test for the issue here.
Run integration test and it works. Performed some archiving locally just to make sure everything is still good and everything works fine
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.
Summary
This PR fixes a stale-archive-cache issue in Archive::get() that can return empty data from valid reports when cached
archive IDs point to rows that no longer exist.
refs #24191
Problem
Archive caches archive IDs in-memory. If those rows are removed after the cache is populated, later reads in the same
request can still query with stale IDs and return no rows, leading to incorrect zeroed metrics.
Root Cause
Archive::get() trusted cached IDs unconditionally and had no recovery path when ArchiveSelector::getArchiveData()
returned empty for otherwise valid archive queries.
Fix
When archive data comes back empty, Archive::get() now:
Tests
Added integration regression tests in tests/PHPUnit/Integration/ArchiveTest.php:
The second test reproduces the issue via normal flow (no reflection-based cache overwrite): cache is primed, archive
rows are removed, then the same Archive instance is queried again.
Expected Impact
Prevents false-empty archive reads and incorrect zero metrics when cached archive IDs become stale mid-request.
Checklist
Review