Code RoomPagination assumes stable ordering
MediumPrep Room Coding #3998

Pagination assumes stable ordering

Vibe & agenticNetworking & APIsMid–Senior~16 min

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

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

Implement
page_request_counts(total_items: int, per_page: int) → list[int]
Examples
in[250,100]out[3,3]
in[300,100]out[3,4]
in[0,100]out[1,1]
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.

0:00 of about 16 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.