From 8cdbff5fba93004a7d88778301476848bea5834d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 02:11:03 +0200 Subject: [PATCH 1/4] Move the vote counting out of larv-review's votes, so reading a votes file decides nothing --- bin/larv_review/record.py | 6 ++++-- bin/larv_review/ruling.py | 10 ++++++---- bin/larv_review/test_larv_review.py | 18 +++++++++++++++--- docs/reading-cost.md | 4 ++++ todo.md | 5 ----- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/bin/larv_review/record.py b/bin/larv_review/record.py index f16db753..935d4439 100644 --- a/bin/larv_review/record.py +++ b/bin/larv_review/record.py @@ -4,13 +4,13 @@ import time from larv_review.agreement import agreement_report from comprehension_history import appended, DIMENSIONS, FLOOR, heading, Heading, HISTORY, latest_places, recorded, ruling_entry, scoring_entry, ScoringRun, vote_text from git_repo import commit_exists, top -from larv_review.ruling import counted, overall, ruling, split, votes +from larv_review.ruling import counted, overall, ruling, split, surplus, votes from failure import Failure from larv_review.scoring import means, under_floor from larv_review.plan import plan_reasons import rank_todo from file_writes import replace_file -from larv_review.seats import scores, seats_file, SeatsFile +from larv_review.seats import FIRST_SEATS, scores, seats_file, SeatsFile def record_ruling(votes_file: pathlib.Path) -> Failure | None: @@ -24,6 +24,8 @@ def record_ruling(votes_file: pathlib.Path) -> Failure | None: counts = counted(seats_read.seats, written) tally = ", ".join(f"{seat.name} {vote_text(DIMENSIONS[-1], overall(written[seat.name]), overall(counts[seat.name]))}" for seat in seats_read.seats) overall_votes = [overall(each) for each in counts.values()] + if surplus(overall_votes): + return Failure(f"{' and '.join(FIRST_SEATS)} both count as {overall_votes[0]} overall, which settles the ruling; drop the other seats' lines") if split(overall_votes): print(f"Split: {tally}. Launch the maintainability senior and Junior A together, add their lines to the votes file, and run this again.") return None diff --git a/bin/larv_review/ruling.py b/bin/larv_review/ruling.py index a21a4249..92a9d398 100644 --- a/bin/larv_review/ruling.py +++ b/bin/larv_review/ruling.py @@ -6,7 +6,7 @@ VOTES = ("better", "same", "worse") def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure: - """Each seat's five votes as written, in DIMENSIONS' order.""" + """Each seat's five votes as written, in DIMENSIONS' order, once the seats, their lines and their places have the shape a votes file takes; what the votes count as is `counted`'s to say.""" names = [seat.name for seat in seats] if names[:2] != list(FIRST_SEATS) or names[2:] not in ([], list(SPLIT_SEATS)): return Failure(f"a paired ruling's seats are {' and '.join(FIRST_SEATS)}, then, when their overall votes differ, {' and '.join(SPLIT_SEATS)}, in that order; the file has {', '.join(names) or 'none'}") @@ -18,9 +18,6 @@ def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure: if unnamed := [place for place in seat.places if not place_dimensions(place)]: return Failure(f"{seat.name}'s place does not open with the dimensions it moves, each one of {', '.join(DIMENSIONS)}, then `: `: {unnamed[0]}") said[seat.name] = line - first, second, *more = (overall(each) for each in counted(seats, said).values()) - if more and first == second: - return Failure(f"{' and '.join(FIRST_SEATS)} both count as {first} overall, which settles the ruling; drop the other seats' lines") return said @@ -38,6 +35,11 @@ def names_a_place(seat: Seat, dimension: str) -> bool: return any(PLACE.search(place) and (dimension == DIMENSIONS[-1] or dimension in place_dimensions(place)) for place in seat.places) +def surplus(overall: list[str]) -> bool: + """Whether seats beyond the first two voted though those two agree, which settles the ruling alone.""" + return len(overall) > 2 and overall[0] == overall[1] + + def split(overall: list[str]) -> bool: """Whether only the first two seats voted overall and they differ, so two more must vote: two votes that differ cannot reach a lead of two.""" return len(overall) == 2 and overall[0] != overall[1] diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index a9706d7e..c353f16f 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -13,7 +13,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from larv_review.agreement import agreement_report, ruling_agreement, run_agreement from comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat import comprehension_history -from larv_review.ruling import counted, ruling, split, votes +from larv_review.ruling import counted, ruling, split, surplus, votes from failure import Failure from test_env import isolated_env from todo_table import Item, items, NoItemsTable @@ -68,9 +68,14 @@ class Seats(unittest.TestCase): self.assertIsInstance(votes([Seat("Mid A", said("better"), ["`a.py:3` `f`: Locality: x"]), seats[1]]), Failure) self.assertEqual(votes(seats), {seat.name: written[seat.name] for seat in seats}) - def test_refuses_two_more_seats_once_the_first_two_agree_overall(self): + def test_reads_all_four_seats_without_ruling_on_their_votes(self): seats = [Seat(name, said(vote), ["Overall: `f.py:1` `f`: x"]) for name, vote in (("Mid A", "worse"), ("Inherited architect", "worse"), ("Maintainability senior", "better"), ("Junior A", "better"))] - self.assertIsInstance(votes(seats), Failure) + self.assertEqual(list(votes(seats)), [seat.name for seat in seats]) + + def test_finds_more_seats_than_two_once_the_first_two_agree_overall(self): + self.assertTrue(surplus(["worse", "worse", "better", "better"])) + self.assertFalse(surplus(["worse", "worse"])) + self.assertFalse(surplus(["worse", "same", "better", "better"])) def test_takes_the_first_two_seats_then_the_other_two_in_order_and_each_dimensions_vote(self): first = [Seat("Mid A", said("same"), []), Seat("Inherited architect", said("same"), [])] @@ -461,6 +466,13 @@ class LarvReviewTool(unittest.TestCase): self.assertEqual(recorded[0].ruled_places, [Place("bin/a.py", "f")] * 2) self.assertIn("| Junior A | same | same | same | same | same (voted worse, naming no place) |", history.read_text()) + def test_refuses_the_other_seats_lines_once_the_first_two_agree_overall(self): + lines = f"PR #2 at {self.start}, against {self.start}\n\n" + "\n".join(f"{seat}: {said('worse')}\n\n- Overall: `bin/a.py:3` `f`: hard\n" for seat in ("Mid A", "Inherited architect", "Maintainability senior", "Junior A")) + ran = self.run_tool("record-ruling", self.seats_file(lines)) + self.assertEqual((ran.returncode, ran.stdout), (1, "")) + self.assertIn("both count as worse overall, which settles the ruling; drop the other seats' lines", ran.stderr) + self.assertFalse((self.checkout / "docs" / "comprehension-history.md").exists()) + def test_records_a_ruling_whose_dimension_fell_and_takes_no_scores_file(self): place = "\n\n- Locality, Overall: `bin/a.py:3` `f`: shorter\n\n" votes_file = self.seats_file(f"PR #2 at {self.start}, against {self.start}\n\nMid A: {said('better', 'worse')}{place}Inherited architect: {said('better', 'worse')}{place}", "votes.md") diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 0b0e2b2a..0a90924b 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -758,3 +758,7 @@ Read most (opens and searches): ## Reading cost, chunk d69472f986e3, finished 2026-10-21T23:32:33Z 73910 new input tokens before the first commit. + +## Reading cost, chunk e78792eec4a6, finished 2026-10-22T00:08:00Z + +71637 new input tokens before the first commit. diff --git a/todo.md b/todo.md index c60c8c15..070eeace 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 130 | 0.4.0 | | | **Move the vote counting out of `bin/larv_review/ruling.py`'s `votes`, so reading a votes file decides nothing.** | 2 | 1 | 2 | 3 | 3 | code health by 4, 1.4 by 4 | 21.9 | | 170 | 0.4.0 | | decision | **Re-tune `WORKER_STEPS` and `REVIEW_STEPS` once 10 chunks have shipped under them, from how well L, E and I order their review rounds and 🔴 findings.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 3, 1.4 by 5 | 10.9 | | 154 | 0.4.0 | | defect | **Have `bin/shell_command.py`'s `segments` keep a command's words together across a redirect, so `git > out commit` reads as one git commit.** | 1 | 1 | 3 | 3 | 2 | 1.1 by 6 | 8.4 | | 186 | 0.4.0 | | | **Point every file a session parks outside its checkout, such as the comprehension panel's detached worktree and a build probe's output, at a folder a headless session has, since loop-claude's sessions have no scratchpad.** | 1 | 2 | 2 | 3 | 2 | 1.1 by 3, 1.5 by 2 | 6.8 | @@ -78,10 +77,6 @@ ## Details -### 130. Move the vote counting out of `bin/larv_review/ruling.py`'s `votes`, so reading a votes file decides nothing. - -Mid A of PR #257's scoring run named `bin/larv_review/ruling.py:8` `votes`. It calls `counted` while validating, to reject the maintainability senior's and Junior A's lines when Mid A and the inherited architect already agree overall: a ruling hidden in a parser. The counting rule is spread over `seats.py`, `ruling.py`, `comprehension_history.place_dimensions` and the help. Make `votes` easier to read. - ### 170. Re-tune `WORKER_STEPS` and `REVIEW_STEPS` once 10 chunks have shipped under them, from how well L, E and I order their review rounds and 🔴 findings. `docs/decisions.md` → `routing: one ladder…` calls the steps lilleman approved on 2026-10-16 a first guess. Once 10 chunks that each shipped one item scored with L, E and I have merged, read `score-outcomes`' rank correlations for L, E and I and the routed-chunks table of `routing-figures.md`, and propose new steps to lilleman, whose call they are. -- 2.52.0 From e419bc5cb0c61cdbc8e6ee8e148845dc9d3d6d1e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 02:20:19 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Answer=20principles=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1;=20leave=20the=20=F0=9F=9F=A2?= =?UTF-8?q?=20on=20surplus's=20parameter=20name,=20which=20split's=20alrea?= =?UTF-8?q?dy=20shadows=20overall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From e32accd08c388f4866c467ea4b2ed66228412e9a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 02:20:19 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Answer=20stability=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1;=20sort=20record.py's=20import?= =?UTF-8?q?s=20and=20build=20the=20tally=20after=20the=20surplus=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/larv_review/record.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/larv_review/record.py b/bin/larv_review/record.py index 935d4439..5dcf9314 100644 --- a/bin/larv_review/record.py +++ b/bin/larv_review/record.py @@ -6,11 +6,11 @@ from comprehension_history import appended, DIMENSIONS, FLOOR, heading, Heading, from git_repo import commit_exists, top from larv_review.ruling import counted, overall, ruling, split, surplus, votes from failure import Failure +from larv_review.seats import FIRST_SEATS, scores, seats_file, SeatsFile from larv_review.scoring import means, under_floor from larv_review.plan import plan_reasons import rank_todo from file_writes import replace_file -from larv_review.seats import FIRST_SEATS, scores, seats_file, SeatsFile def record_ruling(votes_file: pathlib.Path) -> Failure | None: @@ -22,10 +22,10 @@ def record_ruling(votes_file: pathlib.Path) -> Failure | None: if isinstance(written, Failure): return written counts = counted(seats_read.seats, written) - tally = ", ".join(f"{seat.name} {vote_text(DIMENSIONS[-1], overall(written[seat.name]), overall(counts[seat.name]))}" for seat in seats_read.seats) overall_votes = [overall(each) for each in counts.values()] if surplus(overall_votes): return Failure(f"{' and '.join(FIRST_SEATS)} both count as {overall_votes[0]} overall, which settles the ruling; drop the other seats' lines") + tally = ", ".join(f"{seat.name} {vote_text(DIMENSIONS[-1], overall(written[seat.name]), overall(counts[seat.name]))}" for seat in seats_read.seats) if split(overall_votes): print(f"Split: {tally}. Launch the maintainability senior and Junior A together, add their lines to the votes file, and run this again.") return None -- 2.52.0 From 4b783ac67b4a3f4926d3d92bb3cf8434e6432966 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 02:21:46 +0200 Subject: [PATCH 4/4] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1;=20reword=20the=20votes=20and?= =?UTF-8?q?=20surplus=20docstrings=20and=20rename=20two=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/larv_review/ruling.py | 4 ++-- bin/larv_review/test_larv_review.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/larv_review/ruling.py b/bin/larv_review/ruling.py index 92a9d398..c64ff2e5 100644 --- a/bin/larv_review/ruling.py +++ b/bin/larv_review/ruling.py @@ -6,7 +6,7 @@ VOTES = ("better", "same", "worse") def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure: - """Each seat's five votes as written, in DIMENSIONS' order, once the seats, their lines and their places have the shape a votes file takes; what the votes count as is `counted`'s to say.""" + """Each seat's five votes as written, in DIMENSIONS' order. Fails unless the seats come in a votes file's order and each seat's vote line and places have its shape. `counted` decides what the votes count as.""" names = [seat.name for seat in seats] if names[:2] != list(FIRST_SEATS) or names[2:] not in ([], list(SPLIT_SEATS)): return Failure(f"a paired ruling's seats are {' and '.join(FIRST_SEATS)}, then, when their overall votes differ, {' and '.join(SPLIT_SEATS)}, in that order; the file has {', '.join(names) or 'none'}") @@ -36,7 +36,7 @@ def names_a_place(seat: Seat, dimension: str) -> bool: def surplus(overall: list[str]) -> bool: - """Whether seats beyond the first two voted though those two agree, which settles the ruling alone.""" + """Whether seats beyond the first two voted, though the first two agree overall: their agreement settles the ruling by itself.""" return len(overall) > 2 and overall[0] == overall[1] diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index c353f16f..e60a2baf 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -68,11 +68,11 @@ class Seats(unittest.TestCase): self.assertIsInstance(votes([Seat("Mid A", said("better"), ["`a.py:3` `f`: Locality: x"]), seats[1]]), Failure) self.assertEqual(votes(seats), {seat.name: written[seat.name] for seat in seats}) - def test_reads_all_four_seats_without_ruling_on_their_votes(self): + def test_reads_the_other_two_seats_even_when_the_first_two_agree_overall(self): seats = [Seat(name, said(vote), ["Overall: `f.py:1` `f`: x"]) for name, vote in (("Mid A", "worse"), ("Inherited architect", "worse"), ("Maintainability senior", "better"), ("Junior A", "better"))] self.assertEqual(list(votes(seats)), [seat.name for seat in seats]) - def test_finds_more_seats_than_two_once_the_first_two_agree_overall(self): + def test_flags_seats_beyond_the_first_two_when_those_agree_overall(self): self.assertTrue(surplus(["worse", "worse", "better", "better"])) self.assertFalse(surplus(["worse", "worse"])) self.assertFalse(surplus(["worse", "same", "better", "better"])) -- 2.52.0