Skip to content

fix: expose API pagination metadata on stderr - #478

Merged
petebacondarwin merged 1 commit into
mainfrom
codex/posture-4777-pagination
Nov 3, 2026
Merged

petebacondarwin merged 1 commit into
mainfrom
codex/posture-4777-pagination

Conversation

@petebacondarwin

Copy link
Copy Markdown
Collaborator

List commands discard result_info, leaving users without the cursor needed to request the next page. Preserve metadata through object responses and passthrough requests, then print a plain result_info: {...} line on stderr while keeping stdout payloads unchanged. --quiet suppresses the notice.

Add cursor reuse regression coverage for CASB findings, finding instances, policies, KV keys, and R2 buckets, plus coverage for offset counts and redirected output. Include a patch changeset and document manual pagination.

Validation

  • pnpm check passed, including generation, builds, workspace type checks, lint, and formatting.
  • Focused CLI tests passed: 112 tests across pagination, output, API client, auth, R2, KV, and zones.

@petebacondarwin
petebacondarwin requested a review from a team as a code owner November 2, 2026 13:03
@ask-bonk

ask-bonk Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@478

commit: bd0b08b

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 286.8 ms 4.8 ms 278.8 ms 299.4 ms
base 281.7 ms 3.7 ms 276.2 ms 290.4 ms

Δ (PR vs base): ↑ +5.2 ms (+1.8%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — I found no issues. The pagination metadata goes to stderr, stdout payloads are unchanged, --quiet suppresses the line, and tests and a changeset are included.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Low risk. The patch changeset fits a fix and follows the changeset rules. There is no version bump and no change to the release job.


🔒 Security: ✅ LGTM

No security concerns. Only result_info returned by the API is written to stderr.


📖 AGENTS.md: ✅ LGTM

Follows the repository conventions: notices go to stderr, payloads go to stdout, and a changeset is included for a user-facing fix.


📋 Code Quality: ✅ LGTM

Metadata is kept in a side WeakMap, and formatOutput writes it to stderr without changing what goes to stdout. The tests cover the main paths.


⚡ Performance: ✅ LGTM

The WeakMap lookup and one JSON.stringify of small metadata cost almost nothing.


📝 Documentation: ✅ LGTM

docs/architecture.md correctly describes the new stderr line and how to paginate by hand.


Reviewed commit: bd0b08b0

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Although I don't particularly like how it's presented to the user, it doesn't feel very user friendly, personally I would prefer if it could be either opt-in or, for interactive sessions, presented, if possible, not as a plain json printed in the terminal but as a not user-friendly section with information.

@petebacondarwin

Copy link
Copy Markdown
Collaborator Author

Looks good to me

Although I don't particularly like how it's presented to the user, it doesn't feel very user friendly, personally I would prefer if it could be either opt-in or, for interactive sessions, presented, if possible, not as a plain json printed in the terminal but as a not user-friendly section with information.

Right now we are JSON first for cf. We have made little to no effort to accommodate pretty-printing. The expectation is that most cf instances are programmatic (e.g. driven by Agents).

@petebacondarwin
petebacondarwin added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit f3ebc1e Nov 3, 2026
12 checks passed
@petebacondarwin
petebacondarwin deleted the codex/posture-4777-pagination branch November 3, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants