fix(cli): classify usage errors in top failure-parameter blind spots - #2119
fix(cli): classify usage errors in top failure-parameter blind spots#2119rudrankriyam wants to merge 6 commits into
Conversation
asc web privacy pull rejected a missing --app with an unclassified usage error, so telemetry recorded no failure parameter or diagnostic code for one of the CLI's most frequent usage failures. Attach the structured required-input diagnostic naming --app while preserving the rendered stderr message, the flag.ErrHelp usage contract, and the usage exit code.
asc versions links rejected out-of-range --limit, non-App-Store-Connect --next, unknown --type, and pagination flags on to-one relationships without any structured classification, so telemetry could not attribute those failures to a flag. Attach invalid-input and conflicting-input diagnostics naming the exact flag while preserving each rendered message, the flag.ErrHelp usage contract where it already applied, and every exit code.
asc pricing schedule create rejected an empty or conflicting price selection, a non-numeric --price, an unmappable --base-territory, and a malformed --start-date without any structured classification, so those failures reached telemetry with no parameter or diagnostic code. ValidatePriceSelectionFlags now carries the diagnostic for the rule it enforced, and the shared pricing set builder forwards it onto the flag.ErrHelp usage contract rather than re-deriving the failing rule. Register --tier in the failure-parameter allowlist. Rendered messages, usage semantics, and exit codes are unchanged.
asc web apps create rejected missing --name, --bundle-id, or --sku in a non-interactive terminal, and a missing --apple-id with no cached web session, without any structured classification, so telemetry recorded no failure parameter for either. Attach required-input diagnostics, naming the flag when exactly one is absent and leaving multi-flag requirements unattributed rather than guessing. Register --apple-id and --sku in the failure-parameter allowlist. Rendered messages, usage semantics, and exit codes are unchanged.
asc web review show rejected a missing --app, a malformed --pattern glob, and an unknown --submission without any structured classification, so telemetry could not attribute those failures to a flag. Attach required-input, invalid-input, and resource-not-found diagnostics naming the exact flag. Register --pattern in the failure-parameter allowlist. Rendered messages, usage semantics, and exit codes are unchanged.
asc review submit already classifies every one of its input failures, so it needs no production change. Pin that contract with a characterization test covering missing --app, --build, version selector, --confirm, the mutually exclusive version selectors, and an unsupported --platform, so a future edit cannot silently drop a failure parameter. Verified the test has teeth by temporarily dropping the --confirm parameter and watching the case fail.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
Limit details: You’ve used the included review currently available. Your 71 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughThe change adds structured diagnostic metadata to CLI validation errors across pricing, reviews, versions, and web commands. It preserves usage behavior and expands tests for error text, stderr output, diagnostic codes, parameters, and telemetry allowlist coverage. ChangesShared validation diagnostics
Versions relationship validation
Web command diagnostics
Telemetry parameter allowlist
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This PR adds diagnostic classification to existing CLI usage errors while preserving messages and exit codes; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Usage-based review receipt
Note This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. Track spend and usage in your billing settings. Comment |
Summary
Telemetry shows these commands emit unclassified usage errors at the highest rates: they name the offending flag on stderr, but return a bare
fmt.Errorforflag.ErrHelp, sofailure_parameteranddiagnostic_codearrive empty and aggregate data cannot see which flag trips callers.This sweeps the structured-diagnostics convention (
shared.WithDiagnostic/ classified usage errors, established in #2032-#2043) into the top offenders. Every change is additive metadata only.No user-visible change. Rendered stderr text,
flag.ErrHelpusage semantics, and exit codes are identical. Each command's current stderr and exit contract is pinned in a test before the classification assertion, so a message or exit-code drift fails the build.Per-command status
asc web privacy pull--appnow carriesrequired_input_missing/--appasc versions links--limit, non-ASC--next, unknown--type, and pagination flags on to-one relationships now carryinvalid_input/conflicting_inputwith the exact flagasc pricing schedule create--price, unmappable--base-territory, malformed--start-dateasc web apps create--name/--bundle-id/--skuin a non-interactive terminal, and missing--apple-idwith no cached sessionasc web review show--app, malformed--pattern, unknown--submissionasc review submitNotes on approach
ValidatePriceSelectionFlagsnow attaches the diagnostic for the rule it actually enforced (negative--tiervs. nothing-selected vs. mutually-exclusive), and the shared pricing set builder forwards it ontoflag.ErrHelpinstead of re-deriving which rule fired. Its other callers discard the returned error's structure, so their behavior and telemetry are unchanged.web apps createnames the flag only when exactly one is missing rather than guessing among several.failure_parameterallowlist —apple-id,pattern,sku,tier— each registered ininternal/telemetry/event.goand covered by the existingTestBuildEventWithContextAllowsKnownFailureParameterslist, per that contract's own convention.Covered elsewhere
asc xcode-cloud *andasc web review subscriptions listare also high-volume unclassified emitters but are owned by other in-flight work, so they are deliberately untouched here.Testing
make build,make format,make check-docs,make lint(0 issues),ASC_BYPASS_KEYCHAIN=1 make test— all green, no pre-existing failures observed.--limitfailure) match pre-change behavior exactly.Summary by CodeRabbit