Answer product-owner round 1: 0 🔴, 2 🟡 (0 misread); refuse to count a blocking report with no finding headings, and say to count by hand
This commit is contained in:
@@ -44,10 +44,14 @@ def standing_report(folder: pathlib.Path, pass_: str, round_: int) -> pathlib.Pa
|
||||
|
||||
|
||||
def findings_in(report: pathlib.Path) -> Findings | Failure:
|
||||
"""The findings a round's report gives, as round_titles.reported counts them."""
|
||||
"""The findings a round's report gives, as round_titles.reported counts them; a Failure where the report blocks yet heads no finding as review-findings.md → "Report" asks, since its count would then be wrong."""
|
||||
try:
|
||||
return reported(report.read_text(encoding="utf-8"))
|
||||
text = report.read_text(encoding="utf-8")
|
||||
except FileNotFoundError:
|
||||
return Failure(f"no report at {report}")
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read {report}: {failure}")
|
||||
findings = reported(text)
|
||||
if text.lstrip().startswith("BLOCK") and findings.red + findings.yellow == 0:
|
||||
return Failure(f"{report} says BLOCK but opens no finding with `### 🔴` or `### 🟡`; count its findings by hand")
|
||||
return findings
|
||||
|
||||
@@ -40,3 +40,12 @@ class RoundReport(unittest.TestCase):
|
||||
unread = findings_in(standing_report(pathlib.Path(temp), "prose", 1))
|
||||
self.assertIsInstance(unread, Failure)
|
||||
self.assertTrue(unread.reason.startswith(f"could not read {temp}/prose-round-1.md: "), unread.reason)
|
||||
|
||||
def test_names_a_blocking_report_that_heads_no_finding_as_its_format_asks(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
(pathlib.Path(temp) / "prose-round-1.md").write_text("BLOCK\n\n## 🟡 Should fix\n\n### 1. `a.md:1`: worse\n")
|
||||
unread = findings_in(standing_report(pathlib.Path(temp), "prose", 1))
|
||||
self.assertIsInstance(unread, Failure)
|
||||
self.assertEqual(unread.reason, f"{temp}/prose-round-1.md says BLOCK but opens no finding with `### 🔴` or `### 🟡`; count its findings by hand")
|
||||
(pathlib.Path(temp) / "prose-round-1.md").write_text("APPROVE\n")
|
||||
self.assertEqual(findings_in(standing_report(pathlib.Path(temp), "prose", 1)), Findings(0, 0, 0))
|
||||
|
||||
@@ -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 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."""
|
||||
"""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, or says BLOCK without a finding heading, 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} counts `{round_prefix(pass_, round_, found)}`; open the title with that, which `larv-review round-title {pass_}` prints", commit.directory))
|
||||
breaches.append(Breach("round-title-counts", f"{report} counts `{round_prefix(pass_, round_, found)}`; open the title's summary with that, which `larv-review round-title {pass_}` prints", commit.directory))
|
||||
return breaches
|
||||
|
||||
@@ -83,7 +83,7 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h
|
||||
|
||||
- **Round.** A round is one review by a pass's reviewer: the first and each re-entry. The rerun after the architect returns Stage 0 questions ("Architecture" below) and a relaunch one rung up ("Rung up" below) stay in their round.
|
||||
- **Auto-reviewer.** The external auto-reviewer (§4) is a pass of its own, each review it posts, up to the cap, a round. Its count is the number of its reviews on the PR, less its reviews of a `Record the comprehension check:` commit, and `round-count` doesn't list it. A commit that answers one of its rounds takes an ordinary title, not an `Answer <pass> round` one, and a round that didn't change anything gets no commit.
|
||||
- **Count.** Close each round of a pass other than the auto-reviewer with one commit that holds the round's fixes. Title it `Answer <pass> round <n>: <k> 🔴, <m> 🟡 (<j> misread); …`: `<pass>` is the pass's name in lower case, such as `full scan`, `<k>` and `<m>` are the 🔴 and 🟡 findings all the round's reviewers reported, and `<j>` is how many of those they marked `[misread]` (review-findings.md → "Misread"); a reviewer that marks none, such as `/security-review`, adds 0. Example: `Answer stability round 1: 1 🔴, 2 🟡 (1 misread); flag a deleted test`. For a pass an agent under `~/.claude/agents/` reviews, run `~/.claude/bin/larv-review round-title <pass>` and write only the summary after what it prints: the title up to and including its `;`, counted from the round's report. rule-hook's `round-title-counts` refuses a title whose counts differ from that report's. A round that didn't change anything gets an empty commit (`git commit --allow-empty`). Push the commits when §4 runs next, where there is a remote. `~/.claude/bin/larv-review round-count` prints each pass's count and marks a pass at the cap.
|
||||
- **Count.** Close each round of a pass other than the auto-reviewer with one commit that holds the round's fixes. Title it `Answer <pass> round <n>: <k> 🔴, <m> 🟡 (<j> misread); …`: `<pass>` is the pass's name in lower case, such as `full scan`, `<k>` and `<m>` are the 🔴 and 🟡 findings all the round's reviewers reported, and `<j>` is how many of those they marked `[misread]` (review-findings.md → "Misread"); a reviewer that marks none, such as `/security-review`, adds 0. Example: `Answer stability round 1: 1 🔴, 2 🟡 (1 misread); flag a deleted test`. For a pass an agent under `~/.claude/agents/` reviews, run `~/.claude/bin/larv-review round-title <pass>` and write only the summary after what it prints: the title up to and including its `;`, counted from the round's report. Where it exits 1 for want of a report it can count, count the findings by hand, and the hook lets the title through. rule-hook's `round-title-counts` refuses a title whose counts differ from that report's. A round that didn't change anything gets an empty commit (`git commit --allow-empty`). Push the commits when §4 runs next, where there is a remote. `~/.claude/bin/larv-review round-count` prints each pass's count and marks a pass at the cap.
|
||||
- **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or settled in the PR summary per "Comprehension check" → "Places", or, for the prose pass and a pass at its cap, fixed. A stability pass whose round's fixes skip the next round per "Re-entry" → "Mechanical answers" is done once that rule's run is clean. Resolve that round's 🟢s and ❓s per "Findings" too.
|
||||
- **Cap.** A pass takes at most two rounds per chunk, and the release review's architecture and principles passes five; don't ask the user for more. Answer its last round's findings per "Findings": those fixes merge once the gate passes, unreviewed by that pass. rule-hook's `round-cap` refuses a round commit that would take a pass past its cap, and no override waives it. A review the auto-reviewer posts after its second isn't a round: fix none of it and rerun no pass for it, but file a security finding it raises per `~/.claude/CLAUDE.md` → "Working loop", and any other 🔴 in `todo.md`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user