fix(secrets): paginate ListSecrets to return all entries#2394
fix(secrets): paginate ListSecrets to return all entries#2394malinskibeniamin merged 4 commits intomasterfrom
Conversation
useListSecretsQuery sent a single request with pageSize=25 and dropped everything past the first page, silently hiding secrets (e.g. PGDB_DSN in accounts with >25 secrets). Loop nextPageToken via callUnaryMethod until exhausted and aggregate into a single result, at the server-side max of 50 per page. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a hard cap of 200 iterations and a same-token guard so a misbehaving server cannot trap the client in an infinite pagination loop. Also honor react-query's AbortSignal so in-flight pages cancel on unmount or refetch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @malinskibeniamin's task in 2m 12s —— View job PR Review
SummaryThis is a correct, well-scoped fix for a real user-facing bug. The pagination loop is sound, the safety guards are thoughtful, and the tests cover the meaningful edge cases. A few minor observations below.
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
queryFn throws intentionally on guard violations (non-advancing token, max-pages exceeded). React Query's default 3-retry policy would otherwise multiply the already-bounded runaway-pagination traffic by 4× before surfacing the failure. Addresses PR review feedback on #2394. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed review:
Skipped intentionally:
|
Summary
useListSecretsQueryissued a singleListSecretscall withpageSize=25and ignorednextPageToken, silently hiding every secret past the first page. Users with >25 secrets could not see entries likePGDB_DSNon the Secrets Store page (and anywhere else the hook is consumed: MCP servers, knowledge bases, AI agents, shadow links, pipeline command menu, Redpanda Connect onboarding).nextPageTokenviacallUnaryMethoduntil the server returns an empty token, aggregating all pages into a single{ secrets }result. Page size now 50, matching the server-side maximum declared inproto/redpanda/api/dataplane/v1/secret.proto.createConnectQueryKeybase key).Repro
console-*.byoc.../redpanda.api.console.v1alpha1.SecretService/ListSecretswith{"request":{"pageSize":25}}— response includes anextPageToken./secretsin the UI — any secret alphabetically past the first 25 is missing.After this fix the UI paginates server-side transparently and the table renders the full set (verified against a tenant with 119 secrets).
Test plan
bun vitest run src/components/pages/secrets-store— 17 / 17 pass, including a newfollows nextPageToken until all secrets are returnedtest that asserts the hook walkspage1 → page2 → stop.tsgo --noEmitclean on touched files.Follow-ups (not in this PR)
MAX_PAGE_SIZE = 25is still used as a "fetch all" value in other list hooks (topics, users, security, ai-agent, pipeline, service-accounts, shadowlinks, quotas, remote-mcp, transforms). Same silent-truncation bug applies; each needs the same pagination-loop treatment. Filing / fixing separately to keep this PR scoped.🤖 Generated with Claude Code