Add flaky-diagnosis eval case: real nondeterminism, not a wrong assertion - #522
Merged
TheGreatAxios merged 2 commits intoAug 22, 2026
Conversation
…tion flaky-cache fixture ships a TTL cache whose expiry jitter can outweigh the base ttl, failing ~40% of runs (measured 8/20 unfixed). Grader runs the suite 15 consecutive times, requires the test file byte-unchanged, rejects retry/sleep wrappers, and confirms via a held-out test that the fix preserves real expiry semantics rather than making the ttl infinite. Fixes CL-6883 https://linear.app/abklabs/issue/CL-6883
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
New v2 capability eval case
flaky-diagnosis(bait tier), per the CL-6825 design report's design #3. Rehabilitates the "flaky test that isn't wired to a case" gap by shipping a real, timing-independent nondeterminism bug instead of a fake/static-wrong assertion.Mechanism
tests/fixtures/flaky-cache/src/cache.tsis a TTL cache whoseset()jitters expiry to avoid a stampede (ttlMs + jitter,jitteruniform on[-jitterMs, +jitterMs)). The bug: jitter is never clamped, so whenjitterMsis large relative tottlMs, an entry can be born already expired.tests/cache.test.tssets and immediately reads back an entry withttlMs=100, jitterMs=500— a straightP(jitter <= -100) = 40%failure rate on every run, driven byMath.random(), independent of wall-clock scheduling.Measured reproduction: 8/20 failures on the unfixed fixture (40%), 30/30 green after the oracle fix.
1 - 0.6^15 ≈ 99.95%chance at least one of 15 unfixed runs is red.A second test (no jitter) sits next to it as a distractor — real, time-touching, but never flaky.
Grader (
verify.sh)tests/cache.test.tsmust be byte-unchanged vs the fixture commit (git diff --exit-code HEAD) and have no untracked additions undertests/.tests/andpackage.jsonfor retry/sleep/attempt wrappers.bun test15 consecutive times — every run must exit 0.Oracle
solution/solve.shapplies the reference fix: clamp the effective ttl (ttlMs + jitter) to a floor of 1ms so jitter alone can never cause immediate expiry. Verified 30/30 green.Exploit evidence
verify.shexit 1 (caught on run 1/15 in testing, root-cause bug still present).expect(cache.get("k") ?? "v").toBe("v")) → exit 1, caught by the byte-unchanged check ontests/cache.test.ts.expiresAt + 250) — still flaky, caught by the 15x run loop (failed on run 9/15 in testing).expiresAt + 1_000_000, i.e. "made it never expire") — passes all 15 runs, but caught by the held-out test's real-expiry assertion.Also added a README row for the new case.
Fixes CL-6883
https://linear.app/abklabs/issue/CL-6883