Skip to content

Fix/pagination#275

Merged
codingcyclist merged 11 commits into
developfrom
fix/pagination
May 13, 2026
Merged

Fix/pagination#275
codingcyclist merged 11 commits into
developfrom
fix/pagination

Conversation

@codingcyclist
Copy link
Copy Markdown
Contributor

Current behavior: CLI and MCP only fetch the first list of resources when listing apps, runs, secrets, etc. Which makes some apps undiscoverable through the CLI/MCP
Desired behavior: Paginate through and return all resources for all list commands on the CLI and MCP

codingcyclist and others added 4 commits May 13, 2026 11:44
All list commands (apps, teams, secrets, catalogs, environments,
schedules) only fetched the first page from the API, silently
truncating results. Added a PaginatedResponse trait and generic
fetch_all_pages helper that iterates through all pages. Both CLI
and MCP tools benefit since they share the same api.rs layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Mock server now respects page/page_size query params on all list endpoints
- Added paginate() helper and mock_max_page_size override for testing
- Added /test/seed-apps and /test/reset endpoints for test data setup
- Added cli_pagination.feature with scenarios verifying multi-page fetching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The mock server re-adds predeployed-test-app on reset, so JSON mode
returns 26 (25 seeded + 1 pre-existing). Changed assertion to "at least 25".
Also pinned mock server to Python <3.14 (pyo3 compat).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codingcyclist codingcyclist requested a review from socksy May 13, 2026 10:15
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d74ef0a7-651b-4b0a-b7d5-04b8d764b06f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pagination

Comment @coderabbitai help to get the list of available commands and usage tips.

codingcyclist and others added 7 commits May 13, 2026 12:20
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…erflow

Instead of capping page_size server-side (shared mutable state across
parallel workers), seed 105 apps so pagination naturally exceeds the
CLI's page_size=100, producing 2 pages without any global state changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Include truncated response content in error messages to help debug
CI-only deserialization failures. Remove unused debug step from tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This will reveal the exact field/type mismatch causing CI pagination
test failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tag cli_pagination.feature with @serial and split the test runner into
two phases: parallel features first (excluding @serial), then serial
features without --jobs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The real Tower API does not include run_results in list app responses.
Including it in the mock caused deserialization failures on CI where a
cached wheel expected a newer RunResults schema with a 'starting' field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codingcyclist codingcyclist merged commit d44c67c into develop May 13, 2026
30 checks passed
@codingcyclist codingcyclist deleted the fix/pagination branch May 13, 2026 15:42
bradhe added a commit that referenced this pull request May 14, 2026
* fix: align pagination with API semantics and make it configurable

The CLI pagination loop added in #275 was 0-indexed but the API treats
page=0 (or null) as 'return everything in one response' and uses
1-indexed pages otherwise. The loop happened to work against real prod
only because the first request asked for 'all' and immediately exited
the loop. The mock server was 0-indexed and so diverged from the real
API's semantics.

Changes:

- Add four hidden global flags for paginated list commands:
  --page-size, --page, --no-paginate, --max-items. Modeled on the AWS
  CLI's pagination knobs but matched to our page-number API
  (--starting-token would be cursor-shaped, which our API does not use).
- Thread page_size / paginate / page / max_items through Config.
- Fix fetch_all_pages: page=0 means 'all in one response and stop';
  page>=1 iterates 1..=num_pages.
- Align the mock /v1/apps/etc. pagination to the same semantics so the
  mock and prod behave the same way.
- Rewrite cli_pagination.feature to create apps via the real CLI and
  delete them in after_scenario. With --page 1 --page-size 2 against
  three apps, the test forces a real two-page traversal against any
  backend.
- Drop the mock-only /test/seed-apps and /test/reset endpoints that the
  old pagination feature relied on.

* chore: Reformat the things

* chore: Clean up old, broken rust that comes with Homebrew

* chore: Go the other way with it--clobber the Homebrew rustup

* chore: One more attempt to fix this broken rust toolchain in macos15 images

* chore: Another attempt at resolving the issue with the upstream

---------

Co-authored-by: Brad Heller <brad@tower.dev>
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