S01 · The Bootsector · L-03

Sliding-Window Rate Limiter

Difficulty
easy
Type
implementation
Session
Standard
Stack
TypeScript node20-ts5
Domain
Web Systems
Est. solve
~25 min

01 · The task

An existing Express app needs sliding-window rate limiting wired in as middleware: cap how often a given client may call, and turn away the overflow the way an HTTP API should. Grading is deterministic, so drive timing through the kit's injectable clock instead of real wall-clock — the exact limits and response shape live in the tests.

02 · Constraints

  • Injectable clock

    Time comes from an injected clock — never real wall-clock sleeps.

03 · Skills exercised

middlewareRequest/response interceptors that wrap an app's handlers.rate-limitingBounding requests per client per window with the correct headers.injectable-clockDriving time from an injected clock so tests are deterministic — never real sleeps.

How to playDaemon

The whole level runs through the local promptly daemon — it pulls the workspace, captures your token usage, tests locally, and submits the ranked run.

  1. Pair this machine

    One-time — approve the code under your devices.

    promptly pair
  2. Pull the workspace

    Downloads the starter kit into ratelimit/ and starts the solve clock — cd in before the next step.

    promptly init ratelimit
  3. Start the captured session

    Then drive your AI tool — the daemon meters every prompt and token live.

    promptly start
  4. Submit for ranked grading

    Runs the full hidden suite and ends the attempt.

    promptly submit

Or combine steps 02–03 into one commandShortcut

promptly play pulls the workspace, launches the daemon, and starts the captured session in a single step — the same as running init then start. Then cd ratelimit and drive your harness.

promptly play ratelimit