Length-prefixed message corruption
An AI assistant generated this Go function to read a length-prefixed message off a TCP connection for an internal RPC protocol. It passed the demo against a local loopback server. Identify why it will corrupt or drop messages in production, name the trigger, and the fix.
Implement
extract_frames(stream: list[int], max_frame_len: int) → list[list[int]]Examples
in
[[0,0,0,3,104,105,33],1024]out[[104,105,33]]in
[[0,0,0,2,1,2,0,0,0,1,9],1024]out[[1,2],[9]]in
[[0,0,0,5,1,2],1024]out[]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 18 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.