List commands: add --paginate and surface total-count so scripts can detect truncation #111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task
Make
listcommands report completeness instead of silently truncating. Two parts:--paginateto the purpose-builtlistcommands (pr list,issue list,repo list,release list), reusing theClient::get_all/Link: rel=nextmachinery that already backsfj api --paginateand theopts.limit > 50branch insrc/api/pull_core.rs.--jsonmode, surface the total so a consumer can compare returned vs. available. Thread the already-parsedPage::total(X-Total-Count) through; emit an envelope ({ "total_count": N, "items": [...] }) or at minimum expose the count. For human output, print a dim footer when truncated (returned == limit < total):Showing 30 of 104. Use --limit or --paginate for more.Source:
rasterstate/fj#107.Priority
p1. The single most dangerous automation failure mode: a truncated result set is indistinguishable from a complete one, so an agent calling
fj issue list --jsonto "get all open issues" silently acts on a partial slice. Directly undercuts the JSON-for-scripts-and-agents core pitch, so it tops the scripting-reliability axis of the north-star.Reason
Page<T>already parsestotal,next,prev,last,first, but every field is#[allow(dead_code)](src/client/pagination.rs); handlers consume onlypage.items. Defaults compound it (all four lists default to 30) and the only paging escape hatch (--paginate) exists solely onfj api, not on any list command.ghmirrorsapi --paginatewith list-level paging plusX-Total-Count. A team scripting triage onfjtoday cannot tell a complete set from a capped one.Acceptance
fj <pr|issue|repo|release> list --paginatefollowsLink: rel=nextand returns the full set.fj issue list --json(and siblings) exposes the server total (envelope or count field) so returned-vs-total is comparable.returned == limit < total.#[allow(dead_code)]on the consumedPage<T>metadata fields is removed (no longer dead).--helpdocuments the default--limitand that results may be capped.src/client/integration_tests.rsfor a multi-page list and the total surfaced in JSON.cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo test --allpass.Dependencies
None. The
get_all/ Link-parsing machinery already exists; this is wiring it into the list handlers and threading existing parsed metadata.Size
M