Rate limiter test specification
You're about to ask an AI agent to write the test suite for a new rate limiter (token-bucket: capacity, refill rate, per-key buckets) in Rust. You know that if you just say 'write thorough tests,' you'll get happy-path tests pinned to whatever the implementation happens to do. Write the prompt/spec you'd give the agent so the tests verify the real contract — and name the one thing a vague prompt gets most wrong here.
token_bucket_decisions(capacity: int, refill_per_sec: int, keys: list[str], times: list[int]) → list[bool][2,1,["a","a","a"],[0,0,0]]out[true,true,false][2,1,["a","a","a","a"],[0,0,1,1]]out[true,true,true,false][1,1,["a","b","a"],[0,0,0]]out[true,true,false]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.
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.