Answer stability round 1: 1 🔴, 6 🟡 (0 misread); read every title through both templates, hold a title to its template only on an item's branch, and fail on a config fault

This commit is contained in:
2026-11-14 01:47:41 +01:00
parent 1692679985
commit f98e8a84dd
42 changed files with 537 additions and 256 deletions
+5 -10
View File
@@ -1,25 +1,20 @@
import functools
import pathlib
from rule_hook.rules import Breach
from review_rules.round_titles import cap, past_cap, round_counts, round_pass
from project_config.main import commit_title
from git_cli.git_command import CommitCall
from failure import Failure
from git_cli import git_repo
from review_rules.review_passes import PASSES
from project_config import templates
from project_config.templates import Titles
def round_cap_breaches(commit: CommitCall, home: pathlib.Path) -> list[Breach]:
"""A breach where the commit's title names no pass, or takes its pass past the cap, counted with the branch's earlier round commits. Each title is read as its summary in the project's `commit-title` template."""
template = commit_title(commit.directory, home, functools.partial(git_repo.git, guarded=True))
summaries = [templates.summary_of(template, message.strip()) for message in commit.messages]
def round_cap_breaches(commit: CommitCall, titles: Titles) -> list[Breach]:
"""A breach where the commit's title names no pass, or takes its pass past the cap, counted with the branch's earlier round commits. Each title is read as its summary in titles, the project's title templates."""
summaries = [titles.summary(message.strip()) for message in commit.messages]
named = [(name, summary) for summary in summaries if (name := round_pass(summary))]
unknown = [Breach("round-cap", f"`{name}` names no larv-review pass, so its rounds would never reach a cap; name one of: {', '.join(PASSES)}", commit.directory) for name, _ in named if name not in PASSES]
if unknown or not named:
return unknown
earlier = [templates.summary_of(template, title) for title in earlier_titles(commit.directory, commit.amends)]
earlier = [titles.summary(title) for title in earlier_titles(commit.directory, commit.amends)]
return [Breach("round-cap", refusal(name, message, earlier), commit.directory) for name, message in named if past_cap(message, earlier)]