Skip to content

Standardize safe-output handler error codes - #67131

Merged
pelikhan merged 4 commits into
mainfrom
copilot/use-001-standardize-error-codes
Oct 9, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/use-001-standardize-error-codes

Conversation

Copilot AI commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Seventeen production handlers were flagged for lacking standardized error codes. Add catalog prefixes to representative validation, limit, and API errors across those handlers.

  • Validation: Prefix input and handler validation errors with E001.
  • Limits and API failures: Use E002 for limit violations and E007 for API failures.
throw new Error("E002: work_queue_policy_proposal_limit");

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Standardize E001-E010 error codes in work-queue handlers Standardize safe-output handler error codes Oct 9, 2026
Copilot AI requested a review from pelikhan October 9, 2026 06:13
@pelikhan

pelikhan commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot Use constants

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Use constants

Done in b8f5cff. The handlers now use the shared safe-output error-code constants, including a new SAFE_OUTPUT_E002 constant.

@pelikhan
pelikhan marked this pull request as ready for review October 9, 2026 14:10
Copilot AI balanced review requested due to automatic review settings October 9, 2026 14:10
@pelikhan

pelikhan commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Many failure sites remain untagged, and some newly assigned codes do not represent the actual failure category.

3 open findings
What changed in this PR

Adds standardized safe-output error-code prefixes to selected work-queue handler failures.

Changes:

  • Adds and tests the shared SAFE_OUTPUT_E002 constant.
  • Applies E001/E002 prefixes to selected validation and limit failures.
  • Applies E007 to a reconciler API failure.
File Description
actions/​setup/​js/​error_codes.cjs Adds and exports E002.
actions/​setup/​js/​error_codes.test.cjs Tests E002 export and value.
actions/​setup/​js/​finish_work_queue_claim.cjs Tags delivery-proof validation.
actions/​setup/​js/​report_failed_jobs.cjs Tags metadata parsing failure.
actions/​setup/​js/​safe_output_action_handler.cjs Tags Claim-factory guard.
actions/​setup/​js/​work_queue_binding.cjs Tags policy size limit.
actions/​setup/​js/​work_queue_claim_adapters.cjs Tags verifier validation.
actions/​setup/​js/​work_queue_code_coverage.cjs Tags missing Claim factory.
actions/​setup/​js/​work_queue_code_scanning.cjs Tags missing Claim factory.
actions/​setup/​js/​work_queue_control_adapter.cjs Tags credential validation.
actions/​setup/​js/​work_queue_dispatch.cjs Tags observer-role guard.
actions/​setup/​js/​work_queue_git_tree_adapter.cjs Tags adapter validation.
actions/​setup/​js/​work_queue_graphql_adapter.cjs Tags operation-name validation.
actions/​setup/​js/​work_queue_issues.cjs Tags issues configuration validation.
actions/​setup/​js/​work_queue_prepare_claim_script.cjs Tags path validation.
actions/​setup/​js/​work_queue_reconciler.cjs Tags API response failure.
actions/​setup/​js/​work_queue_rest_adapter.cjs Tags REST route validation.
actions/​setup/​js/​work_queue_upload_assets.cjs Tags missing Claim factory.
actions/​setup/​js/​write_work_queue_snapshot.cjs Tags observer-role guard.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

for (const [key, field] of Object.entries(value)) {
if (typeof field !== "string" || !field.trim() || field.includes("${{") || Buffer.byteLength(field) > 256 || /[\x00-\x1f\x7f]/.test(field)) throw queueError("projection_invalid", `${key} must be a nonblank bounded literal`);
if (typeof field !== "string" || !field.trim() || field.includes("${{") || Buffer.byteLength(field) > 256 || /[\x00-\x1f\x7f]/.test(field))
throw queueError("projection_invalid", `${SAFE_OUTPUT_E001}: ${key} must be a nonblank bounded literal`);
function routeFields(route) {
if (typeof route !== "string" || !/^\/repos\/\{owner\}\/\{repo\}\/[A-Za-z0-9_{}./-]+$/.test(route) || route.includes("..") || route.includes("//")) throw new Error("Trusted REST adapter requires a fixed repository-relative route");
if (typeof route !== "string" || !/^\/repos\/\{owner\}\/\{repo\}\/[A-Za-z0-9_{}./-]+$/.test(route) || route.includes("..") || route.includes("//"))
throw new Error(`${SAFE_OUTPUT_E001}: Trusted REST adapter requires a fixed repository-relative route`);
async function main(config = {}, suppliedClient) {
const factoryClaim = currentClaimHandle();
if (!factoryClaim) throw new Error("Queue asset adapter requires an immutable Claim factory");
if (!factoryClaim) throw new Error(`${SAFE_OUTPUT_E001}: Queue asset adapter requires an immutable Claim factory`);
…ardize-error-codes

# Conflicts:
#	actions/setup/js/finish_work_queue_claim.cjs
#	actions/setup/js/work_queue_code_scanning.cjs
#	actions/setup/js/work_queue_git_tree_adapter.cjs
#	actions/setup/js/work_queue_graphql_adapter.cjs
#	actions/setup/js/work_queue_rest_adapter.cjs
#	actions/setup/js/work_queue_upload_assets.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Merged main and resolved all six conflicts in 62d0b1a6.

@pelikhan
pelikhan merged commit 9d0a5a0 into main Oct 9, 2026
3 checks passed
@pelikhan
pelikhan deleted the copilot/use-001-standardize-error-codes branch October 9, 2026 14:36
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Safe Outputs Conformance] USE-001: 17 work-queue handlers lack standardized E001-E010 error codes

3 participants