Code RoomRedirecting misdiagnosed async bugs
MediumPrep Room Coding #4048

Redirecting misdiagnosed async bugs

Vibe & agenticAlgorithms & data structuresMid–Senior~17 min

You ask an AI to write a TypeScript debounce hook for a search box. It returns a `useDebounce` that uses `setTimeout`/`clearTimeout` and works in the demo. In your app it fires a stale request: when the user types fast, an older in-flight fetch sometimes resolves after a newer one and overwrites the results. You tell it 'the results are wrong, fix the debounce' and it lowers the delay. The debounce was never the bug. How do you re-steer?

Implement
apply_search_responses(events: list[str]) → list[str]
Examples
in[["fire ca","fire cat","resolve 1","resolve 0"]]out["cat"]
in[["fire ca","resolve 0","fire cat","resolve 1"]]out["ca","cat"]
in[["fire a","fire ab","fire abc","resolve 2","resolve 1","resolve 0"]]out["abc"]
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 17 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.