Code RoomCache TTL concurrent access bug
HardPrep Room Coding #4097

Cache TTL concurrent access bug

Vibe & agenticConcurrencySenior–Staff~20 min

An agent wrote this Go cache-with-TTL for a hot path and it passed your unit tests. It looks idiomatic, but it's wrong under concurrency in a way your tests didn't catch. Find the bug, explain the input/timing that triggers it, give the fix, and say what about reviewing AI code makes this class of bug easy to miss.

Implement
replay_cache_ops(op_lines: list[str]) → list[str]
Examples
in[["set|a|alpha|10","get|a|5","get|a|10","get|a|11","get|a|12","size"]]out["alpha","alpha","MISS","MISS","0"]
in[["set|a|1|5","set|b|2|100","get|a|6","size","get|b|7","size"]]out["MISS","1","2","1"]
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.