Skip to content

feat: WARN: lines of the summary stay in the head of the question, and apply can add short lines to its report - #54

Merged
groupsky merged 1 commit into
mainfrom
feat/42-summary-warnings
Nov 20, 2026
Merged

groupsky merged 1 commit into
mainfrom
feat/42-summary-warnings

Conversation

@groupsky

Copy link
Copy Markdown
Contributor

Part of #42 (the "Released in a tagged version" box closes with the release).

What changes

  • WARN: lines. A line of the summary output that starts with exactly WARN: 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; a WARN: line with no text is dropped. A summary without WARN: lines gives the same message as 0.2.0.
  • They are not cut for the lists. The body is cut from its end as before (rest of the summary, then files, then commits); "Full:" stays last. When the head itself is too long, path warnings are cut and counted first; the summary warnings stay. Each summary warning is at most 220 characters after the escape (200 plain characters fit), so all 10 always fit and the watched paths (root's own warnings) keep room. Only when the fixed head lines and the summary warnings alone do not fit (a very long broken reason) are the last summary warnings counted, so the message still fits one Telegram message.
  • PULLGATE_REPORT_FILE for apply (not for a rollback, not for health). root makes the empty file (0600) in its per-process trees directory. After apply, 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".
  • DESIGN.md §11 and §12, THREAT-MODEL.md (T3), README.

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 of main), 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 empty WARN: 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); decoy WARN: 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

…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>
@groupsky
groupsky merged commit 47bf7cc into main Nov 20, 2026
10 checks passed
@groupsky
groupsky deleted the feat/42-summary-warnings branch November 20, 2026 08:21
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.

1 participant