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.
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?
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.
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.