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

Question

An AI agent generated this Python client to pull all charges from a paginated REST API (cursor-based, returns `has_more` and `next_cursor`). It returns the right data for accounts with a single page but silently drops records for large accounts.

python
def list_all_charges(client, account_id):    resp = client.get(f"/v1/charges?account={account_id}&limit=100")    data = resp.json()    charges = data["data"]    while data["has_more"]:        resp = client.get(f"/v1/charges?account={account_id}&limit=100")        charges += data["data"]    return charges

What is broken, and what else is missing for production use?

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.