Skip to content

fix(conformance): USE-001 standardized error codes + USE-003 staged mode emoji#19497

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-standardized-error-codes
Mar 4, 2026
Merged

fix(conformance): USE-001 standardized error codes + USE-003 staged mode emoji#19497
pelikhan merged 3 commits intomainfrom
copilot/fix-standardized-error-codes

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

Two LOW-severity Safe Outputs conformance failures: run_operation_update_upgrade.cjs lacked ERR_* prefixes on thrown errors, and generate_aw_info.cjs computed a staged flag but never emitted the canonical 🎭 Staged Mode Preview log.

USE-001 — run_operation_update_upgrade.cjs

Import ERR_CONFIG/ERR_SYSTEM from error_codes.cjs and prefix all throw new Error(...) messages:

// before
throw new Error(`Command '${fullCmd}' failed with exit code ${exitCode}`);
throw new Error("Missing GitHub token: ...");

// after
throw new Error(`${ERR_SYSTEM}: Command '${fullCmd}' failed with exit code ${exitCode}`);
throw new Error(`${ERR_CONFIG}: Missing GitHub token: ...`);

USE-003 — generate_aw_info.cjs

Import logStagedPreviewInfo from staged_preview.cjs and call it before the info dump when staged mode is active:

if (awInfo.staged) {
  logStagedPreviewInfo("Generating workflow info in staged mode — no changes applied");
}
Original prompt

This section details on the original issue you should resolve

<issue_title>[Safe Outputs Conformance] USE-001 / USE-003: Two LOW conformance issues — missing standardized error codes and staged-mode emoji</issue_title>
<issue_description>### Conformance Check Failures

Severity: LOW
Category: Usability

Two related usability conformance checks are failing. Both are straightforward fixes suitable for a single Copilot coding agent assignment.


Issue 1 — USE-001: Missing Standardized Error Codes

Check ID: USE-001
File: actions/setup/js/run_operation_update_upgrade.cjs

Problem

The handler throws new Error(...) and calls core.setFailed(...) without using the standardized error code prefixes (E001E010, ERROR_*, or ERR_*) required by the Safe Outputs specification. This makes errors harder to classify, monitor, and document.

Current Behavior

Errors are thrown as plain strings, e.g.:

throw new Error(`Command '\$\{fullCmd}' failed with exit code \$\{exitCode}`);
throw new Error("Missing GitHub token: ...");

Expected Behavior

Error messages SHOULD include a standardized prefix so consumers can programmatically identify the error class:

throw new Error("ERR_COMMAND_FAILED: Command '...' failed with exit code ...");
throw new Error("ERR_MISSING_TOKEN: Missing GitHub token: ...");

Issue 2 — USE-003: Staged Mode Missing 🎭 Emoji / logStagedPreviewInfo

Check ID: USE-003
File: actions/setup/js/generate_aw_info.cjs

Problem

The file sets staged: process.env.GH_AW_INFO_STAGED === "true" but does not call logStagedPreviewInfo (from staged_preview.cjs) or otherwise emit the canonical 🎭 Staged Mode Preview message when staged mode is active. The specification requires that all handlers with staged mode use the canonical format so users consistently see the staged-mode indicator.

Current Behavior

The staged flag is computed but only stored in the returned info object; no log message using the 🎭 emoji or logStagedPreviewInfo helper is emitted.

Expected Behavior

When staged === true, the handler SHOULD call:

const { logStagedPreviewInfo } = require("./staged_preview.cjs");
// ...
if (info.staged) {
  logStagedPreviewInfo("Generating workflow info in staged mode — no changes applied");
}

Remediation Steps

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

  • USE-001 (run_operation_update_upgrade.cjs): Prefix all throw new Error(...) and core.setFailed(...) messages with a standardized code (ERR_* or ERROR_*), following the same convention used in other handlers.
  • USE-003 (generate_aw_info.cjs): Import logStagedPreviewInfo from ./staged_preview.cjs and emit a staged-mode log message when GH_AW_INFO_STAGED === "true".

Verification

After remediation, verify both fixes by running:

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

Checks USE-001 and USE-003 should both pass without errors.

References

  • Safe Outputs Specification: docs/src/content/docs/reference/safe-outputs-specification.md
  • Conformance Checker: scripts/check-safe-outputs-conformance.sh
  • Staged Preview Helper: actions/setup/js/staged_preview.cjs
  • Run ID: §22633945407
  • Date: 2026-03-03

Generated by Daily Safe Outputs Conformance Checker ·

  • expires on Mar 4, 2026, 5:07 PM UTC

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…E-003)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing standardized error codes in setup operation fix(conformance): USE-001 standardized error codes + USE-003 staged mode emoji Mar 4, 2026
@pelikhan pelikhan marked this pull request as ready for review March 4, 2026 03:36
Copilot AI review requested due to automatic review settings March 4, 2026 03:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Addresses two Safe Outputs conformance failures by standardizing error message prefixes and ensuring staged-mode runs emit the canonical staged preview indicator.

Changes:

  • Prefix throw new Error(...) messages in run_operation_update_upgrade.cjs with standardized ERR_* codes.
  • Emit the canonical 🎭 Staged Mode Preview log in generate_aw_info.cjs when staged mode is enabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
actions/setup/js/run_operation_update_upgrade.cjs Imports standardized error codes and prefixes thrown errors with ERR_CONFIG / ERR_SYSTEM.
actions/setup/js/generate_aw_info.cjs Imports and calls logStagedPreviewInfo to log staged-mode preview info before printing aw_info output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

fs.writeFileSync(tmpPath, JSON.stringify(awInfo, null, 2));

if (awInfo.staged) {
logStagedPreviewInfo("Generating workflow info in staged mode — no changes applied");
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

The staged-mode logging path is newly introduced here, but generate_aw_info.test.cjs doesn’t currently assert that the canonical 🎭 Staged Mode Preview message is emitted when GH_AW_INFO_STAGED === "true". Please add a test that sets staged mode and verifies the expected core.info call (via the existing global core mock) so this conformance behavior doesn’t regress.

Suggested change
logStagedPreviewInfo("Generating workflow info in staged mode — no changes applied");
logStagedPreviewInfo("🎭 Staged Mode Preview: Generating workflow info in staged mode — no changes applied");

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 601e811 into main Mar 4, 2026
50 checks passed
@pelikhan pelikhan deleted the copilot/fix-standardized-error-codes branch March 4, 2026 04:37
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 / USE-003: Two LOW conformance issues — missing standardized error codes and staged-mode emoji

3 participants