Code RoomTest parseRetryAfter with targeted inputs
MediumPrep Room Coding #4393

Test parseRetryAfter with targeted inputs

Vibe & agenticAlgorithms & data structuresMid–Senior~16 min

An AI agent wrote a TypeScript function `parseRetryAfter(header: string): number` that turns an HTTP `Retry-After` header into a delay in milliseconds. The header can be either a number of seconds or an HTTP-date. You want to expose a bug with as few test inputs as possible. Which 2-3 inputs do you pick, and what bug is each one hunting for?

Implement
parse_retry_after_ms(header: str, now_epoch_seconds: int) → int
Examples
in["120",1445412480]out120000
in["Wed, 21 Oct 2015 07:30:00 GMT",1445412480]out120000
in["Wed, 21 Oct 2015 07:00:00 GMT",1445412480]out0
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 16 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.