Fix off-by-one in /items pagination offset (DEMO-13) - #5
Draft
thierrypdamiba wants to merge 1 commit into
Draft
Conversation
Page 1 returned items 11-20 because the offset was computed as page * limit instead of (page - 1) * limit, so the first page of results was never served. Reported by a customer, tracked as DEMO-13.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request was opened by an automated triage agent acting on behalf of Thierry Damiba (@thierrypdamiba), in response to a customer support email. Tracked as Linear ticket DEMO-13.
Bug
Customer report: page 1 of
/itemsreturned items 11–20 instead of 1–10, items 1–10 never appeared on any page, and pages overlapped.Root cause in
buggy-api/src/handler.py: the pagination offset was computed aspage * limitfor 1-indexed pages, so page 1 started at index 10 and the firstlimititems were never served.Fix
Tests
Before:
tests/test_handler.py::test_page_one_starts_at_item_1andtests/test_handler.py::test_all_pages_cover_all_itemsfailed (page 1 returned item id 11; pages 1–3 covered only ids 11–25).After: all 3 tests in
buggy-api/tests/test_handler.pypass (3 passed).Note for reviewers
The gateway's tool set has no label-writing tool, so this body is the record that an agent authored this PR. Policy forces this PR to draft; a human must promote it to ready-for-review.