fix: reject a negative --limit or --page-size, and correct the docs - #107
Merged
Conversation
leet-c1
force-pushed
the
docs/page-size-precision
branch
from
August 31, 2026 19:54
9faedbc to
30be8c1
Compare
leet-c1
force-pushed
the
docs/page-size-precision
branch
from
August 31, 2026 20:37
30be8c1 to
53e4bb6
Compare
leet-c1
force-pushed
the
docs/page-size-precision
branch
from
August 31, 2026 21:07
53e4bb6 to
c3db14c
Compare
A negative `--limit` or `--page-size` is now a usage error (exit 2), rejected before any request. BREAKING for anyone passing a negative. `--limit` is never sent to the API -- no list command puts it on the wire -- so nothing but c1i could validate it, and `--limit -1` silently behaved exactly like the documented `--limit 0`: every row, exit 0. A negative `--page-size` did reach the server, costing a round trip to be refused by its range check. Both are rejected in rootCmd's PersistentPreRunE alongside the existing UTF-8 flag check, so every list command is covered without a per-command check. The message names what `0` does, which is what the caller wanted. A raw `api --query page_size=-1` still goes to the server, since `--query` is raw caller input rather than this flag. The docs needed correcting anyway. The README presented one tenant's measured row counts as general rules, and cmd/agents.md did not mention `--page-size` at all. Three behaviors were wrong or undocumented: - The ~5-row floor is not universal: `policies list` floors at 6 and `mcp servers catalog list` has no floor. Sizes 1-5 were measured on `apps list`, `users list` and `policies list`; previously only size 1 had been. - A value over the max is not rejected. pageSizeFlag clamps it and sends the max, so an oversized batch silently shrinks. - `--page-size 0` means the server's default of 25, and those rows may then overshoot like any other size. How far a page overshoots varies per endpoint and per size -- `apps list` returned 23 rows at `--page-size 10` and 42 at 25, `policies list` returned 12, `users list` exactly 10 -- so the docs no longer state any figure as a limit. `--limit` is unaffected: it is enforced client-side per row, so it holds even when a page overshoots. Guard 6 pins the agents.md section: each claim by phrasings that carry its polarity, so an inverted or removed claim fails the build, plus a rejection of any row count in it outside a short allowlist. Guard 7 pins the new behavior. Also stopped implying `apps get`'s empty appOwners will fill if you wait; the same guidance in `apps set-owners --help` is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
leet-c1
force-pushed
the
docs/page-size-precision
branch
from
August 31, 2026 21:37
c3db14c to
28da9db
Compare
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.
Description
BREAKING — a negative
--limitor--page-sizeis now a usage error (exit 2), rejected before any request.--limitis never sent to the API; no list command puts it on the wire. So nothing but c1i could validate it, and--limit -1silently behaved exactly like the documented--limit 0: every row, exit 0. A negative--page-sizedid reach the server, costing a round trip to be refused by its range check.Both are now rejected in
rootCmd'sPersistentPreRunE, alongside the existing UTF-8 flag check, so every command is covered without a per-command check. The message names what0does, since that is what the caller wanted.0and positive values are unaffected, and a rawapi --query page_size=-1still goes to the server —--queryis raw caller input, not this flag.The docs needed correcting anyway
The README presented one tenant's measured row counts as general rules, and
cmd/agents.md— the doc an agent reads before choosing a batch size — did not mention--page-sizeat all.policies listfloors at 6;mcp servers catalog listhas no floor. Sizes 1–5 were measured onapps list,users listandpolicies list— previously only size 1 had been.pageSizeFlagclamps it and sends the max, so an oversized batch silently shrinks.--page-size 0is not "no paging"How far a page overshoots varies per endpoint and per size —
apps listreturned 23 rows at--page-size 10and 42 at 25,policies listreturned 12,users listexactly 10 — so the docs no longer state any figure as a limit.--limitremains the exact control: enforced client-side per row, so it holds even when a page overshoots.Guards
Guard 6 pins the
agents.mdsection. Each claim is pinned by phrasings that carry its polarity, so stating the opposite fails the build where a topic word would not —"clamp"is equally present in "does not clamp". It also rejects any row count in that section outside a short allowlist, so a fresh measurement cannot be restated as a limit, and a claim count catches an entry being removed.Guard 7 pins the new behavior, including through the real command tree — the helper-only tests all passed with the
PersistentPreRunEcall deleted and the feature inert.Both were verified to fail when their fix is reverted. README's copy of the contract remains unguarded; that is noted in the test file.
Also
c1i docs agentsno longer impliesapps get's emptyappOwnerswill fill if you wait — usec1i apps owners <app-id>. The same guidance inapps set-owners --helpis unchanged.cmd/policies_search.gono longer calls the 5-row floor and0-means-25 "endpoint-specific"; both hold generally, and only that endpoint's lower default is its own.Release Notes
BREAKING: a negative
--limitor--page-sizenow exits 2 instead of being accepted.--limit -1previously behaved as unlimited.Corrected the
--page-sizedocumentation: the ~5-row floor is not universal, a value over the max is clamped by c1i rather than rejected, and--page-size 0uses the server's default of 25. How far a page overshoots varies per endpoint and per size, so no figure in the docs should be read as a limit —--limit Nremains the exact control.c1i docs agentsnow covers this.