Repository navigation
Remove blank lines before generated footer expiration - #74252
Conversation
Co-authored-by: pelikhan <[email protected]>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ 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: 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.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: 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.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
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}`; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Fixed in 12b6a5fd: marker matching now accepts CRLF separators and preserves whitespace following the XML comment. Added CRLF metadata regression coverage.
There was a problem hiding this comment.
🟢 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)
There was a problem hiding this comment.
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 onaddExpirationToFootermisses 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}`; |
There was a problem hiding this comment.
[/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.
There was a problem hiding this comment.
Fixed in 12b6a5fd: the marker match now accepts trailing whitespace after the XML comment, while retaining it after the inserted expiration line.
| 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"]) { |
There was a problem hiding this comment.
[/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.
There was a problem hiding this comment.
Added regression cases in 12b6a5fd for CRLF metadata and whitespace after the XML marker; they assert expiration remains before the marker.
|
@copilot run pr-finisher skill |
Co-authored-by: pelikhan <[email protected]>
Ran the PR finisher. Local validation passed, and the branch now includes |
|
🎉 This pull request is included in a new release. Release: |
Trailing whitespace in generated footers can introduce blank lines before the expiration checkbox.