Skip to content

Fix --paginate for flows, Link-header lists, and single-object GETs - #13

Open
edumansky wants to merge 1 commit into
mainfrom
fix-paginate-endpoints
Open

edumansky wants to merge 1 commit into
mainfrom
fix-paginate-endpoints

Conversation

@edumansky

@edumansky edumansky commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

--paginate had three failures:

  • cc flow list crashed or stopped early. The flow store pages with size (not pageSize), returns a bare array unless includePagination=true, and reports totals in pageInfo (not meta). Without --include-pagination true it failed with cannot unmarshal array. With it, it fetched only page 0 at the default size of 10. cc functions list and cc flow search had the same problem.
  • Lists that page only through a Link header looped forever. Examples are rooms, memberships, people, meetings and recordings. The non-CC paginator sent start, which these endpoints ignore, so it got the same first page again and again. In testing, messaging rooms list --paginate made dozens of requests for the same 100 rooms.
  • Single-object GETs printed the wrong thing. Every GET had a --paginate branch. cc skill get --paginate printed null. admin people get-my-own --paginate printed one of the person's arrays instead of the person.

Changes

  • internal/client
    • The CC paginator takes the page-size parameter name from req.PageSizeParam, reads totals from meta or pageInfo, treats a bare array as one complete page, and prints a non-list response unchanged.
    • The non-CC paginator follows Link: rel="next" when present, and only to the same host as the base URL. Otherwise it advances the endpoint's own offset parameter, set by req.OffsetPaging: start/max, offset/max, or 1-based SCIM startIndex/count. It stops when a page repeats the previous page's first item.
    • client.Do now exposes response headers internally so the paginator can read Link.
  • codegen/generate_cli.py emits the --paginate branch only for GETs that declare paging parameters or are list… commands, along with the paging hints above. The regenerated cmd/ output drops the branch from about 800 single-object GETs and adds hints to the CC size endpoints and 171 non-CC list commands.
  • Docs: the --paginate flag description in the README and site, and a note in the skill and the CC page.

Known limitations

  • cc tasks get --paginate still returns at most 100 tasks, because the API reports no page count.
  • The Slido list-compliance-events commands return one page, because they page with a token in the response body.

Validation

  • go test ./... passes. New internal/client/pagination_test.go covers flow-store paging, Link following, refusing a link to another host, an endpoint that ignores start, start/max, SCIM and CC single objects.
  • python3 -m unittest discover -s codegen -p 'test_*.py' passes. New tests cover which paging hint each kind of endpoint gets.
  • make check and npm run build in site/ pass.
  • Live on a test tenant with --paginate:
    • cc flow list returned all 11 flows (previously a crash, or 10).
    • messaging rooms list returned 596 unique rooms in 6 requests; one --max 1000 call also returns 596.
    • messaging memberships list returned 614 across 7 pages.
    • calling numbers get-phone-org and admin people list match their non-paginated counts.
    • cc skill get and admin people get-my-own print the full object.
  • Not tested live: more than 100 items with start/max, which the tenant doesn't have, and SCIM. admin scim-2-users search returns a 404 on this tenant whether or not this change is applied; it appears to send the base64 org ID where SCIM expects the UUID.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UtLeQHRwiKpRw7YnQ3KoEt


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Contact Center paging now honours endpoints that page with `size`, report
totals in `pageInfo`, or return a bare array (the flow store, functions).
Other areas follow Link rel="next" headers on the same host, fall back to
the endpoint's own offset parameter (start, offset, or SCIM startIndex),
and stop if a page repeats. The generator only emits the --paginate branch
for GETs that declare paging parameters or are list commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UtLeQHRwiKpRw7YnQ3KoEt

@edumansky edumansky left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Codex review (gpt-6-astra, reasoning effort: high)

No actionable regressions were identified in the pagination changes or regenerated commands. All Go tests, go vet, and the 28 Python code-generation tests passed.

@edumansky

Copy link
Copy Markdown
Contributor Author

Codex review summary

Codex (gpt-6-astra, high effort) reviewed 7e61ab6 and reported no findings, so no fix commit was needed.

As part of its review, Codex ran:

  • go test ./...: pass
  • go vet ./...: pass
  • python3 -m unittest discover -s codegen -p 'test_*.py': 28 tests pass

No test failures, environmental or otherwise.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant