Repository navigation
fix(ratelimit): stop the window parsing differential from flaking at window boundaries - #4
Conversation
yordis
commented
Oct 30, 2026
- The Redis parity job failed on an unrelated PR because the ratelimit window parsing differential compared the reset time against a clock read taken after the request, so a 1.5 s window boundary landing during the round trip made the reset look already past.
- A pinned clock reproduces it deterministically, so the flake stays fixed instead of passing on rerun.
…e in the window it runs Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…e so a window boundary cannot flip it Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
|
TrogonStack is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.
|
| Layer / File(s) | Summary |
|---|---|
Shared fixed-window assertions and boundary cases packages/next-nats/tests/vitest/differential/ratelimit.behavior.differential.test.ts |
Adds a helper that reports success, remaining tokens, and whether reset occurs after request start. Adds comparisons for requests near a window boundary and within a later window. Updates parsing cases to use the helper for both implementations. |
Estimated code review effort: 2 (Simple) | ~10 minutes
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.
Comment @coderabbitai help to get the list of available commands.