Skip to content

Fix excessive blank lines before generated footer in safe-output bodies - #50554

Open
pelikhan with Copilot wants to merge 5 commits into
mainfrom
copilot/container-image-scan-issues
Open

Fix excessive blank lines before generated footer in safe-output bodies#50554
pelikhan with Copilot wants to merge 5 commits into
mainfrom
copilot/container-image-scan-issues

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Generated issues, discussions, and pull requests rendered with a large empty gap between the body content and the > Generated by ... footer, as seen in the linked issue.

Two sources of stray newlines compounded:

  • generateFooterWithMessages unconditionally prefixed the attribution line with "\n\n", even when guardNotices was empty — so the returned footer started with blank lines.
  • create_issue.cjs, create_discussion.cjs, and create_pull_request.cjs each pushed two empty bodyLines entries before the footer.

Changes

  • messages_footer.cjs: only insert the "\n\n" separator when guard notices (detection caution, blocked domains, DIFC filtering) are actually present, and trim trailing whitespace off the notices block.
  • create_issue.cjs / create_discussion.cjs / create_pull_request.cjs: push a single blank separator line instead of two.
  • messages.test.cjs: regression test asserting the footer starts directly with > Generated by ... when there are no guard notices.
// before
let footer = guardNotices + "\n\n" + getFooterMessage(ctx);
// after
let footer = guardNotices ? guardNotices.trimEnd() + "\n\n" + getFooterMessage(ctx) : getFooterMessage(ctx);

Recompiled workflow lock files are included since the setup JS is bundled into them.


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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 4.95 AIC · ⌖ 6.77 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix container findings for test-image Fix excessive blank lines before generated footer in safe-output bodies Aug 5, 2026
Copilot AI requested a review from pelikhan August 5, 2026 13:26
@pelikhan
pelikhan marked this pull request as ready for review August 5, 2026 13:27
Copilot AI balanced review requested due to automatic review settings August 5, 2026 13:27
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 5, 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.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

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

Fixes excessive spacing before safe-output footers.

Changes:

  • Normalizes footer separation based on guard notices.
  • Reduces separator lines in generated issue, discussion, and pull request bodies.
  • Adds regression coverage for footers without guard notices.
Show a summary per file
File Description
actions/setup/js/messages.test.cjs Tests footer spacing without notices.
actions/setup/js/messages_footer.cjs Adjusts guard-notice/footer separation.
actions/setup/js/create_issue.cjs Removes an extra issue-body separator.
actions/setup/js/create_discussion.cjs Removes an extra discussion-body separator.
actions/setup/js/create_pull_request.cjs Removes an extra pull-request-body separator.

Review details

Tip

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread actions/setup/js/messages_footer.cjs Outdated

@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 fix is correct and well-scoped.

  • messages_footer.cjs: correctly gates the `

separator onguardNotices` being truthy — empty string is falsy in JS, so no blank lines are emitted when there are no guard notices.

  • The three .cjs files consistently reduce the double-blank push to a single separator, matching the intent.
  • The regression test directly validates the reported symptom.

No blocking issues found.> 🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 16.3 AIC · ⌖ 10.3 AIC · ⊞ 5.4K

@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 /diagnosing-bugs and /tdd — approving with one minor observation on test coverage.

📋 Key Themes & Highlights

Key Themes

  • Root cause properly addressed: both compounding sources of stray blank lines are fixed — the footer separator and the caller push.
  • Regression test added: the happy-path (no guard notices) is now covered; see inline comment for a suggested complementary test.

Positive Highlights

  • ✅ Minimal, surgical diff across exactly the files that mattered
  • guardNotices.trimEnd() prevents trailing whitespace from leaking into the separator
  • ✅ Consistent fix applied to all three callers (issue, discussion, PR)
  • ✅ PR description accurately explains both root causes and the fix strategy
> 🧠 *Reviewed using Matt Pocock's skills by [Matt Pocock Skills Reviewer](https://github.com/github/gh-aw/actions/runs/31010256034)* · sonnet46 · 26 AIC · ⌖ 7.88 AIC · ⊞ 7.1K > Comment /matt to run again

const { generateFooterWithMessages } = await import("./messages.cjs");

const result = generateFooterWithMessages("Test Workflow", "https://github.com/test/repo/actions/runs/123", "", "", undefined, undefined, undefined);

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.

[/tdd] The test covers only the no-guard-notices path. A complementary test for when guardNotices is non-empty would protect the intentional `

` separator in that branch — without it, a future regression there would go undetected.

@copilot please address this.

@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.

Verdict: no blocking issues

Small, well-targeted fix: generateFooterWithMessages now only inserts the \n\n separator when guard notices exist and trims trailing whitespace off the notices block; the three create_*.cjs callers were updated to push a single blank separator line instead of two. Logic checked against all three call sites (issue/discussion/PR) and matches the regression test added in messages.test.cjs.

💡 Minor nit (non-blocking)

Line 738 in messages_footer.cjs has a leftover duplicate comment line (// Attribution footer line comes after any guard notices) immediately followed by the new 3-line comment restating the same thing. Harmless but slightly redundant — could be squashed into one comment block.

> 🔎 *Code quality review by [PR Code Quality Reviewer](https://github.com/github/gh-aw/actions/runs/31010256052)* · auto · 33.3 AIC · ⌖ 4.86 AIC · ⊞ 7.9K > Comment /review to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 100/100 — Excellent

Analyzed 1 test: 1 design, 0 implementation, 0 violations.

📊 Metrics (1 test)
Metric Value
Analyzed 1 (Go: 0, JS: 1)
✅ Design 1 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (100%)
Duplicate clusters 0
Inflation No (ratio: 1.1:1)
🚨 Violations 0
Test File Classification Status
should not start with blank lines when there are no guard notices actions/setup/js/messages.test.cjs:798 Design test ✅ Excellent

Quality Highlights

  • Focused bug-fix test — Single new test validates the exact regression being prevented (no blank lines before footer when guard notices absent)
  • Behavioral coverage — Test verifies user-visible output formatting, not implementation details
  • Minimal test inflation — 8 test lines vs. 7 production lines (1.1:1 ratio, well under 2:1 threshold)
  • Clean assertions — Direct expect().toBe() pattern with clear intent
  • Edge case coverage — Test covers the previously broken scenario (empty guard notices)

Verdict

passed. 0% implementation tests (threshold: 30%). High-quality targeted fix with excellent test coverage.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 18.7 AIC · ⌖ 4.99 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: 100/100. 0% implementation tests (threshold: 30%).

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please take another pass on this PR.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 4.95 AIC · ⌖ 6.77 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI and others added 2 commits August 5, 2026 14:01
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot August 5, 2026 14:07
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.

[container-image-scan] Container findings for test-image

4 participants