Answer prose round 1: 0 🔴, 6 🟡 (0 misread); reword the round-title help, Count rule, refusal and docstrings

This commit is contained in:
2026-11-17 08:25:45 +01:00
parent 548c4ea125
commit 8fa05d9551
8 changed files with 16 additions and 15 deletions
+8 -7
View File
@@ -142,13 +142,14 @@ it. It exits 1 when the pass takes no more rounds, when `project-config` fails i
the principles or standards folder is not a folder with a file in it, or, with --rerun, when the
report that asked is missing.
round-title takes a pass as reviewer-header does, and prints how the commit that answers the pass's
next round opens its title, up to and including the `;` before the summary, such as `Answer prose
round 1: 0 🔴, 2 🟡 (0 misread);`. It counts the findings in the round's report in the review
folder, or in its rerun's where there is one: each line that opens `### 🔴` or `### 🟡`, and of
them each whose mark is followed by ` [misread]`. rule-hook's round-title-counts refuses a round
title whose counts differ from it. It exits 1 when the pass takes no more rounds or the report is
missing.
round-title takes a pass as reviewer-header does. It prints how the commit that answers the pass's
unanswered round opens its title, after any prefix the project's commit-title template adds, up to
and including the `;` before the summary, such as `Answer prose round 1: 0 🔴, 2 🟡 (0 misread);`. It
counts the findings in the round's report in the review folder, or in its rerun's where there is
one: each line that opens `### 🔴` or `### 🟡`, and of them each whose mark is followed by
`[misread]`. rule-hook's round-title-counts refuses a round title whose counts differ from that
report's. It exits 1 when the pass takes no more rounds, or the report is missing, unreadable or
says BLOCK without such a line.
reviewer-context is the SubagentStart hook. It reads the hook's input on stdin. For a reviewer
whose definition under ~/.claude/agents/ has `omitClaudeMd: true`, and so starts without CLAUDE.md,
+1 -1
View File
@@ -33,7 +33,7 @@ def round_report(folder: pathlib.Path, pass_: str, round_: int) -> pathlib.Path:
def rerun_report(asked: pathlib.Path) -> pathlib.Path:
"""The report of the rerun one rung up that the report asked asks for, which stands in its place."""
"""The report of the rerun one rung up that `asked` asks for. It stands in place of `asked`."""
return asked.with_name(asked.stem + "-rerun.md")
+1 -1
View File
@@ -1,4 +1,4 @@
"""The titles of larv-review's round commits, `Answer <pass> round <n>: <k> 🔴, <m> 🟡 (<j> misread); <summary>`: each pass's round count against its cap, and the findings the rounds reported, as titled and as the round's report gives them. <j> counts the 🔴 and 🟡 findings a reviewer marked `[misread]`."""
"""The titles of larv-review's round commits, `Answer <pass> round <n>: <k> 🔴, <m> 🟡 (<j> misread); <summary>`: each pass's round count against its cap, and the findings each round reported, as its title counts them and as its report does. <j> counts the 🔴 and 🟡 findings a reviewer marked `[misread]`."""
import dataclasses
import re
+2 -2
View File
@@ -11,7 +11,7 @@ from project_config.templates import Titles
def round_report_breaches(commit: CommitCall, titles: Titles, home: pathlib.Path) -> list[Breach]:
"""A breach for each round title, read as its summary in titles, whose counts differ from those its round's report gives. A title without all three counts is title_breaches' to refuse. A round whose report is missing goes through, as does every round where git cannot name the commit's checkout within 5 seconds."""
"""A breach for each round title whose counts differ from those its round's report gives. The round title is the commit title's summary, as `titles` cuts it. A title without all three counts is title_breaches' to refuse. A round whose report is missing or unreadable goes through, as does every round where git cannot name the commit's checkout within 5 seconds."""
summaries = [titles.summary(message.strip()) for message in commit.messages]
rounds = [(named, counts) for summary in summaries if (named := ROUND.match(summary)) and (counts := title_counts(summary)) and counts.misread is not None]
if not rounds:
@@ -26,5 +26,5 @@ def round_report_breaches(commit: CommitCall, titles: Titles, home: pathlib.Path
report = standing_report(folder, pass_, round_)
found = findings_in(report)
if not isinstance(found, Failure) and found != counts:
breaches.append(Breach("round-title-counts", f"{report} reports `{round_prefix(pass_, round_, found)}`; open the title so, as `larv-review round-title {pass_}` prints it before the round's commit", commit.directory))
breaches.append(Breach("round-title-counts", f"{report} counts `{round_prefix(pass_, round_, found)}`; open the title with that, which `larv-review round-title {pass_}` prints", commit.directory))
return breaches
+1 -1
View File
@@ -1067,7 +1067,7 @@ class Hook(unittest.TestCase):
wrong = commit("Answer stability round 1: 1 🔴, 2 🟡 (0 misread); fix")
self.assertEqual(wrong.returncode, 2)
self.assertIn(f"Blocked by rule round-title-counts: {folder}/stability-round-1.md reports `Answer stability round 1: 1 🔴, 1 🟡 (1 misread);`", wrong.stderr)
self.assertIn(f"Blocked by rule round-title-counts: {folder}/stability-round-1.md counts `Answer stability round 1: 1 🔴, 1 🟡 (1 misread);`", wrong.stderr)
self.assertEqual(commit("Answer stability round 1: 1 🔴, 1 🟡 (1 misread); fix").returncode, 0)
self.assertEqual(commit("Answer prose round 1: 0 🔴, 3 🟡 (0 misread); fix").returncode, 0, "a round whose report is missing goes through")
self.assertEqual(commit("Answer stability round 1: 1 🔴, 2 🟡 (0 misread); fix # rule-override round-title-counts: the reviewer wrote its findings as a list").returncode, 0)