Code Room
Vibe codingHardvc-g552
Subject Ai code reviewLevel Mid–Senior~17 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

An AI agent wrote this Node.js endpoint to let users upload and parse a CSV of contacts. It worked in the demo with a 20-row file. What fails for real users with real files, and how would you harden it?

js
app.post('/import', async (req, res) => {  const text = await fs.promises.readFile(req.file.path, 'utf8');  const rows = text.split('\n').map((line) => line.split(','));  const contacts = rows.map(([name, email]) => ({ name, email }));  await db.insertMany(contacts);  res.json({ imported: contacts.length });});
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.