mirror of
https://github.com/rudrankriyam/App-Store-Connect-CLI.git
synced 2026-04-26 08:05:52 +03:00
[GH-ISSUE #487] Builds Latest: add --next to return collision-safe next build number #139
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#139
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 10, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/487
Summary
Add
--nexttoasc builds latestso CI can request a safe next build number (latest + 1) that accounts for both processed builds and in-flight uploads.Why this matters
Parallel pipelines can race when only processed builds are considered.
If an upload is in progress but not yet reflected in processed builds, the next job can reuse the same build number and fail.
Current state (verified)
internal/cli/builds/builds_latest.gocomputes latest from builds endpoints only.GetBuildUploadsininternal/asc/client_builds.gobut is not included in latest-number logic.Proposed UX
Behavior:
--next: existing output remains unchanged--next: return a structured payload including:latestProcessedBuildNumberlatestUploadBuildNumberlatestObservedBuildNumbernextBuildNumbersourcesConsideredOptional support:
--initial-build-number(default1) when no prior builds/uploads existSelection algorithm
app,version,platform)AWAITING_UPLOAD,PROCESSING,COMPLETE)If non-numeric build numbers are encountered, return an explicit, actionable error.
Detailed implementation plan
--next(and optional--initial-build-number) flags tointernal/cli/builds/builds_latest.go.internal/asc/output_builds.go(or equivalent output file).builds latestresponse contract unchanged when--nextis absent.internal/cli/builds/builds_latest_test.gofor flag validationinternal/cli/cmdtest/builds_latest_output_test.gofor race-condition scenariosAcceptance criteria
asc builds latest --nextreturns next build number based on processed + in-flight uploads.asc builds latestremains backward-compatible.make testpasses with expanded build-number coverage.@rudrankriyam commented on GitHub (Feb 11, 2026):
@cursor Please implement this issue end-to-end.
What to build
Add
--nexttoasc builds latestso CI can get a collision-safe next build number derived from both processed builds and in-flight uploads.Implementation plan
internal/cli/builds/builds_latest.go--next.--initial-build-numberfallback when no prior numbers exist.--nextis not set.GetBuildUploadswith relevant filters/states--app,--version,--platformsemantics.latestProcessedBuildNumberlatestUploadBuildNumberlatestObservedBuildNumbernextBuildNumbersourcesConsideredNew tests to write
A) CLI unit tests (
internal/cli/builds/builds_latest_test.go)--nextand fallback behaviorB) Cmdtests (
internal/cli/cmdtest/builds_latest_output_test.go)--initial-build-numberC) ASC query tests (if needed)
How to test locally
Run exactly:
make formatmake lintmake testTargeted tests:
go test ./internal/cli/builds -run 'Latest.*Next|BuildNumber'go test ./internal/cli/cmdtest -run 'BuildsLatest'Done criteria
asc builds latest --nextreturns collision-safe next number.asc builds latestbehavior remains unchanged by default.format,lint,test).@cursor[bot] commented on GitHub (Feb 11, 2026):
Summary:
--next/--initial-build-numberhandling inasc builds latest, including build upload checks, numeric validation, and a new structured next-build payload + table/markdown rows, plus tests that cover processed-only, uploads-only, and no-history scenarios.Tests & verification:
go test ./internal/cli/builds -run 'Latest.*Next|BuildNumber'go test ./internal/cli/cmdtest -run 'BuildsLatest'go build -o /tmp/asc .and/tmp/asc builds latest --app "app-1" --next --initial-build-number 0(exit code 2, expected validation error)PATH="$PATH:/home/ubuntu/go/bin" make formatPATH="$PATH:/home/ubuntu/go/bin" make lint(after reinstalling golangci-lint with Go 1.26)PATH="$PATH:/home/ubuntu/go/bin" make testmake formatinitially failed due to missing gofumpt, fixed viamake tools, and lint required reinstalling golangci-lint usingGOTOOLCHAIN=go1.26.0.Artifact:
builds_latest_next_cmdtest/recording_demo.mp4@rudrankriyam commented on GitHub (Feb 11, 2026):
Resolved by PR #489 (https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/489), which is merged into main.