Name the four kinds of breach, the two level rules and the round title's spelling, and table the step-up rules
This commit is contained in:
@@ -29,8 +29,11 @@ def committed_file_breaches(directory: str) -> list[Breach]:
|
||||
known = set(before.splitlines())
|
||||
added = "\n".join(line for line in after.splitlines() if line not in known)
|
||||
breaches += [dataclasses.replace(breach, marked=added) for breach in file_breaches(path, before, added, after)]
|
||||
# The index copy and the work-tree copy of a file can breach the same way; the first stands.
|
||||
return list({(breach.rule, breach.detail): breach for breach in reversed(breaches)}.values())[::-1]
|
||||
# The work-tree copy and the index copy of a file can breach the same way; the first found, the work tree's, stands.
|
||||
first: dict[tuple[str, str], Breach] = {}
|
||||
for breach in breaches:
|
||||
first.setdefault((breach.rule, breach.detail), breach)
|
||||
return list(first.values())
|
||||
|
||||
|
||||
def tracked_names(top: str) -> set[str]:
|
||||
|
||||
@@ -117,4 +117,6 @@ def bash_breaches(command: str, cwd: str, home: str) -> list[Breach]:
|
||||
simples = simple_commands(command, cwd, home)
|
||||
found = commits(simples, home)
|
||||
in_files = [breach for directory in dict.fromkeys(commit.directory for commit in found) for breach in committed_file_breaches(directory)]
|
||||
return command_breaches(command, simples, home) + [breach for commit in found for breach in round_cap_breaches(commit) + todo_breaches(commit.directory)] + in_files
|
||||
round_cap = [breach for commit in found for breach in round_cap_breaches(commit)]
|
||||
todo = [breach for commit in found for breach in todo_breaches(commit.directory)]
|
||||
return command_breaches(command, simples, home) + round_cap + todo + in_files
|
||||
|
||||
@@ -30,5 +30,6 @@ def earlier_titles(directory: str, amends: bool) -> list[str]:
|
||||
default = git_repo.default_ref(directory, guarded=True)
|
||||
titles = default if isinstance(default, Failure) else git_repo.branch_titles(default, directory, timeout=5, guarded=True)
|
||||
if isinstance(titles, Failure):
|
||||
# Counting no earlier title lets the commit through unless its own number is past the cap: a hook that refused here would stop every round commit of an unattended run whose git is slow or whose origin has no default branch.
|
||||
return []
|
||||
return titles[1:] if amends else titles
|
||||
|
||||
@@ -3,7 +3,7 @@ import posixpath
|
||||
import re
|
||||
import typing
|
||||
|
||||
from review_rules.round_titles import CAP, lacks_counts, RELEASE_REVIEW_CAP
|
||||
from review_rules.round_titles import CAP, COUNTS, EXAMPLE, lacks_counts, OPENING, RELEASE_REVIEW_CAP
|
||||
from git_cli.git_command import commits
|
||||
from run_heavy.capped_docker import finds_this_docker
|
||||
from rule_hook.heavy_command import heavy
|
||||
@@ -68,12 +68,12 @@ RULES: dict[RuleName, Rule] = {
|
||||
# The cap holds with no ask, so no marker waives it.
|
||||
"round-cap": Rule(
|
||||
f"a larv-review pass takes at most {CAP} rounds per chunk, and the release review's architecture and principles passes {RELEASE_REVIEW_CAP}, and none after them: the fixes answering its last round merge once the gate passes. A round commit names one of larv-review's passes, so a misspelled one cannot slip past its cap",
|
||||
"a git commit whose message opens `Answer <pass> round <n>:`, counted with the pass's round commits on the branch since the default branch as last fetched, less the one an --amend replaces",
|
||||
f"a git commit whose message opens `{OPENING}`, counted with the pass's round commits on the branch since the default branch as last fetched, less the one an --amend replaces",
|
||||
overridable=False,
|
||||
),
|
||||
"round-title-counts": Rule(
|
||||
"a larv-review round's commit title gives the counts of 🔴 and 🟡 findings the round reported, and how many of them a reviewer marked `[misread]`, at most the two together, such as `Answer stability round 1: 1 🔴, 2 🟡 (1 misread); flag a deleted test`, since score-outcomes counts them",
|
||||
"a git commit whose message opens `Answer <pass> round <n>:`",
|
||||
f"a larv-review round's commit title gives the counts of 🔴 and 🟡 findings the round reported, and how many of them a reviewer marked `[misread]`, at most the two together, such as `{EXAMPLE}`, since score-outcomes counts them",
|
||||
f"a git commit whose message opens `{OPENING}`",
|
||||
),
|
||||
"run-heavy": Rule(
|
||||
"a heavy command, which loads the machine for minutes, runs under ~/.claude/bin/run-heavy, so sessions running at once cannot starve the machine",
|
||||
@@ -158,7 +158,7 @@ def command_breaches(command: str, simples: list[Simple], home: str) -> list[Bre
|
||||
elif len(commit.messages) > 1 or any("\n" in message.strip() for message in commit.messages):
|
||||
breaches.append(Breach("commit-one-line", "pass the message as one -m '<line>', with no heredoc, second -m or newline", commit.directory))
|
||||
if any(lacks_counts(message) for message in commit.messages):
|
||||
breaches.append(Breach("round-title-counts", "open the summary after the round's colon with `<k> 🔴, <m> 🟡 (<j> misread);`, where <j> is at most <k> + <m>", commit.directory))
|
||||
breaches.append(Breach("round-title-counts", f"open the summary after the round's colon with `{COUNTS}`, where <j> is at most <k> + <m>", commit.directory))
|
||||
return breaches
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user