Code RoomRate limiter state never resets
HardPrep Room Coding #4177

Rate limiter state never resets

Vibe & agenticSecuritySenior–Staff~20 min

Asked to add a per-tenant rate limiter to a multi-tenant API, an AI agent produced this TypeScript middleware. It compiles, passes the happy-path test, and the agent explained it confidently. It's going into a regulated fintech gateway. What's wrong, and how would your process have caught it before it shipped?

Implement
rate_limit_decisions(tenant_ids: list[str], timestamps_ms: list[int], max_per_window: int, window_ms: int) → list[bool]
Examples
in[["t1","t1","t1"],[0,100,200],2,60000]out[true,true,false]
in[["t1","","t2"],[0,0,0],1,1000]out[true,false,true]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 20 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.