Rate Limiter: Requests Slip Through During an Outage (JavaScript)
A practice debugging interview round in JavaScript. Reproduce the failure in an unfamiliar codebase, narrow down the cause, ship a minimal fix, and explain your reasoning to an AI interviewer.
The incident
The API gateway uses a shared quota store to reserve requests within a rolling window. During a storage incident, requests were admitted without a confirmed reservation. An unrelated invalid store response also never reached the caller's error reporter.
Required behavior
- Return true only after a reservation succeeds; reaching the quota normally returns false.
- A StoreUnavailableError from cleanup, counting, or reservation must deny the current request by returning false. This gateway prioritizes enforcing the quota during an outage.
- Every other thrown value must propagate unchanged to the caller, which owns error reporting.
- Attempt each store operation at most once per request. A write timeout may occur after the reservation committed; the store has no idempotency key or rollback API.
- A subsequent request should work normally when storage recovers.
- Preserve per-client quotas, expiry, inclusive window boundaries, and both exported function signatures.
Read README.md and the visible tests, reproduce the incident with Run Tests, and change only src/rate-limiter.js.
What this round practices
Rate limiters sit in front of every public API, and how they behave when their own storage is down is a classic design question. This round asks you to reason about failure modes as well as the happy path, and to explain which way the gateway should fail and who needs to hear about it.
Files you will work in
These 5 workspace files open in the in-browser editor when you start the round. Hidden tests also run when you submit.
task.mdREADME.mdsrc/window-store.jssrc/rate-limiter.jstests/rate-limiter.test.js
What you are assessed on
The scored report evaluates both your investigation steps and what you explain during the conversation, not only whether the final test run passes.
- Reproduction
- File navigation
- Evidence gathering
- Hypothesis
- Root-cause understanding
- Regression prevention
- Patch scope
- Verification
- Edit control
- Communication clarity
How the round works
You get 30 minutes in a JavaScript workspace that runs in your browser, with no setup. Talk through your plan with the AI interviewer by voice or text, run the tests as often as you like, and submit when the visible checks pass. Hidden tests run on submit, and the scored report covers what you did and what you explained.
Ready to debug this codebase?
Open the workspace, run the failing check first, and walk the AI interviewer through your findings.
Related rounds
View all debugging rounds- MediumBug fix
Support Console: Reservation Lookup Shows the Wrong Guest
A reservation support console sometimes shows the previous caller's booking after an agent searches a new ref, and an agent acted on the wrong reservation before catching it.
JavaScript · 45 min
- MediumBug fix
Ops Panel Undercounts Cold-Streak Recovery Windows
A data-center telemetry panel annotates only part of a cold streak's recovery wait, so alert summaries look calmer than the racks actually ran.
JavaScript · 30 min
- MediumBug fix
Compute-Usage Rollup Overbills a Replayed Build
A metered compute-usage rollup overbills several accounts for compute-seconds after a backfill replayed a transform's backup build into the pipeline.
JavaScript · 40 min