Code Room
Vibe codingHard
Question
An AI agent added this Express route to let a logged-in user fetch one of their invoices. Authentication middleware already runs upstream and sets `req.user.id`. The code passes the team's tests (which only check the owner's own invoice). What's the defect, and how should review have caught it?
app.get("/api/invoices/:id", requireAuth, async (req, res) => { const invoice = await db.invoice.findUnique({ where: { id: req.params.id }, }); if (!invoice) return res.status(404).json({ error: "not found" }); res.json(invoice);});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.