Skip to content

fix: follow pagination in get_profiles, get_users, and get_user_apikeys - #16

Merged
gormaniac merged 1 commit into
mainfrom
claude/funny-thompson-iyl38w
Nov 2, 2026
Merged

gormaniac merged 1 commit into
mainfrom
claude/funny-thompson-iyl38w

Conversation

@gormaniac

Copy link
Copy Markdown
Owner

get_profiles() and get_users() called _model(). That passes the response to convert_to_model(), which turns {"data": [...], "next": ...} into a bare list and drops next. Triage paginates every collection: the default page is 50 and the max is 200, per https://tria.ge/docs/cloud-api/conventions/. As a result:

  • Callers silently got only the first page.
  • The offset argument was unusable, because it needs the next value of the previous page, which callers never saw.

The slib.hatching Storm service (gormaniac/stormsvcs#14) currently works around this by calling the private _request() itself.

Changes

  • Paged methods: get_profiles, get_users, and get_user_apikeys now follow next in pages of 200 and return every item.
    • limit caps the total; None or 0 returns all.
    • offset starts from an earlier page.
    • This reuses the _pages/_list/_iter helpers the sample lists already use.
  • New methods:
    • profiles_page and users_page return a single page as a new base.ListPage, with data plus next.
    • iter_profiles and iter_users stream items across pages, matching iter_samples/iter_search.
  • Errors: handled the same way as before. An ErrorResponse is returned, or raised with raise_on_api_err; the iter_* methods raise.
  • FakeTriage: now pages like the docs describe (default 50, max 200) and paginates API key lists too.
  • CHANGELOG: entries added under Unreleased.

Behavior change: calling get_profiles()/get_users() with no limit used to return the API's first page (50 items). It now returns everything. Code that relied on getting a single page can use profiles_page/users_page.

Testing

  • pytest tests: 45 passed, 4 skipped (the live tests; no HATCHING_TOKEN was available).
  • New tests cover:
    • 251 profiles across two max-size pages, plus limit.
    • Single pages and starting from an offset.
    • The iter_* methods.
    • 61 users and 210 API keys.
    • Auth errors, both returned and raised.
  • Not run against the live API.

Generated by Claude Code

These methods returned only the API's first page (50 items by default) and
dropped the `next` offset, so callers had no way to get the rest.

They now follow `next` in pages of up to 200 and return every item; `limit`
caps the total and `offset` starts from an earlier page. New `profiles_page`
and `users_page` methods return a single `base.ListPage` (items plus `next`),
and `iter_profiles` and `iter_users` stream items across pages.

FakeTriage now pages the way the docs describe (default 50, max 200), and
pages API key lists too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KBLBzm6b7WftoJvKs7VbJw
@gormaniac
gormaniac merged commit af25dde into main Nov 2, 2026
1 check passed
@gormaniac
gormaniac deleted the claude/funny-thompson-iyl38w branch November 2, 2026 01:18
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.

2 participants