Answer architecture round 5: return the heading as a dataclass, read the Mean line as its own field, mark an entry paired explicitly, move metric-bench's path resolution back to metric_bench, and split the scoring trigger into named steps

This commit is contained in:
2026-10-09 01:44:53 +02:00
parent efed78bf5e
commit c1133edf39
9 changed files with 143 additions and 92 deletions
+16 -33
View File
@@ -1,5 +1,4 @@
import dataclasses
import os
import re
import time
@@ -36,6 +35,17 @@ class Entry:
ruling: str | None
places: list[Place]
@property
def paired(self) -> bool:
return self.against is not None
@dataclasses.dataclass(frozen=True)
class Heading:
title: str
commit: str
against: str | None
@dataclasses.dataclass(frozen=True)
class HistoryChange:
@@ -45,13 +55,6 @@ class HistoryChange:
after: str
@dataclasses.dataclass(frozen=True)
class ScoringRun:
heading: str
commit: str
places: list[Place]
def entries(history: str) -> list[Entry]:
"""Each paired ruling and scoring run in a comprehension history, in the order the file holds them; a section whose heading names no commit is left out."""
found = []
@@ -63,11 +66,6 @@ def entries(history: str) -> list[Entry]:
return found
def scoring_runs(history: str) -> list[ScoringRun]:
"""Each scoring run, with the places its seats named, as they wrote them; paired rulings name what changed, not what is hard, and are left out."""
return [ScoringRun(entry.heading, entry.commit, entry.places) for entry in entries(history) if entry.against is None]
def seat_places(body: str) -> list[Place]:
places = []
listing = False
@@ -92,23 +90,7 @@ def bullet_places(bullet: str) -> list[Place]:
return places
def resolved(places: list[Place], tracked: list[str]) -> tuple[list[Place], list[Place]]:
"""Entries written before paths were written from the repository's root shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place resolved before it; a place naming no file, or several, is dropped. Returns the resolved places and the dropped ones."""
found = []
dropped = []
before = ""
for place in places:
candidates = [place.path] if place.path in tracked else [path for path in tracked if path.endswith("/" + place.path)]
nearest = [path for path in candidates if path.startswith(os.path.dirname(before) + "/")] if len(candidates) > 1 else candidates
if len(nearest) == 1:
before = nearest[0]
found.append(Place(before, place.name))
else:
dropped.append(place)
return found, dropped
def heading(at: float, read: str, paired: bool, moved: bool) -> re.Match[str] | Failure:
def heading(at: float, read: str, paired: bool, moved: bool) -> Heading | Failure:
"""An entry's heading, matched by HEADING: when the seats finished, in UTC, and what they read. A run moved from a decision entry opens instead with the date or time that entry gives."""
if moved and not DATED.match(read):
return Failure(f"a seats file holding a {MEAN} line alone opens with YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ, then `, `: {read}")
@@ -116,7 +98,7 @@ def heading(at: float, read: str, paired: bool, moved: bool) -> re.Match[str] |
return Failure(f"only a seats file holding a {MEAN} line alone opens with a date: {read}")
title = read if moved else f"{time.strftime(STAMP, time.gmtime(at))}, {read}"
if (named := HEADING.match(title)) and bool(named.group(4)) == paired:
return named
return Heading(title, named.group(3), named.group(4))
return Failure(f"the seats file's first line is not `<PR or branch> at <commit>{', against <base>' if paired else ''}`: {read}")
@@ -137,8 +119,9 @@ def vote_text(seat: Seat, counted: str) -> str:
def scoring_entry(title: str, seats: list[Seat], scores: dict[str, list[str]], means: list[str]) -> str:
rows = [[seat, *values] for seat, values in scores.items() if seat != MEAN] + [[MEAN, *means]]
labels = [(f"{seat.name}, {RESTRUCTURE_FIRST if seat.name == ARCHITECT else HARDEST_FIRST}:", seat.places) for seat in seats if seat.name != MEAN]
"""A scoring run's entry; a run moved from a decision entry has its means alone."""
rows = [[seat, *values] for seat, values in scores.items()] + [[MEAN, *means]]
labels = [(f"{seat.name}, {RESTRUCTURE_FIRST if seat.name == ARCHITECT else HARDEST_FIRST}:", seat.places) for seat in seats]
return entry_text(title, [], [["Seat", *DIMENSIONS], *rows], labels)
+15 -12
View File
@@ -8,10 +8,10 @@ branch, or else the local main or master, as the default branch. When the fetch
reads origin as last fetched and says so on stderr; the other two exit 1. The history is
docs/comprehension-history.md in the checkout.
ruling-base prints the commit a paired ruling reads against, then a line saying how it found it.
The base is the default branch's newest merged change that adds a scoring run to the history, or
whose last added paired ruling, by heading time, is better. A merge commit counts as one change
against its first parent. With no such change, the base is the one the history's first paired
ruling-base prints the commit a paired ruling reads against, then which of these found it. The last
measured commit is the default branch's newest merged change that adds a scoring run to the
history, or whose last added paired ruling, by heading time, is better; a merge commit counts as
one change against its first parent. With none, the base is the one the history's first paired
ruling names; with no ruling either, it is the merge base of HEAD and the default branch.
round-count prints each pass's count: the highest <n> among the titles opening
@@ -73,7 +73,7 @@ import typing
from larv_review.history import appended, heading, ruling_entry, scoring_entry, vote_text
from larv_review.rules import base, CAP, FLOOR, means, PASSES, plan_items, round_counts, ruling, scoring_run_due, under_floor, votes
from larv_review.git import commit_exists, default_branch, file_at, git, HISTORY, history_changes, landed_since_release, top
from larv_review.seats import DIMENSIONS, MEAN, Report, report, scores
from larv_review.seats import DIMENSIONS, MEAN, Report, report, score_line, scores
from failure import Failure
from rank_todo import ITEMS_HEADER
from file_writes import replace_file
@@ -128,13 +128,13 @@ def ruling_base(default: str) -> Failure | None:
history = file_at(default, HISTORY)
if isinstance(history, Failure):
return history
if found := base(changes, history, default):
if found := base(changes, history):
print("\n".join(found))
return None
merge_base = git("merge-base", "HEAD", default)
if isinstance(merge_base, Failure):
return merge_base
print(f"{merge_base.strip()}\nNo merged change on {default} adds a scoring run or a paired ruling; the merge base of HEAD and {default}.")
print(f"{merge_base.strip()}\nthe merge base of HEAD and {default}")
return None
@@ -197,10 +197,13 @@ def record_scoring(seats_file: pathlib.Path) -> Failure | None:
if isinstance(read, Failure):
return read
title, given = read
found = scores(given.seats)
found = scores(given.seats) if given.moved_mean is None else {}
if isinstance(found, Failure):
return found
mean = means(found)
moved = [] if given.moved_mean is None else score_line(MEAN, given.moved_mean)
if isinstance(moved, Failure):
return moved
mean = means(list(found.values()) or [moved])
under = under_floor(mean)
print(f"Means: {', '.join(f'{name} {value}' for name, value in zip(DIMENSIONS, mean))}. {f'Under the floor of {FLOOR}: ' + ', '.join(under) if under else f'None under the floor of {FLOOR}'}.")
return append(scoring_entry(title, given.seats, found, [str(value) for value in mean]))
@@ -214,12 +217,12 @@ def read_seats(seats_file: pathlib.Path, paired: bool) -> tuple[str, Report] | F
return Failure(f"could not read {seats_file}: {failure}")
if isinstance(given, Failure):
return given
named = heading(time.time(), given.read, paired, [seat.name for seat in given.seats] == [MEAN])
named = heading(time.time(), given.read, paired, given.moved_mean is not None)
if isinstance(named, Failure):
return named
if unknown := [commit for commit in named.group(3, 4) if commit and not commit_exists(commit)]:
if unknown := [commit for commit in (named.commit, named.against) if commit and not commit_exists(commit)]:
return Failure(f"the seats file names {', '.join(unknown)}, which is no commit in this checkout")
return named.group(0), given
return named.title, given
def append(entry: str) -> Failure | None:
+21 -16
View File
@@ -41,9 +41,9 @@ def ruling(counted: list[str]) -> str | None:
return "same"
def means(scores: dict[str, list[str]]) -> list[decimal.Decimal]:
"""The seats' mean of each score, in the order each seat's scores are, rounded half up to two decimals."""
return [mean([decimal.Decimal(score) for score in column]) for column in zip(*scores.values())]
def means(lines: list[list[str]]) -> list[decimal.Decimal]:
"""The mean of each score across the lines, in DIMENSIONS' order, rounded half up to two decimals."""
return [mean([decimal.Decimal(score) for score in column]) for column in zip(*lines)]
def mean(values: list[decimal.Decimal]) -> decimal.Decimal:
@@ -68,23 +68,23 @@ def measured_commit(changes: list[HistoryChange]) -> str | None:
for change in changes:
held = {entry.heading for entry in entries(change.before)}
added = [entry for entry in entries(change.after) if entry.heading not in held]
rulings = sorted((entry for entry in added if entry.against), key=lambda entry: entry.time)
if any(entry.against is None for entry in added) or rulings and rulings[-1].ruling == "better":
rulings = sorted((entry for entry in added if entry.paired), key=lambda entry: entry.time)
if any(not entry.paired for entry in added) or rulings and rulings[-1].ruling == "better":
return change.commit
return None
def first_ruling(history: str) -> Entry | None:
rulings = sorted((entry for entry in entries(history) if entry.against), key=lambda entry: entry.time)
rulings = sorted((entry for entry in entries(history) if entry.paired), key=lambda entry: entry.time)
return rulings[0] if rulings else None
def base(changes: list[HistoryChange], history: str, default: str) -> tuple[str, str] | None:
"""The commit a paired ruling reads against, and how it was found: the last measured commit, else the base the history's first paired ruling names; None when neither exists, so the base is the merge base of HEAD and the default branch. history is the default branch's."""
def base(changes: list[HistoryChange], history: str) -> tuple[str, str] | None:
"""The commit a paired ruling reads against, and which fallback found it; None leaves the merge base of HEAD and the default branch. history is the default branch's."""
if found := measured_commit(changes):
return found, f"The newest merged change on {default} that adds a scoring run to the history, or whose last added paired ruling is better."
return found, "the last measured commit"
if (first := first_ruling(history)) and first.against:
return first.against, f"No merged change on {default} adds a scoring run or a better ruling; the base its first paired ruling names."
return first.against, "the base the history's first paired ruling names"
return None
@@ -103,16 +103,21 @@ def plan_items(todo: str) -> list[Item] | Failure:
def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed: bool) -> list[str] | Failure:
"""Why the chunk takes a scoring run, empty when it does not. before is the default branch's plan, after the chunk's, ships the IDs it ships, and landed whether the default branch holds a commit after the newest release tag. A release has work landed towards it when the chunk ships one of its items, or when it is the earliest release in before and landed holds."""
"""Why the chunk takes a scoring run, empty when it does not. before is the default branch's plan, after the chunk's, ships the IDs it ships, and landed whether the default branch holds a commit after its newest release tag. Work has landed towards an emptied release when the chunk ships one of its items, or when it is the next release, the earliest before names, and landed holds."""
plan = {item.id: item for item in before + after}
if unknown := sorted(set(ships) - set(plan)):
return Failure(f"neither plan holds item {', '.join(map(str, unknown))}")
shipped = [plan[id_] for id_ in ships]
reasons = [f"ships item {item.id}, which names the comprehension floor" for item in shipped if "comprehension floor" in item.tagline.lower()]
left = {item.release for item in after if item.id not in ships}
named = {item.release for item in before} | {item.release for item in shipped}
earliest = min((item.release for item in before), default=None)
for release in sorted(named - left):
if any(item.release == release for item in shipped) or release == earliest and landed:
next_release = min((item.release for item in before), default=None)
for release in emptied(before, after, shipped):
if any(item.release == release for item in shipped) or (release == next_release and landed):
reasons.append(f"leaves release {'.'.join(map(str, release))} with no plan item")
return reasons
def emptied(before: list[Item], after: list[Item], shipped: list[Item]) -> list[tuple[int, int, int]]:
"""Each release the default branch's plan or a shipped item names that the chunk's plan, less the shipped items, names no longer."""
named = {item.release for item in before + shipped}
left = {item.release for item in after if item.id not in {ship.id for ship in shipped}}
return sorted(named - left)
+29 -15
View File
@@ -15,7 +15,7 @@ SENIOR = "Maintainability senior"
FIRST_SEATS = (MID, ARCHITECT)
SCORING_SEATS = (JUNIOR, MID, SENIOR, ARCHITECT)
SEAT_LINE = re.compile(rf"^({'|'.join((*SCORING_SEATS, MEAN))}): (.+)$")
SEAT_LINE = re.compile(rf"^({'|'.join(SCORING_SEATS)}): (.+)$")
SPLIT_SEATS = (SENIOR, JUNIOR)
@@ -28,9 +28,10 @@ class Seat:
@dataclasses.dataclass(frozen=True)
class Report:
"""A seats file: what the seats read, `<PR or branch> at <commit>`, with `, against <base>` for a paired ruling, then each seat's line and its places."""
"""A seats file: what the seats read, `<PR or branch> at <commit>`, with `, against <base>` for a paired ruling, then each seat's line and its places, or, for a run moved from a decision entry, its Mean line alone."""
read: str
seats: list[Seat]
moved_mean: str | None
def report(text: str) -> Report | Failure:
@@ -38,8 +39,13 @@ def report(text: str) -> Report | Failure:
if not lines:
return Failure("the seats file is empty; its first line names what the seats read: <PR or branch> at <commit>")
seats: list[Seat] = []
moved_mean = None
for line in lines[1:]:
if seat := SEAT_LINE.match(line):
if line.startswith(f"{MEAN}: ") and not seats and moved_mean is None:
moved_mean = line[len(MEAN) + 2:].strip()
elif moved_mean is not None:
return Failure(f"a {MEAN} line stands alone in its seats file: {line}")
elif seat := SEAT_LINE.match(line):
if seat.group(1) in [known.name for known in seats]:
return Failure(f"{seat.group(1)} appears twice in the seats file")
seats.append(Seat(seat.group(1), seat.group(2).strip(), []))
@@ -48,22 +54,30 @@ def report(text: str) -> Report | Failure:
elif seats and seats[-1].places and line.startswith(" "):
seats[-1].places[-1] += " " + line.strip()
else:
return Failure(f"the seats file has a line that is neither a seat's line, opening with one of {', '.join((*SCORING_SEATS, MEAN))} and a colon, nor one of its places: {line}")
return Report(lines[0].strip(), seats)
return Failure(f"the seats file has a line that is neither a seat's line, opening with one of {', '.join(SCORING_SEATS)} and a colon, nor one of its places: {line}")
return Report(lines[0].strip(), seats, moved_mean)
def scores(seats: list[Seat]) -> dict[str, list[str]] | Failure:
"""Each seat's five scores as written, in DIMENSIONS' order: the four seats', or the Mean line's alone."""
if [seat.name for seat in seats] not in (list(SCORING_SEATS), [MEAN]):
"""Each seat's five scores as written, in DIMENSIONS' order."""
if [seat.name for seat in seats] != list(SCORING_SEATS):
return Failure(f"a scoring run's seats are {', '.join(SCORING_SEATS)}, in that order, or a {MEAN} line alone; the file has {', '.join(seat.name for seat in seats) or 'none'}")
found = {}
for seat in seats:
if not (written := SCORES.fullmatch(seat.said)):
return Failure(f"{seat.name}'s line is not {', '.join(name + ' <score>' for name in DIMENSIONS)}: {seat.said}")
values = [decimal.Decimal(value) for value in written.groups()]
if not all(1 <= value <= 10 for value in values):
return Failure(f"{seat.name}'s scores are not each from 1 to 10: {seat.said}")
if values[-1] > min(values[:-1]) + 1:
return Failure(f"{seat.name}'s overall exceeds their lowest dimension by more than 1; ask the seat to rescore: {seat.said}")
found[seat.name] = list(written.groups())
values = score_line(seat.name, seat.said)
if isinstance(values, Failure):
return values
found[seat.name] = values
return found
def score_line(name: str, said: str) -> list[str] | Failure:
"""A line's five scores as written, each from 1 to 10 and the overall at most 1 above the lowest dimension."""
if not (written := SCORES.fullmatch(said)):
return Failure(f"{name}'s line is not {', '.join(score + ' <score>' for score in DIMENSIONS)}: {said}")
values = [decimal.Decimal(value) for value in written.groups()]
if not all(1 <= value <= 10 for value in values):
return Failure(f"{name}'s scores are not each from 1 to 10: {said}")
if values[-1] > min(values[:-1]) + 1:
return Failure(f"{name}'s overall exceeds the lowest dimension by more than 1; ask the seat to rescore: {said}")
return list(written.groups())
+17
View File
@@ -1,6 +1,7 @@
from typing import Callable
import collections
import dataclasses
import os
import statistics
from larv_review.history import Place
@@ -81,3 +82,19 @@ def top_k(named: list[int], rest: list[int]) -> float:
def medians(runs: list[RunScores]) -> dict[str, Score]:
return {metric: Score(statistics.median(run.scores[metric].auc for run in runs), statistics.median(run.scores[metric].top_k for run in runs), all(run.scores[metric].constant for run in runs)) for metric in METRICS}
def resolved(places: list[Place], tracked: list[str]) -> tuple[list[Place], list[Place]]:
"""Entries written before paths were written from the repository's root shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place resolved before it; a place naming no file, or several, is dropped. Returns the resolved places and the dropped ones."""
found = []
dropped = []
before = ""
for place in places:
candidates = [place.path] if place.path in tracked else [path for path in tracked if path.endswith("/" + place.path)]
nearest = [path for path in candidates if path.startswith(os.path.dirname(before) + "/")] if len(candidates) > 1 else candidates
if len(nearest) == 1:
before = nearest[0]
found.append(Place(before, place.name))
else:
dropped.append(place)
return found, dropped
+4 -4
View File
@@ -34,10 +34,10 @@ import statistics
import subprocess
import sys
from metric_bench.bench import bench, co_changed, medians, METRICS, RunScores, Score
from metric_bench.bench import bench, co_changed, medians, METRICS, resolved, RunScores, Score
from larv_review.history import entries, Entry
from failure import Failure
from metric_bench.python_units import measured, python_units, Unit
from larv_review.history import resolved, scoring_runs, ScoringRun
def main(argv: list[str]) -> int:
@@ -81,7 +81,7 @@ def bench_runs(text: str, top: str) -> tuple[list[tuple[str, RunScores]], list[s
"""Each scored run's heading and scores, and a note for each run skipped or not scored and each file left out."""
rows = []
notes = []
for run in scoring_runs(text):
for run in [entry for entry in entries(text) if not entry.paired]:
if isinstance(missing := git(["cat-file", "-e", f"{run.commit}^{{commit}}"], top), Failure):
notes.append(f"Skipped, its commit is not in {top}: {run.heading} ({missing.reason})")
continue
@@ -101,7 +101,7 @@ def noted(notes: list[str]) -> str:
return "\n\n" + "\n".join(notes) if notes else ""
def run_scores(run: ScoringRun, top: str) -> tuple[RunScores | None, list[str]] | Failure:
def run_scores(run: Entry, top: str) -> tuple[RunScores | None, list[str]] | Failure:
"""The run's scores, and why each file that does not parse was left out."""
listed = git(["ls-tree", "-r", "-z", "--name-only", run.commit], top)
if isinstance(listed, Failure):
+9 -9
View File
@@ -9,12 +9,12 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from larv_review.history import appended, entries, HistoryChange, Place, ruling_entry, scoring_runs
from larv_review.history import appended, entries, HistoryChange, Place, ruling_entry
from larv_review.rules import base, first_ruling, means, measured_commit, plan_items, round_counts, ruling, scoring_run_due, under_floor, votes
from failure import Failure
from test_loop_claude_black_box import host_env
from rank_todo import Item
from larv_review.seats import report, scores, Seat
from larv_review.seats import report, score_line, scores, Seat
TOOL = pathlib.Path(__file__).resolve().parent / "larv-review"
SCORING = "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\n| Seat | Overall |\n|---|---|\n| Mean | 7.00 |\n"
@@ -78,10 +78,10 @@ class Seats(unittest.TestCase):
self.assertIsInstance(scores(seats[:3]), Failure)
self.assertIsInstance(scores([*seats[:3], Seat("Inherited architect", line.replace("Overall 7", "Overall 8"), [])]), Failure)
self.assertIsInstance(scores([*seats[:3], Seat("Inherited architect", line.replace("Shape 7", "Shape 11"), [])]), Failure)
self.assertEqual(scores([Seat("Mean", "Navigation 7.38, Locality 7.38, Shape 8, Self-sufficiency 8, Overall 8.38", [])])["Mean"][-1], "8.38")
self.assertEqual(score_line("Mean", "Navigation 7.38, Locality 7.38, Shape 8, Self-sufficiency 8, Overall 8.38")[-1], "8.38")
def test_rounds_each_mean_half_up_and_names_each_under_the_floor(self):
found = means({"a": ["7.5", "6.5", "7", "7", "7"], "b": ["7.5", "7", "7", "6.5", "7"], "c": ["7", "6.5", "7", "6.5", "6.5"], "d": ["7.5", "6.5", "7", "6.5", "7"]})
found = means([["7.5", "6.5", "7", "7", "7"], ["7.5", "7", "7", "6.5", "7"], ["7", "6.5", "7", "6.5", "6.5"], ["7.5", "6.5", "7", "6.5", "7"]])
self.assertEqual([str(mean) for mean in found], ["7.38", "6.63", "7.00", "6.63", "6.88"])
self.assertEqual(under_floor(found), ["Locality 6.63", "Self-sufficiency 6.63", "Overall 6.88"])
self.assertEqual(under_floor([decimal.Decimal("7.00")] * 5), [])
@@ -98,7 +98,7 @@ class History(unittest.TestCase):
found = entries(history)
self.assertEqual([(entry.commit, entry.against, entry.ruling) for entry in found], [("aaaaaaa", None, None), ("bbbbbbb", "aaaaaaa", "worse")])
self.assertEqual(found[1].places, [Place("bin/a.py", "f"), Place("bin/a.py", "g")])
self.assertEqual([run.commit for run in scoring_runs(history)], ["aaaaaaa"])
self.assertEqual([entry.paired for entry in found], [False, True])
class Base(unittest.TestCase):
@@ -115,9 +115,9 @@ class Base(unittest.TestCase):
def test_falls_back_to_the_first_rulings_base_then_to_none(self):
ruled = paired("2026-10-08T13:00:00Z", "worse")
self.assertEqual(base([HistoryChange("c", "", ruled)], ruled, "main"), ("aaaaaaa", "No merged change on main adds a scoring run or a better ruling; the base its first paired ruling names."))
self.assertIsNone(base([], "", "main"))
self.assertEqual(base([HistoryChange("c", "", SCORING)], SCORING, "main")[0], "c")
self.assertEqual(base([HistoryChange("c", "", ruled)], ruled), ("aaaaaaa", "the base the history's first paired ruling names"))
self.assertIsNone(base([], ""))
self.assertEqual(base([HistoryChange("c", "", SCORING)], SCORING), ("c", "the last measured commit"))
def test_finds_the_earliest_ruling_by_its_time(self):
ruled = first_ruling(paired("2026-10-08T14:00:00Z", "same", "ccccccc") + paired("2026-10-08T13:00:00Z", "worse"))
@@ -259,7 +259,7 @@ class LarvReviewTool(unittest.TestCase):
text = (self.checkout / "docs" / "comprehension-history.md").read_text()
self.assertIn("| Mean | 7.00 | 6.50 | 7.00 | 6.50 | 7.00 |", text)
self.assertIn("Inherited architect, would restructure first:", text)
self.assertEqual([run.places for run in scoring_runs(text)], [[Place("bin/a.py", "f")] * 4])
self.assertEqual([entry.places for entry in entries(text)], [[Place("bin/a.py", "f")] * 4])
def test_refuses_a_ruling_file_that_names_no_base_or_a_commit_the_checkout_lacks(self):
ran = self.run_tool("record-ruling", self.seats_file(f"PR #2 at {self.start}\n\nMid A: same\n\nInherited architect: same\n"))
+3 -3
View File
@@ -9,11 +9,11 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from metric_bench.bench import auc, bench, co_changed, top_k
from metric_bench.bench import auc, bench, co_changed, resolved, top_k
from metric_bench.python_units import cognitive, measured, python_units, Unit
from larv_review.history import entries, Place
from failure import Failure
from test_loop_claude_black_box import host_env
from larv_review.history import Place, resolved, scoring_runs
TOOL = pathlib.Path(__file__).resolve().parent / "metric-bench"
@@ -142,7 +142,7 @@ class Places(unittest.TestCase):
""")
def test_reads_each_scoring_runs_places_and_leaves_paired_rulings_out(self):
runs = scoring_runs(self.HISTORY)
runs = [entry for entry in entries(self.HISTORY) if not entry.paired]
self.assertEqual([(run.heading, run.commit) for run in runs], [("2026-10-08T12:50:49Z, PR #224 at a58a0a8", "a58a0a8")])
self.assertEqual(runs[0].places, [Place("skills/x/SKILL.md", None), Place("bin/tool/cycle/states.py", "transition"), Place("cycle/run.py", "step"), Place("cycle/run.py", "close"), Place("bin/tool/cycle/judge.py", "run_judge")])
+29
View File
@@ -452,3 +452,32 @@ Inherited architect, decided by:
- `bin/larv_review/git.py:4` the import of `HistoryChange` from rules, and `bin/metric_bench/main.py:143` `git`: a reversed dependency and two git runners
- `bin/larv_review/seats.py:7` `SCORING_SEATS` and `SEAT_LINE`, with `bin/larv_review/rules.py:11` `FIRST_SEATS`: seat names spelled in four places
- `bin/larv_review/main.py:164` `record` and `bin/larv_review/history.py:52` `entries`: positional regex groups that need `HEADING` open beside them
## 2026-10-08T23:40:09Z, PR #231 at efed78b, against 12d6d75
Ruling: worse
| Seat | Vote |
|---|---|
| Mid A | worse |
| Inherited architect | worse |
Mid A, decided by:
- `bin/larv_review/rules.py:105` `scoring_run_due`: set arithmetic over two plans, an `earliest` release and a `landed` flag built in `git.py`, with `or` and `and` unparenthesised, where the base's trigger was one clause at `skills/larv-review/SKILL.md:35`
- `bin/larv_review/rules.py:66` `measured_commit` and `:82` `base`: the base comes from diffing the history around each merged change, held with `history.py` `entries` and `git.py` `history_changes` at once
- `bin/larv_review/rules.py:16` `votes` and `:34` `ruling`, with `bin/larv_review/seats.py:16` `FIRST_SEATS`: fixed seat order, a split, a lead of two and a placeless vote stacked, where `skills/larv-review/SKILL.md:93` only points at `--help`
- `bin/larv_review/main.py:220` `read_seats`: `named.group(3, 4)` depends on `HEADING`'s group positions in `bin/larv_review/history.py:13`
- `bin/larv_review/history.py:95` `resolved` and `:66` `scoring_runs`: used only by `bin/metric_bench/main.py:40`, so metric-bench reaches into another tool's package
- `bin/larv_review/rules.py:57` `round_counts`, better: the round count is a small named function where the base had prose at `skills/larv-review/SKILL.md:58`
- `bin/larv_review/history.py:129` `ruling_entry`, better: the history's format has one owner in code
Inherited architect, decided by:
- `bin/larv_review/rules.py:105` `scoring_run_due`: set arithmetic whose inputs are built in three other files, where the base's trigger was one table cell at `skills/larv-review/SKILL.md:35`
- `bin/larv_review/rules.py:66` `measured_commit` and `:82` `base`: `against is None` doubles as the type tag of `bin/larv_review/history.py:30` `Entry`; the hardest unit at 3am
- `bin/larv_review/main.py:220` `read_seats`, with `bin/larv_review/history.py:111` `heading`: a raw `re.Match` whose groups another file reads by position
- `bin/larv_review/seats.py:10` `MEAN`, with `bin/larv_review/history.py:111` `heading`: a fake seat standing for a legacy import, threaded through every scoring path
- `bin/larv_review/history.py:95` `resolved` and `:66` `scoring_runs`: metric-bench's legacy path rules inside larv-review's package, and two `git` helpers at `bin/metric_bench/main.py:143` and `bin/larv_review/git.py:10`
- `bin/larv_review/main.py:1` the module docstring, with `bin/larv_review/rules.py:83` `base`: the base rule stated in several places in different words
- `bin/larv_review/rules.py:57` `round_counts`, better: the fourth-round symptom leads to a tested function