Skip to content

fix(safe-outputs): add 🎭 emoji to staged mode preview in PR review handlers (USE-003)#22621

Merged
pelikhan merged 3 commits intomainfrom
copilot/use-003-add-emoji-to-handlers
Mar 24, 2026
Merged

fix(safe-outputs): add 🎭 emoji to staged mode preview in PR review handlers (USE-003)#22621
pelikhan merged 3 commits intomainfrom
copilot/use-003-add-emoji-to-handlers

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

Conformance check USE-003 requires all handlers with staged mode to include a 🎭 visual indicator distinguishing dry-run output from live output. Three handlers delegated staged behavior to pr_review_buffer.cjs (which already had the emoji) but the per-file checker didn't follow that delegation, causing failures.

Changes

  • safe_output_helpers.cjs: Imports and re-exports logStagedPreviewInfo from staged_preview.cjs, making it accessible to any handler already importing from this shared module.
  • create_pr_review_comment.cjs: Imports logStagedPreviewInfo and calls it when config.staged === true is set on the buffer.
  • submit_pr_review.cjs: Same pattern as above.
// Before — staged flag silently propagated to buffer, no preview log
if (config.staged === true) {
  buffer.setStaged(true);
}

// After — emits 🎭 preview info consistent with other handlers
if (config.staged === true) {
  buffer.setStaged(true);
  logStagedPreviewInfo("PR review will be previewed without being submitted");
}

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Add 🎭 emoji to handlers in staged mode preview fix(safe-outputs): add 🎭 emoji to staged mode preview in PR review handlers (USE-003) Mar 24, 2026
Copilot AI requested a review from pelikhan March 24, 2026 06:30
@pelikhan pelikhan marked this pull request as ready for review March 24, 2026 11:18
Copilot AI review requested due to automatic review settings March 24, 2026 11:18
Copy link
Copy Markdown
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

This PR updates PR-review-related safe-output handlers to emit a 🎭 staged-mode preview indicator (USE-003) when running in staged/dry-run mode, aligning them with existing staged preview logging used elsewhere.

Changes:

  • Re-export logStagedPreviewInfo via safe_output_helpers.cjs.
  • Add staged-mode 🎭 preview logging to create_pr_review_comment.cjs when staged is enabled.
  • Add staged-mode 🎭 preview logging to submit_pr_review.cjs when staged is enabled.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
actions/setup/js/submit_pr_review.cjs Logs 🎭 staged preview info when staged mode is enabled for PR review submission buffering.
actions/setup/js/safe_output_helpers.cjs Re-exports logStagedPreviewInfo for broader handler access.
actions/setup/js/create_pr_review_comment.cjs Logs 🎭 staged preview info when staged mode is enabled for PR review comment buffering.

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

Comment on lines 50 to 54
// Propagate per-handler staged flag to the shared PR review buffer
if (config.staged === true) {
buffer.setStaged(true);
logStagedPreviewInfo("PR review will be previewed without being submitted");
}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Staged mode detection here only checks config.staged === true, so the 🎭 preview indicator will not be logged when staged mode is enabled globally via GH_AW_SAFE_OUTPUTS_STAGED. The codebase has a canonical helper for consistent detection (isStagedMode in actions/setup/js/safe_output_helpers.cjs), which includes both the env var and per-handler config. Consider using isStagedMode(config) to decide when to call logStagedPreviewInfo (and optionally when to set the buffer staged flag).

Copilot uses AI. Check for mistakes.
Comment on lines 50 to 54
// Propagate per-handler staged flag to the shared PR review buffer
if (config.staged === true) {
buffer.setStaged(true);
logStagedPreviewInfo("PR review comments will be previewed without being submitted");
}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This staged-mode branch only triggers when config.staged === true, so if staged mode is enabled via the global GH_AW_SAFE_OUTPUTS_STAGED env var, the handler won’t emit the required 🎭 preview indicator. The repo provides isStagedMode(config) in actions/setup/js/safe_output_helpers.cjs to ensure consistent staged detection across handlers (env var OR per-handler flag). Consider switching the condition to isStagedMode(config) for the preview log (and decide separately whether the buffer’s per-handler staged flag should be set).

Copilot uses AI. Check for mistakes.
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review comments

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot review comments

Fixed in d819ce4. Both create_pr_review_comment.cjs and submit_pr_review.cjs now use isStagedMode(config) for the logStagedPreviewInfo call so it fires on global GH_AW_SAFE_OUTPUTS_STAGED as well, while the buffer.setStaged(true) remains guarded by config.staged === true (per-handler flag only). Both helpers are now pulled from safe_output_helpers.cjs to avoid the extra staged_preview.cjs import in submit_pr_review.cjs.

@pelikhan pelikhan merged commit 32b88a1 into main Mar 24, 2026
@pelikhan pelikhan deleted the copilot/use-003-add-emoji-to-handlers branch March 24, 2026 11:46
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-003: Multiple handlers missing 🎭 emoji in staged mode preview

3 participants