store: de-flake TestFileStoreTable timing windows#3789
Merged
Conversation
TestFileStoreTable failed intermittently on CI ("Expected 2 items, got 1"):
the same commit passed the Unit Tests job on a PR run and failed on the master
push. Cause: records written with a 100ms expiry are read back immediately and
expected to still be present, but under `-race` on a loaded runner the write
loop + file I/O + read can exceed 100ms, so a record expires before the read.
Widen the expiry/TTL windows (100ms -> 1s) and the paired post-expiry sleeps
(-> 2s). The "read before expiry" reads happen in well under 200ms, so they stay
inside the 1s window on any runner; the "read after expiry" waits comfortably
exceed it. Test-only; the store's expiry behavior is unchanged.
Verified: `go test -race -count=5 -run TestFileStoreTable ./store/` green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL
This was referenced Jul 3, 2026
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.
Problem
TestFileStoreTable(store package) failed intermittently on CI — run 28653768382, "Expected 2 items, got 1". It's a flaky test, not a regression: the identical commit (a356ab3) passed thisUnit Testsjob on the #3784 PR run and failed on the master-push run.Root cause
The test writes records with a 100ms expiry, then immediately reads and expects them still present. Under
-raceon a loaded runner, the write loop + file I/O + read can take longer than 100ms, so a record expires before the "expect 2 / expect 1" read. It's a too-tight timing window — the store's expiry behavior itself is correct.Fix
Widen the expiry/TTL windows (100ms → 1s) and the paired post-expiry sleeps (→ 2s). The "read before expiry" reads happen in well under 200ms, so they stay safely inside the 1s window on any runner; the "read after expiry" waits comfortably exceed it. Test-only.
Verification
go test -race -count=5 -run TestFileStoreTable ./store/— green (the flake reproduced ~1-in-N before; repeated race runs now pass).Note: this is the kind of failure the
loop-triagebackstop (#3714) now watchesRun Testsfor.🤖 Generated with Claude Code
Generated by Claude Code