mirror of
https://github.com/rudrankriyam/App-Store-Connect-CLI.git
synced 2026-04-25 07:35:48 +03:00
[GH-ISSUE #518] Exit code parity: usage validation errors should return ExitUsage (2) consistently #142
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#142
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 14, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/518
Summary
A set of command-level validation failures return generic errors (
fmt.Errorf) rather than usage errors (flag.ErrHelp), which causes process exit code1instead of2.Why this matters
Automation relies on stable exit code contracts. Invalid invocation/flags should map to usage exit code (
2), not generic runtime error (1).Current behavior
cmd/exit_codes.gomaps usage errors only whenerrors.Is(err, flag.ErrHelp).Several commands return
fmt.Errorf(...)for mutual-exclusion and invalid-flag usage cases.Representative examples:
internal/cli/submit/submit.gointernal/cli/auth/auth.gointernal/cli/apps/app_info.gointernal/cli/performance/performance_download.gointernal/cli/xcodecloud/xcode_cloud.gointernal/cli/publish/publish.goReproduction
Example:
Current outcome: validation failure exits with code
1.Expected: exit code
2for usage error.Expected behavior
Invalid CLI usage (missing required flags, incompatible flag combinations, invalid flag value semantics) should return usage-class errors and exit
2consistently.Detailed implementation plan
flag.ErrHelp, orExitUsage.fmt.Errorffor usage-only failures.Acceptance criteria
2.cc @cursor please implement this end-to-end.
@rudrankriyam commented on GitHub (Feb 14, 2026):
@cursor please implement this issue end-to-end using the checklist and acceptance criteria.
@cursor[bot] commented on GitHub (Feb 14, 2026):
Implemented end-to-end on
cursor/exit-code-parity-c50aand pushed. I standardized usage-validation handling by addingshared.UsageError/UsageErrorf(internal/cli/shared/errors.go) and updating the requested command paths to print a clear stderr message and returnflag.ErrHelpfor invalid usage semantics. I applied this to the representative files from the PR:submit.go,auth.go,app_info.go,performance_download.go,xcode_cloud.go, andpublish.go(mutual-exclusion checks, invalid value semantics like limit/timeout/poll/platform/output constraints, etc.), while leaving runtime/API failure paths as normal non-usage errors.I also updated/expanded regression coverage (TDD style) across
internal/cli/submit/submit_test.go,internal/cli/auth/auth_test.go, and cmd-level suites ininternal/cli/cmdtest(including explicit exit-code parity assertions inexit_codes_test.go). Validation run results:submit,auth, and relevantcmdtestsuites).make format,make lint,make testall pass.go build -o /tmp/asc .) confirmed exit code2for representative invalid invocations:submit createconflicting--version/--version-idapp-info getconflicting--version/--version-idperformance downloadconflicting selectorsxcode-cloud runconflicting workflow flagspublish appstoreinvalid--timeoutI made and pushed 4 commits:
3954c79test: require usage-class validation errors9616241fix: map CLI validation failures to usage errors615e175test: stabilize auth usage parity exit-code case849464dtest: align cmdtest usage-validation expectationsI also added a walkthrough artifact with the black-box exit-code evidence at:
/opt/cursor/artifacts/exit_code_parity_blackbox.txt.@rudrankriyam commented on GitHub (Feb 14, 2026):
Fixed in #534 (merged to main).