Fix pagination, identity, and unfiltered count scans - #210
Conversation
Restrict list sorts to the documented fields with the API's descending default, reject wrong-typed filters and irrelevant integer args, treat malformed next_page as incomplete rather than finished, and avoid walking every page for unfiltered counts. Co-authored-by: Cursor <cursoragent@cursor.com>
JSON booleans are rejected with `is Bool`, which also matches bridged boolean NSNumbers on Apple platforms without CF APIs. Co-authored-by: Cursor <cursoragent@cursor.com>
1891767 to
17f336b
Compare
Linux CI cannot see CFGetTypeID; rely on `is Bool`, which also matches bridged boolean NSNumbers on Apple platforms. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1fb679d. Configure here.
| "pages_fetched": 1, | ||
| "truncated": false, | ||
| "total_reported_by_api": total, | ||
| ]) |
There was a problem hiding this comment.
Unfiltered counts trust inconsistent totals
Medium Severity
Unfiltered count_pads and count_questions treat any non-negative first-page total as a complete count and skip further paging. That ignores next_page and the records already on the page, so a finished or empty first page with a too-large total is returned as an exact match. The filtered scan path already treats that mismatch as incomplete pagination, so the same API payload can yield a wrong successful count when unfiltered and an error when filtered.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 1fb679d. Configure here.


Summary
sorttocreated_at/updated_at, preserve the API's descending default for bare fields, and reject wrong-typed sort/filter arguments before scanning.next_page(including URL-shaped tokens without exactly onepageparam), fail early-ended totals, apply identity/dedup to cache scans, and reject boolean record IDs that bridge to1.count_pads/count_questionson a validated first-pagetotal, and scope integer-argument validation to the selected tool.Test plan
swift testswiftformat . --lintswiftlint lint --strictFixes #108
Fixes #109
Fixes #110
Fixes #111
Fixes #112
Fixes #113
Fixes #114
Fixes #115
Fixes #116
Fixes #117
Fixes #118
Fixes #119
Fixes #165
Fixes #166
Fixes #170
Fixes #171
Fixes #188
Made with Cursor