Skip to content

Remove blank lines before generated footer expiration - #74252

Merged
pelikhan merged 3 commits into
mainfrom
copilot/gh-aw-remove-blank-line-footer
Nov 3, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/gh-aw-remove-blank-line-footer

Conversation

Copilot AI commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Trailing whitespace in generated footers can introduce blank lines before the expiration checkbox.

  • Spacing: Trim trailing whitespace before inserting expiration in both footer helpers.
  • Compatibility: Preserve metadata suffixes and leave footers unchanged when expiration is disabled.
  • Regression coverage: Cover trailing newlines, CRLF, and whitespace with and without metadata.

Copilot AI changed the title [WIP] Remove blank line before generated footer expiration Remove blank lines before generated footer expiration Nov 2, 2026
Copilot AI requested a review from pelikhan November 2, 2026 23:44
@pelikhan
pelikhan marked this pull request as ready for review November 2, 2026 23:48
Copilot AI adaptive review requested due to automatic review settings November 2, 2026 23:48
@github-actions

github-actions Bot commented Nov 2, 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 Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: opus55 medium · ~12 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · sonnet50 · ~15 AIC · ⌖ ~21 AIC · ⊞ 12.7K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt56 max · ~2 AIC · ⌖ ~1 AIC · ⊞ 118 · ◷

Generated by Ponytail Reviewer for #74252

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-02T23:52:03Z
review_event: REQUEST_CHANGES
top_themes: CRLF XML-marker handling can place expiration outside quoted footer
files_reviewed: actions/setup/js/ephemerals.cjs, actions/setup/js/ephemerals.test.cjs
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.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.

Changes requested

The whitespace trimming is directionally correct, but CRLF metadata suffixes still bypass the XML-marker branch and place expiration outside the quoted footer. Please make marker detection line-ending tolerant and cover that case in the regression tests.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again

const xmlMarker = xmlMarkerMatch[0];
const footerWithoutXml = footer.substring(0, footer.length - xmlMarker.length);
footer = `${footerWithoutXml}\n> ${expirationLine}${xmlMarker}`;
footer = `${footerWithoutXml.trimEnd()}\n> ${expirationLine}${xmlMarker}`;

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.

CRLF metadata suffixes are still misclassified here, so the expiration line is appended after the XML marker instead of inside the quoted footer.

💡 Why this matters and how to fix it

xmlMarkerMatch only accepts \n\n<!--...-->\n?; a real CRLF suffix (\r\n\r\n<!--...-->\r\n) misses the match, and this new else path trims the footer then appends the checkbox after the marker. That breaks the stated metadata-preservation behavior and can leave expiration parsing/marker detection wrong. Make the marker match line-ending tolerant (or normalize line endings) and add a CRLF-with-marker assertion to the regression tests.

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.

Fixed in 12b6a5fd: marker matching now accepts CRLF separators and preserves whitespace following the XML comment. Added CRLF metadata regression coverage.

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.

🟢 Approval recommended

The footer formatting change addresses the reviewed whitespace, metadata, newline, and disabled-expiration cases, and the supplied review status reports no active issues.

No open issues 🎉

What changed in this PR

This pull request removes unwanted blank lines before generated footer expiration checkboxes while preserving metadata suffixes and disabled-expiration behavior.

Changes:

  • Trim trailing whitespace before inserting expiration lines in both footer helpers.
  • Preserve metadata suffix ordering.
  • Add regression coverage for newline, CRLF, whitespace, metadata, and disabled-expiration cases.
  • Address the remaining pure-CRLF metadata-ordering issue before approval.
File Summary
actions/​setup/​js/​ephemerals.test.cjs Adds regression tests for whitespace handling, metadata suffixes, newline variants, and disabled expiration.
actions/​setup/​js/​ephemerals.cjs Trims trailing whitespace before inserting expiration lines in both footer helpers. The metadata separator still needs to support fully CRLF-formatted footers.

This pull request requires changes.

Review effort: Lite (auto)

@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. The fix is correct for every whitespace case the new tests cover, and the disabled path still returns footers unchanged. One gap remains.

📋 Key Themes & Highlights

Key Themes

  • Marker-branch whitespace: the \n?$ regex on addExpirationToFooter misses trailing whitespace after the XML marker. This is pre-existing, but it is the same whitespace class this PR targets.
  • Test gap: the new cases only put whitespace before the marker.

Positive Highlights

  • ✅ Trimming before inserting the expiration line is a minimal, targeted fix.
  • ✅ Tests assert both the footer shape and the unchanged-when-disabled behavior.
  • ✅ Both helpers are fixed consistently.

Validation

Vitest could not run here (npm registry certificate error). I exercised both helpers directly with Node across the test matrix and confirmed that the proposed regex fixes the marker gap without breaking any case.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again

const xmlMarker = xmlMarkerMatch[0];
const footerWithoutXml = footer.substring(0, footer.length - xmlMarker.length);
footer = `${footerWithoutXml}\n> ${expirationLine}${xmlMarker}`;
footer = `${footerWithoutXml.trimEnd()}\n> ${expirationLine}${xmlMarker}`;

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.

[/diagnosing-bugs] The XML-marker branch still misses whitespace after the marker. The regex on line 145 ((n/redacted)\n<!--.*?-->\n?$/s) tolerates only one trailing newline, so a footer ending in two newlines, CRLF, or spaces after the marker puts the expiration line after the marker. issue_body.cjs trims its suffix first, which hides this today, but the helper is not safe on its own.

💡 Suggested change
const xmlMarkerMatch = footer.match((n/redacted)\n<!--.*?-->\s*$/s);

I checked this regex against every case in the new tests and against marker-followed-by-whitespace inputs; all pass, and the preserved trailing whitespace stays after the marker.

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

Fixed in 12b6a5fd: the marker match now accepts trailing whitespace after the XML comment, while retaining it after the inserted expiration line.

Comment thread actions/setup/js/ephemerals.test.cjs Outdated
describe("addExpirationToFooter", () => {
it.each(["", "\n", "\n\n", " \t\r\n"])("should place expiration directly after footer text ending in %j with or without metadata", async whitespace => {
const { addExpirationToFooter } = await import("./ephemerals.cjs");
for (const suffix of ["", "\n\n<!-- gh-aw-marker -->\n"]) {

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 new metadata cases only put whitespace before the XML marker, so the gap above is untested. Add a case with whitespace after the marker (for example two newlines, CRLF, or spaces) and assert that the expiration still lands before the marker.

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

Added regression cases in 12b6a5fd for CRLF metadata and whitespace after the XML marker; they assert expiration remains before the marker.

@pelikhan

pelikhan commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Copilot AI commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Ran the PR finisher. Local validation passed, and the branch now includes 12b6a5fd addressing the review feedback. CI needs a maintainer re-trigger after this agent push.

@pelikhan
pelikhan merged commit 771a6b3 into main Nov 3, 2026
41 checks passed
@pelikhan
pelikhan deleted the copilot/gh-aw-remove-blank-line-footer branch November 3, 2026 00:57
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.0

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.

[gh-aw] Protected Files: Remove blank line before generated footer expiration

3 participants