Code Room
Vibe codingHardvc-g105
Subject Ai code reviewLevel Senior–Staff~18 minCommon in Networking & APIs interviewsIndustries Software development

Question

An AI assistant wrote this TypeScript function to sync issues from a third-party API that enforces 60 requests/minute and returns rate-limit headers. It worked in testing against a handful of issues. In production it gets the integration's API token throttled and then banned for an hour.

ts
async function syncAll(ids: string[]) {  const results = await Promise.all(    ids.map((id) => fetch(`https://api.example.com/issues/${id}`).then(r => r.json()))  );  return results;}

What's the failure, and how do you make this respect the contract?

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.