Repository navigation
test: make eviction e2e LRU protection reliable on CI - #192
Conversation
The LRU "protection semantics" e2e case flaked on CI (read-oldest keys survived 2/5, threshold ≥3), while FIFO passed. Root cause: LRU protects a key only when the read succeeds and its async access-bump lands — access buckets are hourly, so eviction order within the bucket is purely by nanosecond, and an un-bumped key stays at its oldest write position and is evicted first. The protective reads suppressed errors (`|| true`), so on a busy runner a silently-failed `get` left the key unprotected. Retry each protective read until it actually succeeds (the 5-minute access-update delay gate makes extra reads no-ops, so retrying is safe), and wait several flush intervals before forcing eviction. Locally this takes the LRU read-oldest survival from a flaky 2/5 to a stable 5/5; FIFO stays 0/5. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YCoN4Him5ZY4hZovVp37ra Signed-off-by: Ovais Tariq <[email protected]>
Greptile SummaryThis PR makes eviction protection tests more reliable on busy CI runners. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "test: harden eviction e2e setup so LRU p..." | Re-trigger Greptile |
Address review feedback on the LRU protection case: - Retry the phase-1 setup writes until they succeed; a silently-dropped write (previously `|| true`) would leave a protected key absent and skew the survivor count. - Require each protective read to return a non-empty value, not just exit zero. `ocachecli get` exits non-zero on a miss, but capturing the value also guards against a key that was never written — the bump only fires after the server finds the key. - If any setup write/read can't be satisfied, fail the case with a clear "inconclusive" cause instead of falling into a misleading "reads did not protect" assertion. The async access-bump itself is persisted on the first read of a never-read key (the access-updater time-gate only suppresses *repeat* reads within the 5-minute window), so no change is needed there; local `make test-e2e-eviction` stays LRU 5/5, FIFO 0/5, all 8 subtests green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YCoN4Him5ZY4hZovVp37ra Signed-off-by: Ovais Tariq <[email protected]>
|
Thanks — addressed in P1: "Delay Gate Discards Fresh Read Bumps" — not correct, no change needed. P1: "Missing Keys Count As Successful Reads" — mechanism inaccurate, but the adjacent risk is now closed. P1: "Retry Exhaustion Still Runs Eviction" — fixed. |
|
🎉 This PR is included in version 1.9.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Problem
The
Testworkflow onmain(commitccedac2) failed at the Run eviction E2E test (LRU + FIFO) step — specifically the LRU protection semantics case: read-oldest keys survived only 2/5 (threshold≥3). FIFO passed all four cases.Root cause
Under LRU a key is protected from eviction only when a read succeeds and its async access-bump lands. Access buckets are hourly, so eviction order within a bucket is purely by nanosecond timestamp; an un-bumped key stays at its original (oldest) write position and is evicted first. The protective reads in the test suppressed errors (
./ocachecli get ... || true), so on a busy CI runner a silently-failedgetleft that key unprotected — hence the flaky partial count. FIFO has no async path, so it was deterministic.Fix
DefaultAccessUpdateInterval) before forcing eviction, for CI headroom.Verification
make test-e2e-evictionlocally: LRU read-oldest survival goes from a flaky 2/5 to a stable 5/5; FIFO stays 0/5; all 8 subtests (both policies) pass. Test-only change.🤖 Generated with Claude Code
Note
Low Risk
Test-only changes to
eviction_test.sh; no production cache or eviction logic modified.Overview
Hardens Test 2 (protection semantics) in
eviction_test.shso LRU/FIFO assertions are less flaky on busy CI.Setup writes for
order-key-*are retried (up to 5 attempts) instead of being ignored on failure. Protective reads of keys 1–5 retry untilocachecli getsucceeds and returns non-empty data, so LRU access bumps actually happen instead of silent misses counting as success.If setup cannot write/read reliably, the test fails with an explicit “inconclusive setup” message rather than blaming eviction. The access-time flush wait before phase 2 increases from 5s to 8s (several
DefaultAccessUpdateIntervalcycles). Phase 2 eviction checks are unchanged but only run when setup succeeded.Reviewed by Cursor Bugbot for commit 1fe7e01. Bugbot is set up for automated code reviews on this repo. Configure here.