Answer prose round 1: 0 🔴, 8 🟡; say every way the anchors are left out, name what a missing file shows, and untangle the scoring rule's lists

This commit is contained in:
2026-10-16 20:08:14 +02:00
parent e3704cf0ab
commit 3f8f30ab2f
7 changed files with 15 additions and 16 deletions
+3 -4
View File
@@ -4,7 +4,6 @@ from todo_table import cells, LEVELS, parse_ids
from failure import Failure
from score_outcomes.outcomes import Outcome, render
# Where a project names the shipped items that show each level of L, E and I.
ANCHORS_PATH = "docs/score-anchors.md"
# A level, such as `L 1`; every scale tops out below 10.
LEVEL = re.compile(r"([A-Z]) ([1-9])")
@@ -23,7 +22,7 @@ def parse_anchors(text: str) -> Anchors | Failure:
level, ids = LEVEL.fullmatch(pair[0]), parse_ids(pair[1])
if not level or int(level[2]) > LEVELS.get(level[1], 0) or not ids:
scales = ", ".join(f"{name} 1 to {top}" for name, top in LEVELS.items())
return Failure(f"{ANCHORS_PATH} cannot read the row {row}; each row names a level, {scales}, and the IDs of shipped items, such as | L 1 | 12, 14 |")
return Failure(f"cannot read the row {row} in {ANCHORS_PATH}; each row names a level, {scales}, and the IDs of shipped items, such as | L 1 | 12, 14 |")
if pair[0] in dict(found):
return Failure(f"{ANCHORS_PATH} names {pair[0]} twice")
found.append((pair[0], ids))
@@ -31,11 +30,11 @@ def parse_anchors(text: str) -> Anchors | Failure:
def anchor_lines(found: Anchors | Failure, outcomes: list[Outcome]) -> list[str]:
"""Each level, then each of its anchors with what its chunk measured; why none shows where the file cannot be read, and where to name them where it names no level."""
"""Each level, then each of its anchors with what its chunk measured. Where the file cannot be read, one line saying why; where it names no level, one line saying how to choose anchors."""
if isinstance(found, Failure):
return [f"- None: {found.reason}"]
if not found:
return [f"- None: the project's {ANCHORS_PATH} names no level; ~/.claude/rules/todo-items.md says how to choose them."]
return [f"- None: the project has no {ANCHORS_PATH}, or it names no level; ~/.claude/rules/todo-items.md says how to choose anchors."]
by_id = {outcome.item.id: outcome for outcome in outcomes}
lines = []
for level, ids in found:
+4 -4
View File
@@ -31,8 +31,8 @@ measured, which items shipped with it, and its tagline.
Then the project's anchors, the shipped items its docs/score-anchors.md names for each level of L,
E and I, read from the checkout's working tree, each line as above, or that no merge shipped it. A
row that names no level on its scale, a level named twice, or an Items cell that is not a list of
IDs leaves the anchors out, saying why, and exits 1 after the rest of the report.
file that cannot be read, a row that does not hold a level on its scale and a list of IDs, or a
level named twice leaves the anchors out, saying why.
Then the median of the outcome R and S each predict at each value they were guessed at: R against
🔴 findings, S against lines changed. And how well L, E and I each order chunks by review rounds
@@ -42,7 +42,8 @@ item, since a chunk measures all its items at once, and reports a score only onc
hold it and its outcomes.
Exit 1, saying why, on bad arguments, when git cannot start, finds no checkout or reads a shallow
clone, or the default branch cannot be read.
clone, or the default branch cannot be read; or, after the rest of the report, when the anchors are
left out.
"""
import pathlib
import re
@@ -79,7 +80,6 @@ def main(argv: list[str]) -> int:
return failed(outcomes)
anchored = read_anchors()
print(report_text(outcomes, anchored, dict(zip(GIVEN, map(int, argv))) if argv else None))
# Anchors the tool cannot read leave the rest of the report standing, and still fail the run.
return failed(anchored) if isinstance(anchored, Failure) else 0
+1 -1
View File
@@ -231,7 +231,7 @@ def parse_scores(id_: str, named: dict[str, str], names: tuple[str, ...]) -> dic
def parse_ids(cell: str) -> tuple[int, ...] | None:
"""The item IDs a cell lists, such as `12, 14`, none where it is empty; None where it holds anything else."""
"""The item IDs a cell lists, such as `12, 14`: an empty tuple where the cell is empty, None where it holds anything else."""
if not re.fullmatch(r"([0-9]+(, [0-9]+)*)?", cell):
return None
return tuple(int(id_) for id_ in cell.split(", ") if id_)