Code Room
Vibe codingMedium
Question
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.
func readMessage(conn net.Conn) ([]byte, error) { buf := make([]byte, 4096) n, err := conn.Read(buf) if err != nil { return nil, err } // first 4 bytes = big-endian length, rest = payload length := binary.BigEndian.Uint32(buf[:4]) payload := buf[4 : 4+length] return payload, nil}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.
Learn the concepts
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.