Answer prose round 1: 0 🔴, 10 🟡; one claim per sentence in the CHANGELOG, the rule and Count, accurate comments, and a sorted Tools list

This commit is contained in:
2026-10-13 12:00:25 +02:00
parent 8f1a937005
commit 5b6c497256
12 changed files with 28 additions and 28 deletions
+1 -1
View File
@@ -66,4 +66,4 @@ def full_history() -> Failure | None:
shallow = git("rev-parse", "--is-shallow-repository")
if isinstance(shallow, Failure):
return shallow
return Failure("a shallow clone lacks the history this reads; run `git fetch --unshallow origin`") if shallow.strip() == "true" else None
return Failure("a shallow clone lacks the full history; run `git fetch --unshallow origin`") if shallow.strip() == "true" else None
+1 -1
View File
@@ -187,7 +187,7 @@ def rank(text: str, readme: str, decisions: str) -> Ranked | Failure:
def read_scoring(text: str, lines: list[str], readme: str) -> Scoring | Failure:
if ITEMS_HEADER not in lines and "## Items" not in lines:
return Failure("todo.md is not in the scored-table format; rank_todo.py --help shows a valid one")
# A table without C fails, so no chunk starts on an unscored item; each project scores C before its next todo.md commit.
# A table without C fails, so no chunk starts on an unscored item.
if WITHOUT_C in lines:
return Failure("todo.md's items table has no C column; add one after S, and score each item's C from 1 to 10 per rank_todo.py --help")
goals = readme_goals(readme)
+2 -2
View File
@@ -1,4 +1,4 @@
"""The titles of larv-review's round commits, `Answer <pass> round <n>: <n> 🔴, <n> 🟡; <summary>`: each pass's round count, and the findings the rounds reported."""
"""The titles of larv-review's round commits, `Answer <pass> round <n>: <k> 🔴, <m> 🟡; <summary>`: each pass's round count, and the findings the rounds reported."""
import re
CAP = 3
@@ -21,7 +21,7 @@ def round_counts(titles: list[str]) -> dict[str, int]:
def lacks_counts(title: str) -> bool:
"""Whether title is a round's, without the counts after its colon."""
"""Whether title is a round title without the counts after its colon."""
named = ROUND.match(title)
return named is not None and not FINDINGS.match(title, named.end())
+2 -2
View File
@@ -38,7 +38,7 @@ RULES: dict[RuleName, Rule] = {
"a git, gh or tea command, and any file written",
),
"round-title-counts": Rule(
"a larv-review round's commit title gives the 🔴 and 🟡 findings the round reported, such as `Answer stability round 1: 1 🔴, 2 🟡; flag a deleted test`, since score-outcomes counts them",
"a larv-review round's commit title gives the counts of 🔴 and 🟡 findings the round reported, such as `Answer stability round 1: 1 🔴, 2 🟡; flag a deleted test`, since score-outcomes counts them",
"a git commit whose message opens `Answer <pass> round <n>:`",
),
"todo-rank-check": Rule(
@@ -105,7 +105,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 `<n> 🔴, <n> 🟡;`", commit.directory))
breaches.append(Breach("round-title-counts", "open the summary after the round's colon with `<k> 🔴, <m> 🟡;`", commit.directory))
return breaches
+2 -3
View File
@@ -9,14 +9,14 @@ reads origin as last fetched and says so on stderr.
Git history is the record. A chunk is a merge commit on the default branch's first-parent line
whose change removed items from todo.md, and changed more than todo.md and the records below; it
shipped those items. Each item's guess is its R, S and C in the todo.md the merge's first parent
held, when the chunk began; C only where that todo.md scored one. The chunk measures:
held; C only where that todo.md scored one. The chunk measures:
- lines changed: lines added plus lines deleted against the first parent, leaving out todo.md and
the records tools append to, docs/comprehension-history.md and docs/reading-cost.md;
- files: the files those lines are in;
- review rounds past each pass's first: among the branch's `Answer <pass> round <n>:` commit
titles, each pass's rounds as `larv-review round-count` counts them, less one, summed;
- 🔴 and 🟡 findings: summed over those titles, each opening `<n> 🔴, <n> 🟡` after the colon,
- 🔴 and 🟡 findings: summed over those titles, each opening `<k> 🔴, <m> 🟡` after the colon,
such as `Answer stability round 1: 1 🔴, 2 🟡; flag a deleted test`. Unknown where a round title
lacks the counts, or the branch has no round.
@@ -99,7 +99,6 @@ def measure(merge: str, short: str, merged: str) -> list[Outcome] | Failure:
if isinstance(after, Failure):
return after
items = shipped(before, after)
# Most merges ship nothing; this spares them two more git calls.
if not items:
return []
numstat = git("diff", "--numstat", f"{merge}^1", merge)
+3 -3
View File
@@ -7,7 +7,7 @@ from todo_table import Item, items
from reading_cost.figures import RECORD
from round_titles import round_counts, round_findings
# Least to be measured before a score's medians show: the count the reading-cost trend waits for, which no published standard sets either.
# Fewest single-item chunks a score needs before its medians print: the 10 figures the reading-cost trend waits for; no published standard sets either.
ENOUGH = 10
# The plan, and the records tools append to: none of their lines are the chunk's work.
NOT_WORK = ("todo.md", HISTORY, RECORD)
@@ -15,7 +15,7 @@ NOT_WORK = ("todo.md", HISTORY, RECORD)
@dataclasses.dataclass(frozen=True)
class Outcome:
"""What the merge that shipped an item measured. findings holds the 🔴 and 🟡 counts, None where a round title lacks them."""
"""What the merge that shipped an item measured. findings holds the 🔴 and 🟡 counts, None where a round title lacks them or the branch has no round."""
item: Item
merge: str
merged: str
@@ -26,7 +26,7 @@ class Outcome:
findings: tuple[int, int] | None
# Each score, and the outcome it predicts. Each pass takes a first round whatever the change, so only the rounds after it measure how hard the change was to get right.
# Each pass takes a first round whatever the change, so only the rounds after it measure how hard the change was to get right.
MEASURES: dict[str, tuple[str, typing.Callable[[Outcome], int | None]]] = {
"R": ("🔴 findings", lambda outcome: outcome.findings[0] if outcome.findings else None),
"S": ("lines changed", lambda outcome: outcome.lines),
+1 -1
View File
@@ -6,7 +6,7 @@ from failure import Failure
EXEMPTIONS = ("", "decision", "defect", "principle", "question", "security")
COLUMNS = ("ID", "Release", "Exempt", "Item", "R", "S", "C", "A", "G", "Goals", "Score")
ITEMS_HEADER = "| " + " | ".join(COLUMNS) + " |"
# A table may lack C alone: git history keeps tables written before C joined, which still read.
# Tables in git history from before C joined lack it; items() still parses them, though rank_todo refuses one in a checkout.
WITHOUT_C = "| " + " | ".join(column for column in COLUMNS if column != "C") + " |"