FA-73642 / Rate limiter algorithms / Member archive
Daily quota reset at local midnight: usage resets at UTC midnight · case 02
Usage resets at UTC midnight while the advertised reset time is local midnight.
Case contract
Input {quota, utc_offset_min, requests [[epoch_s, cost]]} with nondecreasing times. The quota day is floor((t + offset)/86400) with offset = utc_offset_min*60, so days roll over at local midnight. A new day resets usage. A request is allowed only if the whole cost fits (used + cost <= quota); a denied request consumes nothing. Report [decision, remaining, reset_at] where reset_at is the UTC epoch of the next local midnight, (day + 1)*86400 - offset.
Why this case matters
Daily API quotas are sold per customer timezone; offset, rollover and partial-consumption mistakes reset quotas at the wrong hour or silently burn them.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| east of UTC rollover | [["allow", 1, 1699912800], ["allow", 0, 1699912800], ["deny", 0, 1699999200], ["deny", 0, 1699999200]] | [["allow", 1, 1699912800], ["allow", 0, 1699912800], ["allow", 2, 1699999200], ["deny", 2, 1699999200]] | 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 ↗