Repository navigation
feat(agents): follow pagination in agents list - #183
Draft
rwjblue-glean wants to merge 1 commit into
Draft
rwjblue-glean wants to merge 1 commit into
rwjblue-glean wants to merge 1 commit into
Conversation
POST /api/agents/search is gaining cursor pagination (askscio/scio#336824): it returns at most 100 agents per page, with has_more and next_cursor, and accepts a cursor. `glean agents list` calls the endpoint once, so on deployments with more than 100 visible agents it would silently print only the first page. agents list now requests pages until has_more is false, sending each page's next_cursor back with the original filters, and prints every agent as one response. A page that reports has_more without a next_cursor is an error rather than an endless loop. This depends on an api-client-go release regenerated from that spec. The pinned v0.17.3 (and the latest, v0.18.2) lack Cursor, PageSize, HasMore and NextCursor, so this does not compile until the dependency is bumped. The field names follow the generator's output for the other paginated Platform endpoints. The regenerated request also carries the spec's page_size default of 100, which shows up in --dry-run output. Co-authored-by: Robert Jackson <robert.jackson@glean.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF (stack): Page
POST /api/agents/searchwith opaque cursors so its responses stay bounded.BLUF (this PR): Make
glean agents listfollownext_cursorso it prints every agent.Once agent search pages its results, the endpoint returns at most 100 agents per call.
glean agents listcalls it once, so anyone who can see more than 100 agents would silently get only the first 100. It now keeps requesting pages whilehas_moreis true, sending back eachnext_cursorwith the same filters, and prints all agents as one response.Warning
Blocked; does not compile yet. This needs an api-client-go release regenerated from the spec in askscio/scio#336824. The pinned v0.17.3 and the latest release, v0.18.2, both lack
PlatformAgentsSearchRequest.Cursor/PageSizeandPlatformAgentsSearchResponse.HasMore/NextCursor, so the build fails untilgo.modis bumped. That bump belongs in this PR before it leaves draft.Details
page_size/cursor/has_more/next_cursorshapes on the other paginated Platform endpoints (for examplePlatformListAdminAgentsResponse). If the regenerated names differ, onlysearchAllAgentschanges.page_sizea default of 100, which the generated request serializes, soagents list --dry-runprints{"page_size": 100}instead of{}. The snapshot reflects that.has_more: trueand nonext_cursoris an error rather than an endless loop./rest/api/v1/agents/searchfallback is unchanged.Stack
Spans repositories, in rollout order.
agents listTicket: DEVPLAT-1737