Repository navigation
feat: WARN: lines of the summary stay in the head of the question, and apply can add short lines to its report - #54
Merged
Conversation
…d apply can add short lines to its report - A summary line that starts with "WARN: " moves from the <pre> block to the head, after the watched-path warnings, as cleaned code. At most 10, then a count. They are not cut for the lists; each is at most 220 characters after the escape, so the watched paths keep room. - apply gets PULLGATE_REPORT_FILE. root reads it after apply (the same file it made, O_NOFOLLOW, 64 KiB) and adds its first 10 lines as code to the applied or failed message, then a count. Part of #42. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #42 (the "Released in a tagged version" box closes with the release).
What changes
WARN:lines. A line of thesummaryoutput that starts with exactlyWARN:is taken out of the<pre>block and shown in the head, after the watched-path warnings, as⚠ <code>text</code>(cleaned, like any repo text). At most 10; more give "⚠ N more warnings from the summary". A CRLF line end is not part of the text; aWARN:line with no text is dropped. A summary withoutWARN:lines gives the same message as 0.2.0.PULLGATE_REPORT_FILEforapply(not for a rollback, not forhealth). root makes the empty file (0600) in its per-process trees directory. Afterapply, also when it failed, root reads it: only the same file it made (same device and inode, regular file,O_NOFOLLOW), at most 64 KiB. Its first 10 lines go into the applied / failed / rolled back / held / broken message under "Report of apply:", each as code, at most 1500 characters, then "… N more lines in the report".Spec note
The issue says "If the head alone is too long, the commit and file lists go first, then the rest of the summary." The body keeps its old cut order (from its end: the rest of the summary first, then files, then commits), because a summary without
WARN:lines must give the same message as 0.2.0. The important part, the warnings, is in the head and is not cut for the lists.Tests
internal/message/warn_test.go:TestSummaryWarningsStayInTheHeadOfALongQuestion(2 warnings, 500 files, cut file list),TestSummaryWarningIsOnlyCleanedCode(HTML, link-like text, right-to-left mark),TestTwelveSummaryWarningsShowTenAndACount,TestSummaryWithoutWarningsIsUnchanged(exact text; it also passes on the code ofmain),TestSummaryWarningsComeAfterWatchedPaths,TestLongSummaryWarningsAlwaysFit,TestTenLongSummaryWarningsAllStayWithAShortHead,TestWatchedPathStaysWithTenLongSummaryWarnings,TestSummaryWarningCRLFAndEmpty.internal/gate/report_test.go:TestApplyReportTwoLines,TestApplyReportFifteenLinesShowTen,TestApplyReportInTheFailedMessage,TestApplyWithoutReportIsUnchanged,TestApplyReportLinkIsNotFollowed,TestApplyReportHardLinkIsNotRead,TestApplyReportHostileText.Reviews
The security reviewer and a correctness review ran on the diff. Fixed from them: 10 long hostile
WARN:lines could push out the watched-path warnings (cap per line lowered to 220, test added); a hard link as the report file (now the same inode is required, test added); CRLF and emptyWARN:lines; the head budget for summary warnings. Not changed: the count line of a report longer than 64 KiB says "only its start was read" without a number (enough for the owner); decoyWARN:lines before the owner's real ones (written in THREAT-MODEL.md as left: the owner's summary should print its own warnings first).🤖 Generated with Claude Code