fix(runner): the leak spec must poll KV list(), not read it once (DEV-2567) - #255
Open
danielzytohoc wants to merge 2 commits into
Open
fix(runner): the leak spec must poll KV list(), not read it once (DEV-2567)#255danielzytohoc wants to merge 2 commits into
danielzytohoc wants to merge 2 commits into
Conversation
…-2567) First production execution of this spec (the E2E_API_TOKEN secret now exists) failed its positive control: the meter put is awaited before the create's 200, but the admin panel enumerates meters with KV list(), which is eventually consistent on real Cloudflare KV — a fresh key lags its own put by seconds (documented worst case 60s). wrangler dev's KV is immediate, so the single-shot reads only ever passed locally. The containment checks now poll, and the two absence tests sample a sustained 45s window instead of one read — a leaked phantom is written before the 410 returns, so inside the lag window a single-shot .not.toContain() passed leak or no leak.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 593ae22. Configure here.
…ugbot, #255) 45s undercut the 60s list() worst case the comment itself cites, so a phantom surfacing in the 45-60s gap escaped both absence tests — the same vacuity this PR closes, one constant deeper. The window now mirrors the 90s ceiling the positive polls get: whatever propagation a real key is allowed, a phantom must be waited out for.
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.

First production execution of this spec — unlocked by the new
E2E_API_TOKEN(DEV-2583) — failed its positive control in run 32491144642:a create nobody abandoned is still meteredread the admin panel once, immediately after the create's 200. Test bug, not product: the meter put is awaited before the response, but the panel enumeratessession-meter:keys with KVlist(), which is eventually consistent on real Cloudflare KV — a fresh key can lag its own put by seconds (documented worst case 60s).wrangler dev's KV is immediate, so the single-shot read had only ever been exercised where it couldn't lose.The diagnosis exposed a second, subtler hole: inside that same lag window the two
.not.toContain()tests were vacuous — a leaked phantom meter (written before the 410 returns) wouldn't be visible inlist()yet either, so they passed leak or no leak. Fixes:toPass(90s ceiling, 2s intervals), with the mechanism explained inline;expectNeverMetered) instead of reading once — absence under eventual consistency can't be proven with one read, and the positive control demonstrates a real key surfaces well within the same window.Verified against prod from this branch (run 32492510913, full workflow green): all 3 leak tests + the authed share round-trip pass — 4/4 in 3.1m. The positive control took 50.6s where it used to fail instantly, i.e. the poll absorbed real, observed list() lag.
Note
Low Risk
Test-only change to polling/timeouts; no product, auth, or metering logic is modified.
Overview
Stops the abandoned-create leak spec from treating a single
/adminpanel read as proof. Production KVlist()is eventually consistent (up to ~60s), so a one-shot.toContain()failed the positive control and a one-shot.not.toContain()could pass even if a phantom meter existed.Absence checks now sample for 90s via
expectNeverMetered(5s interval). The live-session and teardown assertions poll withtoPass(90s, 2s). Tests get a 240s timeout so the window exceeds documented KV lag with margin.Reviewed by Cursor Bugbot for commit 7acdc44. Bugbot is set up for automated code reviews on this repo. Configure here.