mirror of
https://github.com/rudrankriyam/App-Store-Connect-CLI.git
synced 2026-04-25 15:45:48 +03:00
[GH-ISSUE #426] Harden test infrastructure and split internal/asc package #121
Labels
No labels
bug
bug
documentation
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/App-Store-Connect-CLI#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rudrankriyam on GitHub (Feb 5, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/426
Context
The codebase has grown to 60+ command domains, ~607 production files, and 173 test files in 18 days. The architecture and patterns are solid, but three infrastructure gaps are emerging as the surface area grows.
1. Systematic pagination test coverage
Problem: Pagination paths are tested case-by-case in individual commands. The
PaginateAllengine ininternal/asc/client_pagination.gois central to many commands, but most commands that use it don't test the multi-page path — they only test single-page responses. When we hardened thepublishgroup resolver this week, we found the pagination path had zero test coverage.Scope:
asc.PaginateAll(there are at least 5-6: beta groups list, testflight sync, publish group resolver, beta testers, enabled versions, etc.)links.nextURL and verifies the second page is fetched and aggregatedPaginateAllitself that covers: single page, multi-page, API error on page N, repeated URL detection (ErrRepeatedPaginationURL), and type mismatch between pagespaginatedResponse(page1Data, page2Data)to reduce boilerplateFiles to start with:
internal/asc/client_pagination.go— the engineinternal/cli/testflight/beta_groups.go— usesPaginateAllinternal/cli/testflight/testflight_sync.go— usesPaginateAllinternal/cli/publish/group_resolver.go— usesPaginateAll(already tested as of this week)2. Split
internal/ascinto sub-packagesProblem:
internal/ascis the HTTP client, type definitions, pagination engine, upload orchestrator, and domain-specific request/response types all in one package. As the API surface keeps growing, this creates:client.go,client_types.go,client_options.go)Proposed structure:
Approach:
types/(the least coupled), thenpagination/, thenupload/ascpackage during migration so callers don't breakGuideline: Read
docs/GO_STANDARDS.mdbefore starting. Prefer moving types first since they have no behavior and the compiler will catch all breakages.3. Opt-in integration test harness against real API
Problem: All HTTP tests mock at the transport level (
roundTripFunc), which is good for speed and determinism but doesn't catch real API contract changes. Theinternal/updatepackage already has anASC_UPDATE_INTEGRATIONenv-gated test — we should generalize this pattern.Proposed design:
ASC_INTEGRATION_TEST=true(skip by default)6747745091) as the sandbox target since it exists and has beta groupsinternal/cli/cmdtest/or a newinternal/testutil/package:asc apps listreturns the expected appasc testflight beta-groups list --app 6747745091returns groupsasc builds list --app 6747745091returns buildsASC_KEY_ID,ASC_ISSUER_ID, andASC_PRIVATE_KEY_B64Files to reference:
internal/update/update_integration_test.go— existing patterninternal/cli/cmdtest/game_center_enabled_versions_test.go—setupAuth()androundTripFunchelpers to reusePriority order
Labels
testing,refactor,infrastructure