Skip to content

[codex] Follow up pagination fixes on top of #2#3

Merged
backslash-f merged 3 commits into
mainfrom
codex/pr2-review-fixes
Jun 14, 2026
Merged

[codex] Follow up pagination fixes on top of #2#3
backslash-f merged 3 commits into
mainfrom
codex/pr2-review-fixes

Conversation

@backslash-f

Copy link
Copy Markdown
Contributor

Context

This branch is based on the current head of #2 (fix: add pagination support for App Store Connect API list endpoints).

That means this PR includes:

Why a follow-up PR

The original PR fixes a real correctness bug by following paginated links.next responses from App Store Connect.

A later revision also restored a limit for list_build_runs, which was the right direction, but it introduced two remaining issues:

  • resolveBuildLocator used a small fixed cap for all lookup modes, which could fail to find older build numbers or the latest failing build if they were outside the newest window
  • listAll() still trusted arbitrary links.next URLs and would send the App Store Connect bearer token to them

What changed in this PR

Builds listing remains bounded

list_build_runs still supports an optional limit and defaults to a bounded recent listing.

Build locator lookups are now selective instead of bluntly capped

Instead of using the same small fixed limit for every lookup path:

  • latest fetches only the most recent build run
  • buildNumber paginates until the requested build number is found
  • latestFailing paginates until a failing run is found

These targeted lookups keep the public listing tool bounded without breaking older-history resolution.

Pagination links are origin-checked

Before following links.next, the client now verifies that the next URL stays on the App Store Connect origin. This prevents forwarding the bearer token to an unexpected host.

Tool/behavior impact

This keeps the intended behavior split clear:

  • user-facing list tools stay predictable in latency and response size
  • locator-style resolution paths remain correct across paginated history
  • pagination does not widen token exposure to off-origin URLs

Validation

  • npm test
  • npm run build

EdouardF and others added 3 commits May 17, 2026 10:31
All list methods (ProductsClient.list, WorkflowsClient.listForProduct,
BuildsClient.listForWorkflow) previously returned only the first page
of results, silently discarding subsequent pages. With 100+ builds
in a workflow, this meant buildSelector=latest returned stale data.

Changes:
- Add BaseAPIClient.listAll() method that follows links.next URLs
  to collect all pages of paginated responses
- Update BuildsClient.listForWorkflow to use listAll with limit=200
- Update ProductsClient.list to use listAll with limit=200
- Update WorkflowsClient.listForProduct to use listAll with limit=200
- Remove unused limit parameter from client list methods (MCP tools
  now paginate automatically)
- Update build-locator.ts to remove hardcoded limit=100
- Add pagination tests for listAll (single page, multi-page, empty)
- All 25 tests pass

Fixes the issue where buildSelector=latest would return build #186
instead of the actual latest build #228+.
Addresses Codex review comment on PR #2: without a limit parameter,
list_build_runs fetches all paginated build runs for a workflow,
which can be slow and exceed response-size limits for workflows
with hundreds of runs.

Changes:
- Add maxItems parameter to BaseAPIClient.listAll() to stop
  pagination early once enough items are collected
- Restore limit parameter to BuildsClient.listForWorkflow()
- Add limit parameter to list_build_runs MCP tool (default: 20, max: 500)
- Use limit=50 in build-locator for latest/latestFailing lookups
- Add 2 new pagination tests for maxItems behavior
- All 27 tests pass
@backslash-f backslash-f marked this pull request as ready for review June 14, 2026 19:19
@backslash-f backslash-f merged commit 4c16428 into main Jun 14, 2026
1 check passed
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