fix: add pagination support for App Store Connect API list endpoints#2
Open
EdouardF wants to merge 1 commit into
Open
fix: add pagination support for App Store Connect API list endpoints#2EdouardF wants to merge 1 commit into
EdouardF wants to merge 1 commit into
Conversation
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+.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
All list methods (
ProductsClient.list,WorkflowsClient.listForProduct,BuildsClient.listForWorkflow) returned only the first page of results, silently discarding subsequent pages.When a workflow has more builds than the default page limit (typically 100),
buildSelector=latestwould return stale data — e.g., returning build #186 instead of the actual latest build #228+.The Apple App Store Connect API paginates responses using
links.nextURLs in the response envelope, but these were never followed.Root Cause
BaseAPIClient.get()returnsAPIResponse<TData>which includeslinks.next, but all callers just extractedresponse.dataand returned it, ignoring pagination entirely.Changes
BaseAPIClient.listAll()— New protected method that followslinks.nextURLs to collect all pages of paginated responsesBuildsClient.listForWorkflow()— Now useslistAll()withlimit=200, removed unusedlimitparameterProductsClient.list()— Now useslistAll()withlimit=200, removed unusedlimitparameterWorkflowsClient.listForProduct()— Now useslistAll()withlimit=200, removed unusedlimitparameterbuild-locator.ts— Removed hardcodedlimit=100sincelistForWorkflownow fetches all pagesdiscovery.ts— Simplified tool schemas (removed manuallimitparams since pagination is automatic)build-runs.ts— Updated to match new client signaturestests/pagination.test.ts— New test suite covering single page, multi-page, empty, and two-page scenariosTesting
All 25 tests pass, including 4 new pagination-specific tests:
Breaking Changes
BuildsClient.listForWorkflow(workflowId, limit?)→listForWorkflow(workflowId)(removedlimitparameter)ProductsClient.list(limit?)→list()(removedlimitparameter)WorkflowsClient.listForProduct(productId, limit?)→listForProduct(productId)(removedlimitparameter)These were internal API changes only — the MCP tool interface remains compatible.