Answer prose round 1: name the override reviewer apart from loop-claude's judge, list the override forms, and say each rule as it holds

This commit is contained in:
2026-10-12 23:29:02 +02:00
parent cf9f6b9e7a
commit 7cf4f54c90
6 changed files with 19 additions and 15 deletions
+12 -7
View File
@@ -8,8 +8,8 @@ subagent. The rules:
action-pin a workflow's or action.yml's `uses:` names a semver tag, such as @v3 or @v3.1.2
commit-one-line git commit takes its message as one -m with no newline
ignorefile-sorted each block of a .*ignore file that an edit leaves unsorted is sorted; a blank
line or comment ends a block
ignorefile-sorted an edit leaves each block of a .*ignore file sorted, unless the block was
unsorted before; a blank line or comment ends a block
image-pin a Dockerfile FROM or COPY --from, or a compose or workflow `image:` or
`container:`, names a full patch version, a date stamp or a digest
no-ai-attribution no Claude or Anthropic co-author or generated-with line, in a file written or
@@ -17,11 +17,16 @@ subagent. The rules:
todo-rank-check a git commit while todo.md has changes, staged or not, needs
rank_todo.py --check to pass on it
The file rules see what an Edit, MultiEdit or Write call writes, not a file a Bash command writes.
action-pin, ignorefile-sorted, image-pin and no-ai-attribution check only what an Edit, MultiEdit or
Write call writes, not a file a Bash command writes.
A call overrides a rule with `# rule-override <rule>: <reason>`: anywhere in a Bash command, such as
a trailing comment; in a file, as a comment line in the text the edit writes, or in Markdown as
`<!-- rule-override <rule>: <reason> -->`. Each override that let a call through is appended to
A call overrides a rule with `# rule-override <rule>: <reason>`:
- anywhere in a Bash command, such as a trailing comment
- in a file, as a comment line in the text the edit writes
- in Markdown, as `<!-- rule-override <rule>: <reason> -->`
Each override that let a call through is appended to
rule-overrides.tsv in the checkout's git directory: UTC time, branch, rule, reason, and the file
written or the command's first line. `rule-hook overrides` prints the lines for the current branch.
@@ -81,7 +86,7 @@ def main(argv: list[str], stdin: str) -> int:
for rule in sorted({breach.rule for breach in blocking}):
details = "; ".join(breach.detail for breach in blocking if breach.rule == rule)
marker = f"<!-- rule-override {rule}: <reason> -->" if markdown else f"# rule-override {rule}: <reason>"
print(f"Blocked by rule {rule}: {details}. The rule: {RULES[rule]}. Where it does not fit this case, add `{marker}` to {where}; larv-review's judge rules on the reason.", file=sys.stderr)
print(f"Blocked by rule {rule}: {details}. The rule: {RULES[rule]}. Where it does not fit this case, add `{marker}` to {where}; larv-review rules on the reason.", file=sys.stderr)
return 2
+3 -4
View File
@@ -3,12 +3,11 @@ import os
import re
import shlex
# Each rule's why, which the block message gives.
RULES = {
"action-pin": "a GitHub or Gitea Action is pinned to a semver tag, such as @v3 or @v3.1.2, never a commit SHA or a branch; SHA-pin only in a pipeline that tests our own specific builds",
"action-pin": "a GitHub or Gitea Action is pinned to a semver tag, such as @v3 or @v3.1.2, never to a branch, and to a commit SHA only in a pipeline that tests our own specific builds",
"commit-one-line": "a commit message is one line, prefixed with the ticket ID when the work has one",
"ignorefile-sorted": "each block of an ignore file is sorted, since its order carries no meaning; where order matters, such as a re-include after its exclude, split the block with a blank line or a comment",
"image-pin": "a container image is pinned to its full patch version, such as node:24.18.1-bookworm-slim, or to a date-stamped tag or an @sha256: digest, so the same commit builds the same image on every day; a bot such as Renovate raises the bumps as reviewable PRs. An image that publishes no three-part tag, such as postgres:16.4, takes an override",
"image-pin": "a container image is pinned to its full patch version, such as node:24.18.1-bookworm-slim, or to a date-stamped tag or an @sha256: digest, so the same commit builds the same image on every day. An image that publishes no three-part tag, such as postgres:16.4, takes an override",
"no-ai-attribution": "no commit, PR, issue comment or file carries a Claude or Anthropic attribution, such as a co-author trailer or a generated-with line",
"todo-rank-check": "while todo.md has changes, staged or not, a git commit waits until ~/.claude/bin/rank_todo.py --check passes on it",
}
@@ -51,7 +50,7 @@ def overrides(text: str) -> tuple[dict[str, str], list[str]]:
def segments(command: str) -> list[list[str]] | None:
"""The command's simple commands as words, each heredoc's body cut to a line break, or None when it does not parse."""
"""The command's simple commands as words, with each heredoc's body dropped, or None when it does not parse."""
lexer = shlex.shlex(HEREDOC.sub(lambda heredoc: heredoc.group(0).split("\n", 1)[0], command), posix=True, punctuation_chars="();<>|&\n")
lexer.whitespace = " \t\r"
lexer.whitespace_split = True