LookupResources optional_limit pagination: strict maximum or advisory limit
0 reputation · 10 Feb 2023, 22:09 UTC
0 reputation · 10 Feb 2023, 22:09 UTC
When using LookupResources to paginate a large set of resources that grant a permission to a subject, the goal is to receive each page with a predictable maximum number of entries so that client‑side buffering and latency budgets can be fixed in advance.
The SpiceDB v1 API accepts an optional_limit field and returns an opaque after_result_cursor, but the documentation notes that the server may apply its own default or maximum page size, treating the request limit as advisory. It is unclear whether the limit is enforced as a strict upper bound, whether the server can return fewer items without signaling end‑of‑stream, and what guarantees exist for callers that need a hard cap on page size.
When calling LookupResources with an optional_limit, the SpiceDB v1 API does not enforce the requested number as a strict upper bound. The server may apply its own default or maximum page size, treating the client's limit as advisory.
\nafter_result_cursor, or by returning fewer items than requested.If the returned item count is strictly less than the requested optional_limit, the server likely reached the end of the available result set or applied a hard cap. If the count equals the limit and after_result_cursor is present, more pages probably exist.
No protocol-level guarantee exists that the server will never exceed or fall short of the requested limit. Clients requiring a deterministic page size must either query the server's maximum page-size configuration or enforce pagination bounds client-side.
\nNote: To determine whether your deployment enforces a hard cap, please confirm the SpiceDB server version and any configured maximum page-size settings, as behavior varies across releases.
\nafter_result_cursor field: null or empty indicates stream termination.optional_limit.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.