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

Implement sliding-window rate-limit middleware for an existing Express app: allow N requests per window per client key, return 429 with the right headers when exceeded. Time is driven by an injectable clock so grading is deterministic — never real wall-clock sleep.

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 the current folder and starts the solve clock.

    promptly init stage-1-03-sliding-window-rate-limiter
  3. Start the captured session

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

    promptly start stage-1-03-sliding-window-rate-limiter
  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.

promptly play stage-1-03-sliding-window-rate-limiter