You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(apps): emit typed error envelopes across the apps domain
Apps command errors previously surfaced as legacy output.Err* envelopes or
untyped helper errors, so agent and script callers had to recover validation,
API, subprocess, credential, and file failures from prose. Every error
producer in the apps domain now emits typed errs.* errors with stable
type/subtype/param/hint/code/log_id/retryable metadata:
- Flag and input validation carries validation/invalid_argument with param;
state preconditions (missing git/npx binary, login mismatch, foreign git
helper) carry validation/failed_precondition with recovery hints.
- A new internal/external_tool subtype classifies runtime failures of tools
the CLI shells out to (git clone/push, npx scaffold, git config): the tool
output is carried in the message so agents act on it instead of retrying
with different flags.
- Standard apps API calls use runtime.CallAPITyped; the multipart HTML
publish and the git-credential issue endpoint classify responses through
the shared classifier, so generic codes (missing scope) and HTTP 5xx keep
their canonical category/subtype/retryable classification.
- Local credential/state storage failures classify as internal/storage;
malformed subprocess and API payloads as internal/invalid_response;
defense-in-depth invariant guards report internal errors instead of
blaming user input.
- +db-execute statement failures report via the partial-failure contract:
per-statement results stay machine-readable on stdout (ok:false) with a
non-zero exit, in both json and pretty formats.
- shortcuts/apps/ (including gitcred/) is locked into the golangci and
errscontract migrated-path guards; the full tree is lint-clean.
Validation: gofmt, go vet, go build, go test ./shortcuts/apps/... ./errs and
the lint module, errscontract repo-wide clean, golangci-lint clean both
diff-scoped and full-tree, make unit-test.
returnoutput.ErrValidation("--require-login is not allowed when --scope=specific")
101
+
returnappsValidationParamError("--require-login", "--require-login is not allowed when --scope=specific")
103
102
}
104
103
case"public":
105
104
iftargets!="" {
106
-
returnoutput.ErrValidation("--targets is not allowed when --scope=public")
105
+
returnappsValidationParamError("--targets", "--targets is not allowed when --scope=public")
107
106
}
108
107
ifapplyEnabled {
109
-
returnoutput.ErrValidation("--apply-enabled is not allowed when --scope=public")
108
+
returnappsValidationParamError("--apply-enabled", "--apply-enabled is not allowed when --scope=public")
110
109
}
111
110
ifapprover!="" {
112
-
returnoutput.ErrValidation("--approver is not allowed when --scope=public")
111
+
returnappsValidationParamError("--approver", "--approver is not allowed when --scope=public")
113
112
}
114
113
if!rctx.Cmd.Flags().Changed("require-login") {
115
-
returnoutput.ErrValidation("--require-login is required when --scope=public (pass true or false explicitly; do not rely on the default)")
114
+
returnappsValidationParamError("--require-login", "--require-login is required when --scope=public (pass true or false explicitly; do not rely on the default)")
0 commit comments