Repository navigation
Let the expiry test outlast a loaded machine, and say what it assumes - #194
Merged
matrixarkai merged 1 commit intoOct 24, 2026
Merged
Conversation
The incremental-reclaim test wrote sixty-four entries with a forty-millisecond life, recorded the memory figure as a peak, slept, wrote sixty-four more, and asserted memory had not grown past that peak. On a loaded machine the first loop took longer than forty milliseconds. The earliest keys lapsed and were reclaimed while the rest were still being written, so the peak was recorded at 832 bytes of the 4,096 the round actually held -- and the second round then read as growth. The test failed for a reason that has nothing to do with what it is about: one failure in a six-hundred test suite, green on its own three times in a row immediately afterwards. Two changes, and the second is the one that matters. The life is half a second and the sleep outlasts it, so the loop has to be an order of magnitude slower than it was before the fixture breaks. And the precondition is asserted instead of assumed: nothing may have lapsed when the peak is taken, and the peak has to account for every entry of the round. A machine slow enough to break that now fails saying so, rather than leaving a short peak to be read as growth at the end. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The incremental-reclaim test wrote sixty-four entries with a forty-millisecond
life, recorded the memory figure as a peak, slept, wrote sixty-four more, and
asserted memory had not grown past that peak.
On a loaded machine the first loop took longer than forty milliseconds. The
earliest keys lapsed and were reclaimed while the rest were still being
written, so the peak was recorded at 832 bytes of the 4,096 the round
actually held — and the second round then read as growth:
One failure in a six-hundred-test suite, green on its own three times in a row
immediately afterwards. The test failed for a reason that has nothing to do
with what it is about.
Two changes, and the second is the one that matters
The life is half a second and the sleep outlasts it, so the write loop has to
be an order of magnitude slower than it was before the fixture breaks.
And the precondition is asserted instead of assumed: nothing may have
lapsed when the peak is taken, and the peak has to account for every entry of
the round. A machine slow enough to break that now fails saying so, rather
than leaving a short peak to be read as growth at the end.
Planted
The condition is a machine slow enough that the round outlives the life it was
written with, so the plant slows the loop rather than shortening the life — a
life under a millisecond truncates to zero, which this cache reads as "no
expiry", and would have planted something else entirely.
With a one-millisecond life and two milliseconds between writes, the new
assertion fires:
Green before the plant and green again after it, run on its own each time.
Gates on both feature arms:
cargo fmt --check,clippy --all-targets -D warnings, both suites, the vocabulary check, and the allocation report with--require-passed.🤖 Generated with Claude Code