test(admission): pin the global bucket's eviction and its correct neighbour #281

Merged
coilysiren merged 1 commit from test/eviction-corpus into main 2026-08-13 06:30:45 +00:00
Member

Tests only, CI-green. Corpus for #280.

Three tests, and the third is the interesting one

TestGlobalBucketIsEvictedByKeyRotation — characterization. Nine admissions against a global burst of two, with rotating caller keys, in one microsecond. Currently five get through. Recorded as-is so the suite stays green and the row flips when the bypass closes; the failure message names both fixes that would do it.

TestGlobalBudgetHoldsWithoutRotation — the control, and it earns its place. Without it the first test would still pass against a limiter that had simply stopped bounding anything at all. Same policy, one steady caller, exactly two admitted.

TestExchangeLimiterEvictsTheLeastRecentlyUsedexchangeLimiter is the same shape done correctly, one file away. It evicts by run.last, so churn cannot displace an active key.

I flagged it on the issue as a suspected sibling defect. It is not one. Pinning it does two things: retires my suspicion with evidence instead of leaving it hanging, and gives the rate limiter a working reference in the same package — which makes the FIFO-labelled-LRU look like the oversight it probably is rather than a considered trade.

Verified both directions

Mutation Result
exempt global from eviction (the proposed fix) admitted 2 of 9 against a burst of 2
reverse the exchange comparison to evict the most recent both assertions fail

The first is worth calling out: it confirms the fix I suggested on the issue actually fixes it, measured, without my shipping product code. Whoever takes #280 can check their change against a corpus that already knows what right looks like.

go vet, gofmt, full go test ./..., pre-commit run --files clean.


Quail (QA)

Tests only, CI-green. Corpus for https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/280. ## Three tests, and the third is the interesting one **`TestGlobalBucketIsEvictedByKeyRotation`** — characterization. Nine admissions against a global burst of two, with rotating caller keys, in one microsecond. Currently five get through. Recorded as-is so the suite stays green and the row flips when the bypass closes; the failure message names both fixes that would do it. **`TestGlobalBudgetHoldsWithoutRotation`** — the control, and it earns its place. Without it the first test would still pass against a limiter that had simply stopped bounding anything at all. Same policy, one steady caller, exactly two admitted. **`TestExchangeLimiterEvictsTheLeastRecentlyUsed`** — `exchangeLimiter` is the same shape done correctly, one file away. It evicts by `run.last`, so churn cannot displace an active key. I flagged it on the issue as a **suspected sibling defect**. It is not one. Pinning it does two things: retires my suspicion with evidence instead of leaving it hanging, and gives the rate limiter a working reference in the same package — which makes the FIFO-labelled-LRU look like the oversight it probably is rather than a considered trade. ## Verified both directions | Mutation | Result | | --- | --- | | exempt `global` from eviction (**the proposed fix**) | `admitted 2 of 9 against a burst of 2` | | reverse the exchange comparison to evict the most recent | both assertions fail | The first is worth calling out: it confirms **the fix I suggested on the issue actually fixes it**, measured, without my shipping product code. Whoever takes #280 can check their change against a corpus that already knows what right looks like. `go vet`, `gofmt`, full `go test ./...`, `pre-commit run --files` clean. --- Quail (QA)
test(admission): pin the global bucket's eviction and its correct neighbour
All checks were successful
ci / test (pull_request) Successful in 28s
ci / publish-echo-image (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 16s
187084cf71
Corpus for the global rate-limit bypass. Rotating caller keys evicts the
global bucket, which bucketFor then recreates at full burst, so a budget
of two admits five inside one microsecond.

Recorded as characterization rather than asserted as correct, so the
suite stays green and the row flips when the bypass closes. The failure
message names both fixes that would flip it.

The steady-caller test is the control. Without it the first test would
pass against a limiter that had simply stopped bounding anything.

The third test pins exchangeLimiter, which is the same shape done
correctly and sits one file away: it evicts by last use rather than by
insertion, so churn cannot displace an active key. I flagged it as a
suspected sibling defect when filing, and it is not one. Pinning it makes
the contrast explicit and gives the rate limiter a working reference.

Verified both directions. Exempting global from eviction flips the
characterization with "admitted 2 of 9 against a burst of 2", which also
confirms the suggested fix works. Reversing the exchange comparison to
evict the most recent fails with both of its assertions.

Refs: #280

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-gaming/sirens-echo!281
No description provided.