Skip to content

feat(tailnets): add pagination support to list command - #102

Merged
jaxxstorm merged 2 commits into
mainfrom
org_id
Aug 25, 2026
Merged

jaxxstorm merged 2 commits into
mainfrom
org_id

Conversation

@jaxxstorm

Copy link
Copy Markdown
Owner

Signed-off-by: Lee Briggs lee@leebriggs.co.uk

Signed-off-by: Lee Briggs <lee@leebriggs.co.uk>
Copilot AI lite review requested due to automatic review settings August 25, 2026 18:46

@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

out, err = json.MarshalIndent(listResp.Tailnets, "", " ")

P2 Badge Preserve the next-page cursor in text output

When --output is pretty or human and the organization has more than one page, this branch replaces the response with only listResp.Tailnets, discarding both the opaque cursor and totalCount. The user therefore cannot discover the value required for the next --cursor invocation without switching output formats, making pagination unusable in these supported modes; render or otherwise preserve the next-page cursor alongside the tailnet records.

ℹ️ 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".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Pretty/human output currently strips pagination metadata (cursor/totalCount), which makes the new pagination support incomplete for those output modes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds pagination support to the tscli list tailnets command, aligning the CLI, API contract snapshot, and coverage tooling so pagination request/response fields are exercised and tracked.

Changes:

  • Add --limit and --cursor flags to list tailnets and send them as query parameters.
  • Introduce OrganizationTailnetListResponse (with cursor/totalCount) and wire it into coverage tooling.
  • Update OpenAPI snapshot + generated docs and add an integration test asserting pagination query/response fields.
File summaries
File Description
tools/internal/coveragegaps/properties.go Registers the new response type for property coverage extraction.
test/cli/tailnet_lifecycle_integration_test.go Adds an integration test validating pagination query params and response fields.
pkg/contract/openapi/tailscale-v2-openapi.yaml Updates the OpenAPI snapshot to include pagination parameters and response fields.
pkg/contract/openapi/snapshot-metadata.yaml Updates snapshot fetch timestamp/hash metadata.
pkg/apitype/models.go Adds OrganizationTailnet + OrganizationTailnetListResponse models.
docs/commands/tscli_list_tailnets.md Documents new --limit/--cursor flags.
coverage/property-coverage.yaml Adds property coverage mapping for the tailnets list response.
coverage/coverage-gaps.md Updates coverage gaps report to reflect newly covered properties.
coverage/coverage-gaps.json Updates coverage gaps machine-readable output for the new properties.
cmd/tscli/list/tailnets/cli.go Implements pagination flags, validation, request query construction, and typed pretty/human decoding.
Review details

Suppressed comments (1)

cmd/tscli/list/tailnets/cli.go:66

  • For pretty/human output, the code drops pagination metadata (cursor, totalCount) by marshaling only listResp.Tailnets. That makes it hard/impossible to page while using those output formats. Consider including pagination fields in the pretty/human payload when they are present (e.g., append a final record containing cursor/totalCount).
				var listResp apitype.OrganizationTailnetListResponse
				if err := json.Unmarshal(raw, &listResp); err != nil {
					return fmt.Errorf("decode list tailnets response: %w", err)
				}
				out, err = json.MarshalIndent(listResp.Tailnets, "", "  ")
  • Files reviewed: 7/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/tscli/list/tailnets/cli.go
Signed-off-by: Lee Briggs <lee@leebriggs.co.uk>
@jaxxstorm
jaxxstorm merged commit 90c5bd4 into main Aug 25, 2026
1 check passed
@jaxxstorm
jaxxstorm deleted the org_id branch August 25, 2026 18:59
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