FA-73427 / Rate limiter algorithms / Member archive
Fixed-window request counter: remaining reported before charging · case 02
The last permitted request is advertised as leaving one more.
Case contract
Input {limit, window_ms, requests [[t, key]]}. Windows are epoch-aligned: index t div W. Each (case-sensitive) key keeps [window, count]; a request in a later window resets the count, while a late request from an earlier window is charged to the current window. Allow while count < limit and report remaining = limit - count after charging; denials are not counted. reset = ms until the end of the key's current window. Return [[decision, remaining, reset]].
Why this case matters
Fixed windows are the simplest API quota; alignment, reset and key-identity mistakes show up as double bursts, stuck quotas or cross-tenant throttling.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| window boundary resets | [["allow", 2, 10], ["allow", 1, 5], ["deny", 0, 1], ["allow", 2, 1000], ["allow", 1, 498]] | [["allow", 1, 10], ["allow", 0, 5], ["deny", 0, 1], ["allow", 1, 1000], ["allow", 0, 498]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗