Skip to content

Standardize USE-001 error codes in add_labels and dismiss_pull_request_review - #51338

Merged
pelikhan merged 4 commits into
mainfrom
copilot/use-001-add-standardized-error-codes
Aug 8, 2026
Merged

Standardize USE-001 error codes in add_labels and dismiss_pull_request_review#51338
pelikhan merged 4 commits into
mainfrom
copilot/use-001-add-standardized-error-codes

Conversation

Copilot AI commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

USE-001 flagged two safe-output handlers that emitted unstructured errors, breaking consistency with the shared error-code catalog and making automated triage harder. This change aligns both handlers with existing E###-prefixed error behavior.

  • add_labels: code-prefix missing GraphQL node ID failure

    • Imported SAFE_OUTPUT_E099 from error_codes.cjs.
    • Prefixed the issue-intent GraphQL node ID resolution failure with E099.
  • dismiss_pull_request_review: wrap rethrow with standardized code

    • Imported SAFE_OUTPUT_E099.
    • Replaced raw throw getReviewError (after context mutation) with a fresh Error carrying E099 and preserved context + original message.
  • Regression coverage

    • Added/updated focused tests to assert E099 is present for:
      • missing node_id in add_labels issue-intent path
      • non-404 getReview failure in dismiss_pull_request_review
throw new Error(
  `${SAFE_OUTPUT_E099}: Failed to fetch review ${reviewId} on ${owner}/${repo}#${pullRequestNumber}: ${getErrorMessage(getReviewError)}`
);

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.27 AIC · ⌖ 6.48 AIC · ⊞ 6.1K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add standardized error codes to add_labels.cjs and dismiss_pull_request_review.cjs Standardize USE-001 error codes in add_labels and dismiss_pull_request_review Aug 8, 2026
Copilot AI requested a review from pelikhan August 8, 2026 06:44
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

PR Triage

Standardizes USE-001 error codes in two safe-output handlers. Small, isolated, well-tested change.

Generated by 🔧 PR Triage Agent · auto · 47.1 AIC · ⌖ 2.55 AIC · ⊞ 8K ·

@pelikhan
pelikhan marked this pull request as ready for review August 8, 2026 14:56
Copilot AI balanced review requested due to automatic review settings August 8, 2026 14:56
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.individual.githubcopilot.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.individual.githubcopilot.com"

See Network Configuration for more information.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

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.

Pull request overview

Standardizes safe-output runtime errors with E099 for label node-ID resolution and review-fetch failures.

Changes:

  • Prefixes both affected errors with SAFE_OUTPUT_E099.
  • Adds focused regression assertions for both failure paths.
Show a summary per file
File Description
actions/setup/js/add_labels.cjs Adds E099 to missing node-ID errors.
actions/setup/js/add_labels.test.cjs Tests the standardized error code.
actions/setup/js/dismiss_pull_request_review.cjs Wraps review-fetch failures with contextual E099 errors.
actions/setup/js/dismiss_pull_request_review.test.cjs Verifies E099 on non-404 failures.

Review details

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions github-actions Bot 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.

The changes are minimal, correct, and well-tested. Both files now consistently prepend E099 to their error messages using the shared error_codes.cjs constant. The dismiss_pull_request_review.cjs change also improves error handling by using getErrorMessage() instead of mutating the original error object. Tests are updated to assert the error code is present.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 14.1 AIC · ⌖ 6.82 AIC · ⊞ 5.5K

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /codebase-design and /tdd — approving with one minor suggestion.

📋 Summary

Positive Highlights

  • ✅ Consistent use of the shared SAFE_OUTPUT_E099 constant — no magic strings
  • dismiss_pull_request_review fix is strictly better: replaces a fragile in-place message mutation with a clean, descriptive new Error(...)
  • ✅ Regression tests are well-scoped: they assert both the error code prefix and a human-readable fragment, which is the right level of specificity

Minor Suggestion

One inline comment: the new Error(...) in dismiss_pull_request_review.cjs discards the original stack. Adding { cause: getReviewError } would preserve it at no cost.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 22.7 AIC · ⌖ 6.53 AIC · ⊞ 7.1K
Comment /matt to run again

getReviewError.message = `Failed to fetch review ${reviewId} on ${owner}/${repo}#${pullRequestNumber}: ` + getReviewError.message;
}
throw getReviewError;
throw new Error(`${SAFE_OUTPUT_E099}: Failed to fetch review ${reviewId} on ${owner}/${repo}#${pullRequestNumber}: ${getErrorMessage(getReviewError)}`);

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.

[/codebase-design] The new Error(...) wrapper discards the original error's stack trace, which can make diagnosing production failures harder.

💡 Consider preserving the cause

Node 16.9+ supports the cause option on Error:

throw new Error(
  `${SAFE_OUTPUT_E099}: Failed to fetch review ${reviewId} on ${owner}/${repo}#${pullRequestNumber}: ${getErrorMessage(getReviewError)}`,
  { cause: getReviewError }
);

This keeps the standardized message and the original stack accessible via err.cause, useful when the error is logged or re-caught upstream.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed — the new Error(...) now includes { cause: getReviewError } to preserve the original stack.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 90/100 — Excellent

Analyzed 2 test(s): 2 design, 0 implementation, 0 violation(s).

📊 Metrics (2 tests)
Metric Value
Analyzed 2 (Go: 0, JS: 2)
✅ Design 2 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 2 (100%)
Duplicate clusters 0
Inflation ⚠️ Yes (add_labels.test.cjs +22 lines vs add_labels.cjs +2 lines = 11:1)
🚨 Violations 0
Test File Classification Issues
should return a standardized error code when issue node_id is missing on issue-intent path add_labels.test.cjs:249 design_test / behavioral_contract / high_value None
fails with review context when getReview returns a non-404 error dismiss_pull_request_review.test.cjs:388 design_test / behavioral_contract / high_value None
⚠️ Flagged (1 — Test Inflation)

add_labels.test.cjsInflation (11:1): 22 lines added to the test file vs. 2 lines added to add_labels.cjs. The test is behaviorally sound; the high ratio stems from mock setup scaffolding. Consider consolidating shared setup into beforeEach helpers to reduce per-test line overhead.

Verdict

Passed. 0% implementation tests (threshold: 30%). Both new tests verify user-visible error contracts (E099 standardized error codes) with strong error message assertions. No guideline violations detected.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 47.7 AIC · ⌖ 7 AIC · ⊞ 7.7K ·
Comment /review to run again

@github-actions github-actions Bot 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.

✅ Test Quality Sentinel: 90/100. 0% implementation tests (threshold: 30%).

@pelikhan

pelikhan commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage nudge for this PR.

Please review the remaining maintainer-facing follow-up below, refresh the branch if GitHub can update it cleanly, and run the pr-finisher skill before handing back to maintainers.

Run: https://github.com/github/gh-aw/actions/runs/31263551516

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.27 AIC · ⌖ 6.48 AIC · ⊞ 6.1K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan merged commit 12a0673 into main Aug 8, 2026
1 check failed
@pelikhan
pelikhan deleted the copilot/use-001-add-standardized-error-codes branch August 8, 2026 15:14
Copilot stopped work on behalf of gh-aw-bot due to an error August 8, 2026 15:14
Copilot AI requested a review from gh-aw-bot August 8, 2026 15:14
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.2

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants