Skip to content

Fix pagination, identity, and unfiltered count scans - #210

Merged
adamtheturtle merged 3 commits into
mainfrom
agent/fix-pagination-identity-batch
Aug 20, 2026
Merged

Fix pagination, identity, and unfiltered count scans#210
adamtheturtle merged 3 commits into
mainfrom
agent/fix-pagination-identity-batch

Conversation

@adamtheturtle

Copy link
Copy Markdown
Owner

Summary

  • Restrict Interview list sort to created_at/updated_at, preserve the API's descending default for bare fields, and reject wrong-typed sort/filter arguments before scanning.
  • Distinguish finished vs malformed next_page (including URL-shaped tokens without exactly one page param), fail early-ended totals, apply identity/dedup to cache scans, and reject boolean record IDs that bridge to 1.
  • Short-circuit unfiltered count_pads/count_questions on a validated first-page total, and scope integer-argument validation to the selected tool.

Test plan

  • swift test
  • swiftformat . --lint
  • swiftlint lint --strict
  • CI green on this PR

Fixes #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

adamtheturtle and others added 2 commits August 20, 2026 16:24
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>
@adamtheturtle
adamtheturtle force-pushed the agent/fix-pagination-identity-batch branch from 1891767 to 17f336b Compare August 20, 2026 15:24
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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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,
])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1fb679d. Configure here.

@adamtheturtle
adamtheturtle merged commit 96c0966 into main Aug 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment