You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NextCursorPage auto-pagination stops on empty pages with a next cursor #890
NextCursorPage can carry an explicit server-provided next cursor, but both GetNextPage() and the auto-pager currently stop as soon as the current page has an empty data array.
That means an empty first or intermediate page silently terminates iteration even when has_more is true and next points to a later page containing results.
This is observable through public endpoints using NextCursorPage, including Admin.Organization.Groups.ListAutoPaging.
Reproduction
Using a custom HTTP client, return these pages from Admin.Organization.Groups.ListAutoPaging:
GET /organization/groups
{"data":[],"has_more":true,"next":"cursor-1"}
GET /organization/groups?after=cursor-1
{"data":[{"id":"group-1","created_at":1,"group_type":"group","is_scim_managed":false,"name":"one"}],"has_more":false,"next":null}
On current main, auto-pagination yields no groups and makes only the first request.
Current result is only group-1; page 3 is never requested.
Root cause
NextCursorPage.GetNextPage() returns early on len(r.Data) == 0 before consulting HasMore or Next, and NextCursorPageAutoPager.Next() has the same empty-data termination check.
For explicit-next pagination, the continuation token is the pagination authority. An empty result page does not necessarily mean there is no next page.
Expected behavior
NextCursorPage auto-pagination should follow a non-empty next cursor through empty first or intermediate pages. It should still stop normally when has_more is explicitly false or when no next cursor is provided.
Ordinary populated-page behavior should remain unchanged.
Activity