fix: add standardized error codes (USE-001) to four safe-output handlers#22620
fix: add standardized error codes (USE-001) to four safe-output handlers#22620
Conversation
…ate_issue, push_signed_commits, qmd_index handlers Prefix all throw/setFailed error messages with the appropriate standardized error codes per the Safe Outputs specification (E001-E010): - create_issue.cjs: close-older-key validation → E001 (INVALID_SCHEMA) - create_discussion.cjs: close-older-key validation → E001 (INVALID_SCHEMA) - push_signed_commits.cjs: OID resolution and GraphQL mutation failures → E007 (API_ERROR) - qmd_index.cjs: missing env var / missing SDK / invalid repo slug → E001 (INVALID_SCHEMA), insufficient results count → E002 (LIMIT_EXCEEDED) Verified with: bash scripts/check-safe-outputs-conformance.sh All four handlers now pass USE-001 without errors. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ba18c7e8-4980-43c7-9f07-198bb0825def
There was a problem hiding this comment.
Pull request overview
Adds standardized Safe Outputs error-code prefixes to previously non-conformant handlers/scripts to satisfy the USE-001 conformance check.
Changes:
- Prefix
close-older-keyvalidation errors withE001increate_issueandcreate_discussion. - Prefix signed-commit OID failure paths with
E007inpush_signed_commits. - Prefix several
core.setFailed(...)paths withE001/E002inqmd_index.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| actions/setup/js/qmd_index.cjs | Adds E00X: prefixes to setup-script failure messages (env var / missing SDK / invalid slug / min results). |
| actions/setup/js/push_signed_commits.cjs | Adds E007: prefixes to OID resolution and GraphQL missing-OID error paths. |
| actions/setup/js/create_issue.cjs | Adds E001: prefix to invalid close-older-key configuration error. |
| actions/setup/js/create_discussion.cjs | Adds E001: prefix to invalid close-older-key configuration error. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
actions/setup/js/qmd_index.cjs
Outdated
| const fileCount = fs.readdirSync(searchDir).length; | ||
| if (fileCount < minCount) { | ||
| core.setFailed(`qmd search "${collectionName}" returned ${fileCount} results, minimum is ${minCount}`); | ||
| core.setFailed(`E002: qmd search "${collectionName}" returned ${fileCount} results, minimum is ${minCount}`); |
There was a problem hiding this comment.
E002 is used elsewhere in this repo to mean “max limit exceeded” (e.g., dispatch_repository returns E002: Max count ... reached), matching the Safe Outputs catalog’s LIMIT_EXCEEDED. Here the condition is fileCount < minCount (minimum not met), so the emitted E002 is misleading/inconsistent. Please switch this to a code that better represents “minimum requirement not met” (or adjust the logic/message so it represents an exceeded max limit).
| core.setFailed(`E002: qmd search "${collectionName}" returned ${fileCount} results, minimum is ${minCount}`); | |
| core.setFailed(`E003: qmd search "${collectionName}" returned ${fileCount} results, minimum is ${minCount}`); |
|
@copilot use error constants from share helper file |
Replace hardcoded E001/E002/E007 string prefixes with named constants from the shared error_codes.cjs helper file: - create_issue.cjs: ERR_VALIDATION for close-older-key validation - create_discussion.cjs: ERR_VALIDATION for close-older-key validation - push_signed_commits.cjs: ERR_API for OID resolution and GraphQL failures - qmd_index.cjs: ERR_CONFIG for missing env var / missing SDK, ERR_VALIDATION for invalid repo slug and insufficient results count Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/216b3126-6c3b-42d3-9ab5-b2478f209191
Three handlers (
create_discussion,create_issue,push_signed_commits) were failing theUSE-001: Error Code Standardizationconformance check — their error paths lacked standardized error code prefixes from the Safe Outputs spec.qmd_index.cjshad the same issue and is fixed here too.All error paths now use named constants from the shared
error_codes.cjshelper instead of hardcodedE00Xstrings.Changes
create_issue.cjs/create_discussion.cjs— prefixclose-older-keyvalidation throw withERR_VALIDATIONpush_signed_commits.cjs— prefix OID resolution failure and GraphQL mutation no-OID response withERR_APIqmd_index.cjs— prefix missing env var and missing SDK errors withERR_CONFIG; prefix invalid repo slug and insufficient-results check withERR_VALIDATIONBefore / After
Verified with
bash scripts/check-safe-outputs-conformance.sh—USE-001now passes across all handlers.📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.