Code Room
Vibe codingHardvc-g093
Subject Ai prompt iterationLevel Senior–Staff~20 minCommon in Algorithms & data structures interviewsIndustries Telecom, Software development

Question

You ask an AI to write a Go parser for a binary telecom protocol where each packet is a 4-byte big-endian length followed by that many bytes of payload, streamed over TCP. It writes a loop that does `conn.Read(buf)` once into a 4096-byte buffer and slices off the length, then the payload. It works against your test that sends one packet per write. In integration it corrupts frames: TCP coalesces and splits writes, so one `Read` returns 1.5 packets or half a length header. You re-prompt 'handle partial reads'; it adds a second `Read` but still assumes a header arrives whole. How do you re-steer?

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.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.