Skip to content

PLAT-1314/feat: browse paginated responses interactively - #14

Open
brtkwr wants to merge 3 commits into
mainfrom
bkunwar/plat-1314-interactive-pagination
Open

brtkwr wants to merge 3 commits into
mainfrom
bkunwar/plat-1314-interactive-pagination

Conversation

@brtkwr

@brtkwr brtkwr commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Changes

  • Render one complete cursor page at a time and prompt next page? [Y/n] on stderr only for interactive table output.
  • Add --no-paginate for explicit single-page requests; preserve --all collection and reject conflicting flags.
  • Never prompt for JSON/YAML, redirected streams, request-body stdin, or dry runs.
  • Reuse pagination request construction and safety guards, preserve original cursor state, and stop on EOF or cancellation.
  • Follow nested cursor_page_metadata.next_page_cursor and extract billing statements as defined by the actual API schemas, retaining legacy root cursors.
  • Preserve page metadata and numeric precision through the existing renderer; add prompt, stream-policy and HTTP regressions.

Validation

On exact head 54f381b2579c931f6beffe8558054e75a0477159, CI run 40866576705 passed both jobs:

  • build: go build ./..., embedded-spec drift check, all tests and coverage gate passed. Total coverage 81.5% (80% gate).
  • lint: formatting, vet, ineffassign, spelling, complexity and golint passed.
  • No tests run locally. All five changed files were re-read and matched the exact remote head.
  • Regression coverage includes prompt answers/EOF, redirected streams, JSON/YAML, request-body stdin policy, dry runs, cursor loops/restoration, and cancellation after the input read blocks.
  • Automated review identified nested cursor metadata and billing statement envelopes; both are fixed and covered by the actual registered billing command in interactive and --all modes.

Scope

Refs PLAT-1314. This implements the ticket’s explicit interactive-pagination requirement for the existing cursor-supported endpoints. It does not add new pagination protocols or change embedded API specs. Independent of open retry/context/keychain/version/diagnostics/payload-validation scopes; shared pagination helper changes may require integration when those PRs merge.

✨ via Codex session

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-29T11:35:47.452371Z 54f381b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f6c1401dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

combined = append(combined, items...)
if visit == nil {
combined = append(combined, items...)
} else if more, err := visit(raw, next); err != nil || !more {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read nested cursor metadata before invoking the page visitor

For every operation currently detected as paginated, the API schema places next_page_cursor inside cursor_page_metadata rather than at the response root (for example, openapi/billing-account-api.yaml:1364-1369 and openapi/trade-account-v2-api.yaml:1788-1794). Because splitPage only reads a top-level next_page_cursor, the next passed here is always empty for real responses, so interactive table output renders the first page and exits without ever prompting. The new tests conceal this by constructing responses with the cursor at the root; extract the cursor from the actual metadata envelope before calling the visitor.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 54f381b. splitPage now reads cursor_page_metadata.next_page_cursor before invoking the visitor, retaining root-level cursor compatibility. Regressions use the actual registered billing command and schema-shaped responses in interactive and --all modes. CI passed on that exact head; no local tests were run.

✨ via Codex session

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abc7168af5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +132 to +135
if visit == nil {
combined = append(combined, items...)
} else if more, err := visit(raw, next); err != nil || !more {
return nil, err

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Decouple interactive paging from the items guard

For billing-statement get, the response array is named statements (openapi/billing-account-api.yaml:1364) rather than items, so splitPage returns an empty item slice even when the page contains statements. Once the nested cursor is read correctly and a user accepts the prompt, this new visitor path falls through to the shared len(items) == 0 guard and exits with an aborting --all error instead of fetching page two; interactive raw-page browsing should not apply that item-specific guard, or page extraction must support this response shape.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 54f381b. Page extraction now supports the billing statements envelope as well as items, so nonempty billing pages can advance without triggering the empty-page guard. Actual billing-statement get regressions cover interactive continuation and --all; the cursor-loop and empty-page safety guards remain. CI passed on that exact head.

✨ via Codex session

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.

1 participant