Code review
Send the change description, the diff and the related tests to Claude Fable 5.1, and have it find logic errors and uncovered edge cases, with an input that reproduces each one. Before merging, turn that input into a test and confirm it fails first and passes after the fix.
Example: What does this pagination change miss?
Material
- Change description
- The export endpoint now exports in pages of 20 rows.
- export.ts
- const pages = Math.floor(total / pageSize);
- Existing test
- Only covers total = 40 and pageSize = 20, expecting 2 pages.
PromptReview this change, find the logic error, and give an input that reproduces it, the fix and the test to add.
Sample answer · written by hand to show the reasoning
When the total is not a multiple of the page size, the last page is dropped: with total = 45, Math.floor gives 2 pages and the last 5 rows are lost. Use Math.ceil(total / pageSize) and add a test with total = 45 expecting 3 pages; the existing test only uses an evenly divisible total, which is why it passed.