Skip to content

[Safe Outputs Conformance] USE-001: add_labels.cjs and dismiss_pull_request_review.cjs missing standardized error codes #51018

Description

@github-actions

Conformance Check Failure

Check ID: USE-001
Severity: LOW
Category: Usability

Problem Description

The safe-outputs conformance checker (scripts/check-safe-outputs-conformance.sh, check_error_codes) flags handlers that throw errors (throw new Error(...) / core.setFailed(...)) but don't reference any standardized error code (E[0-9]{3}, ERROR_, or ERR_ pattern). Two handlers currently throw raw, uncoded errors:

  • actions/setup/js/add_labels.cjs:278throw new Error(\Failed to resolve GraphQL node ID for ${contextType} #${itemNumber}`)`
  • actions/setup/js/dismiss_pull_request_review.cjs:251throw getReviewError; (re-thrown fetch error, message prefixed at line 249 without an error code)

The repo already has a standardized error-code catalog for exactly this purpose (actions/setup/js/error_codes.cjs, exporting ERR_VALIDATION, ERR_API, ERR_NOT_FOUND, ERR_SYSTEM, etc., plus SAFE_OUTPUT_E001-style constants used elsewhere), and several handlers already follow the convention (e.g. comment_memory.cjs, dispatch_repository.cjs, comment_limit_helpers.cjs, assign_to_agent.cjs). These two handlers are inconsistent with that pattern, making their errors harder to grep/alert on in logs and dashboards.

Affected Components

  • actions/setup/js/add_labels.cjs (line 278)
  • actions/setup/js/dismiss_pull_request_review.cjs (line 251, error prefixed at line 249)
🔍 Current vs Expected Behavior

Current Behavior

Both handlers throw errors with plain, human-readable messages and no machine-parseable code prefix, e.g.:

throw new Error(`Failed to resolve GraphQL node ID for ${contextType} #${itemNumber}`);
getReviewError.message = `Failed to fetch review ${reviewId} on ${owner}/${repo}#${pullRequestNumber}: ` + getReviewError.message;
throw getReviewError;

Expected Behavior

Per the error-code convention already established in error_codes.cjs, thrown errors should be prefixed with a standardized code so they can be filtered/alerted on consistently, e.g.:

const { ERR_NOT_FOUND } = require("./error_codes.cjs");
throw new Error(`${ERR_NOT_FOUND}: Failed to resolve GraphQL node ID for ${contextType} #${itemNumber}`);
const { ERR_API } = require("./error_codes.cjs");
getReviewError.message = `${ERR_API}: Failed to fetch review ${reviewId} on ${owner}/${repo}#${pullRequestNumber}: ` + getReviewError.message;

Remediation Steps

This task can be assigned to a Copilot coding agent with the following steps:

  1. In actions/setup/js/add_labels.cjs, import the appropriate constant from ./error_codes.cjs (likely ERR_NOT_FOUND or ERR_API, given the error is about a failed GraphQL node ID lookup) and prefix the thrown error message at line 278 with it.
  2. In actions/setup/js/dismiss_pull_request_review.cjs, import ERR_API (or the most fitting code) from ./error_codes.cjs and prefix the re-thrown error's message at line 249-251 with it.
  3. Confirm no other call sites in either file rely on matching the exact (uncoded) error message text — update any such assertions in tests if needed.
  4. Run the existing unit tests for both handlers to ensure no regressions.

Verification

After remediation, verify the fix by running:

bash scripts/check-safe-outputs-conformance.sh

USE-001 should report [PASS] with no LOW findings for these two files.

References

  • Safe Outputs Specification: docs/src/content/docs/specs/safe-outputs-specification.md
  • Conformance Checker: scripts/check-safe-outputs-conformance.sh
  • Error code catalog: actions/setup/js/error_codes.cjs
  • Run ID: 31152501447
  • Date: 2026-08-07

Generated by ✅ Daily Safe Outputs Conformance Checker · agent · 55.1 AIC · ⌖ 13.9 AIC · ⊞ 6.8K ·

  • expires on Aug 7, 2026, 10:06 PM UTC-08:00

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions