Kafka consumer loses event order
An AI built this Java Kafka consumer that applies account state-change events. It parallelizes processing across a thread pool for throughput. Review the ordering assumptions.
What correctness bug does the parallelism introduce, and what's the safe design?
Implement
apply_account_events(event_lines: list[str]) → list[str]Examples
in
[["10|a1|create","11|a1|freeze","12|a1|delete"]]out["a1=deleted"]in
[["12|a1|delete","10|a1|create","11|a1|freeze"]]out["a1=deleted"]in
[["11|b|freeze","10|a|create","10|b|create","11|a|delete"]]out["a=deleted","b=frozen"]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 22 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.
Run or narrate your approach, then ask the coach.