Code Room
Vibe codingMediumvc-g030
Subject Ai code reviewLevel Mid–Senior~16 minCommon in Networking & APIs interviewsIndustries Software development

Question

You asked an AI assistant to paginate over a REST API that returns 100 items per page, accumulating all results. It produced this Python:

python
import requests def fetch_all(url):    items, page = [], 1    while True:        resp = requests.get(url, params={"page": page, "per_page": 100})        batch = resp.json()["items"]        items.extend(batch)        if len(batch) < 100:            break        page += 1    return items

It passes your smoke test against a 250-item endpoint. What's wrong, and how would you catch it before it ships?

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.