Answer architecture round 3: open each place with the dimensions it moves, fail a scoring run nothing calls, test the base rule and a standing ratchet, and state the base rule whole

This commit is contained in:
2026-10-09 11:07:12 +02:00
parent 9de87e04cf
commit 030e29a52d
6 changed files with 43 additions and 23 deletions
+2 -2
View File
@@ -2,10 +2,10 @@
## Unreleased
- larv-review's paired ruling takes each seat's vote on each dimension too: `Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall better`. A better or same ruling in which a dimension fell calls a scoring run, and counts as worse, blocking the merge, when that dimension's mean is under the floor. Such a run blocks on the fallen dimensions alone and leaves the ratchet's base in place unless the ruling is better. Each place a seat names must name the dimensions it moves, spelled as in the seat's line, or the run fails; a dimension's vote counts only where one of the seat's places names it. `record-scoring` takes the shipped item IDs too and prints `Floor:` when the means under the floor block the merge.
- larv-review's paired ruling takes each seat's vote on each dimension too: `Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall better`. A better or same ruling in which a dimension fell calls a scoring run, and counts as worse, blocking the merge, when that dimension's mean is under the floor. Such a run blocks on the fallen dimensions alone and leaves the ratchet's base in place unless the ruling is better. Each place a seat names opens with the dimensions it moves, spelled as in the seat's line, such as `Locality, Shape: `, or the run fails; a dimension's vote counts only where one of the seat's places opens with it. `record-scoring` takes the shipped item IDs too and prints `Floor:` when the means under the floor block the merge.
- larv-review's mechanical rules run in the new, tested `bin/larv-review`: the paired ruling's base (`ruling-base`), each pass's round count (`round-count`), the scoring run's trigger (`needs-scoring-run <item ID>...`), and the vote count, means and history format (`record-ruling` and `record-scoring`, which read a seats file and append to `docs/comprehension-history.md`). The skill says when to run each and what its answer means. A seats file line the tool cannot read fails the run, so a mistyped vote never counts as same. The base search compares the history before and after each merged change, so it no longer depends on how a line is worded, and orders a change's rulings by their headings' times. A release whose last plan item moves to another release is due a scoring run too, once work has landed towards it. A seats file must name commits the checkout holds. Scores a `comprehension floor:` decision entry still holds move into the history through `record-scoring`, as a `Mean:` line. When origin cannot be fetched, the tool reads it as last fetched and says so.
- The new `bin/metric-bench` benches cheap static metrics of a project's Python against the places its comprehension history names as hardest: cognitive complexity, length, shared state and change spread, each scored by how well it ranks the named functions above the rest. No metric enters review yet.
- larv-review blocks a merge when simulated readers rule that the PR makes the project read worse than the last measured commit: the default branch's newest merged change that added a scoring run to `docs/comprehension-history.md`, or whose last ruling there is better. A ruling of same leaves that commit in place, so a worse ruling may name places earlier chunks wrote. In each architecture pass Mid A and the inherited architect vote better, same or worse; when they disagree, the maintainability senior and Junior A vote too. A ruling needs a lead of two or more votes, else it is same, and a vote that names no place counts as same. A worse ruling never ships: after three rounds larv-review asks you for another round, a no leaves the PR unmerged, and so does an unattended run. The four-seat scoring run checks the comprehension floor only when a chunk ships or removes a release's last plan item, or ships an item naming the floor; between those runs the floor blocks only a dimension a paired ruling finds fallen. A score under the floor blocks the merge until fixed or until you decide to ship; a decision in `docs/decisions.md` that lets every chunk ship under the floor counts as yours.
- larv-review blocks a merge when simulated readers rule that the PR makes the project read worse than the last measured commit: the default branch's newest merged change whose last ruling in `docs/comprehension-history.md` is better, or that added a scoring run there while that ruling named no fall. A ruling of same leaves that commit in place, so a worse ruling may name places earlier chunks wrote. In each architecture pass Mid A and the inherited architect vote better, same or worse; when they disagree, the maintainability senior and Junior A vote too. A ruling needs a lead of two or more votes, else it is same, and a vote that names no place counts as same. A worse ruling never ships: after three rounds larv-review asks you for another round, a no leaves the PR unmerged, and so does an unattended run. The four-seat scoring run checks the comprehension floor only when a chunk ships or removes a release's last plan item, or ships an item naming the floor; between those runs the floor blocks only a dimension a paired ruling finds fallen. A score under the floor blocks the merge until fixed or until you decide to ship; a decision in `docs/decisions.md` that lets every chunk ship under the floor counts as yours.
- larv-review reruns fewer passes after a fix. A fix reruns the pass whose 🔴 or 🟡 it answers, plus stability when the fix changes behaviour, security when it opens an untrusted-input boundary or touches authn/authz, secrets or crypto, and architecture when it carries an architectural decision. A rerun reviews only what changed since that pass last reviewed. A fix for a 🟢, a ❓ or any prose finding reruns no pass, and prose takes one round.
- larv-review runs one security pass on each change: the full scan alone when it runs, else `/security-review`.
- larv-review runs the new `bin/reading-cost`, which measures each chunk `loop-claude` finished from its archive: the new input tokens the worker and its subagents took in before the worker's first commit, and the files git tracks that they read most. It appends each figure the project's `docs/reading-cost.md` lacks. Once 10 chunks are measured, and the last 5 chunks' median is above the 5 before them, larv-review files one plan item naming the files read most, or refreshes it. The chunk that ships it runs `reading-cost --reset`, so the trend counts only chunks that finished after it.
+8 -5
View File
@@ -37,15 +37,15 @@ opens with its label, written exactly: `Junior A:`, `Mid A:`, `Maintainability s
Mid A: Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall worse
- `bin/x.py:12` `run`: Locality: three branches to hold at once
- Locality: `bin/x.py:12` `run`: three branches to hold at once
Inherited architect: Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall worse
- `bin/x.py:12` `run`: Locality: ...
- Locality: `bin/x.py:12` `run`: ...
record-ruling takes Mid A's and the inherited architect's votes on each dimension and overall,
each better, same or worse. Each place names the dimensions it moves, or Overall, spelled as the
seat's line spells them. A dimension's vote counts as same unless one of the seat's places in
each better, same or worse. Each place opens with the dimensions it moves, or Overall, spelled as
the seat's line spells them and joined by `, `, then `: `. A dimension's vote counts as same unless one of the seat's places in
backticks, `path:line`, names that dimension; the overall vote counts as same unless the seat names
any such place. The printed votes say so. When the two counted overall votes differ, it appends
nothing and prints `Split:`, saying to add the maintainability senior's and Junior A's lines.
@@ -59,7 +59,8 @@ architect's lines in that order, or a `Mean:` line alone for a run moved from a
Each line is `Navigation <n>, Locality <n>, Shape <n>, Self-sufficiency <n>, Overall <n>`, each
score from 1 to 10 and the overall at most 1 above the line's lowest dimension. Its first line
names no `, against`. It appends the seats' scores and their means, rounded half up to two
decimals, and prints the means and each one under the floor of {floor}. A `Floor:` line says the
decimals, and prints the means and each one under the floor of {floor}. It exits 1 on a run with
seats that no plan item, release or fall calls. A `Floor:` line says the
means under the floor block the merge, as they do when needs-scoring-run would give a reason
besides a fall. When the history ends on a
paired ruling with a `Fell:` line, it says whether the ruling stands; when a dimension that fell is
@@ -247,6 +248,8 @@ def record_scoring(default: str, seats_file: pathlib.Path, ids: list[int]) -> Fa
blocking = due_reasons(default, ids, [])
if isinstance(blocking, Failure):
return blocking
if not (blocking or given.moved_mean or pending_fall(recorded)):
return Failure("no plan item, release or fall calls this scoring run; name the item IDs the chunk ships, as needs-scoring-run took them")
print(f"Means: {', '.join(f'{name} {value}' for name, value in zip(DIMENSIONS, mean))}. {floor_verdict(under_floor(mean), blocking)}")
outcome = fall_outcome([] if given.moved_mean else pending_fall(recorded), mean)
if outcome:
+9 -3
View File
@@ -23,8 +23,8 @@ def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure:
line = vote_line(seat.name, seat.said)
if isinstance(line, Failure):
return line
if unnamed := [place for place in seat.places if not any(re.search(rf"\b{name}\b", place) for name in DIMENSIONS)]:
return Failure(f"{seat.name}'s place names none of {', '.join(DIMENSIONS)}, spelled so: {unnamed[0]}")
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 = (each[-1] for each in counted(seats, said).values())
if more and first == second:
@@ -38,7 +38,13 @@ def counted(seats: list[Seat], said: dict[str, list[str]]) -> dict[str, list[str
def names_a_place(seat: Seat, dimension: str) -> bool:
return any(PLACE.search(place) and (dimension == DIMENSIONS[-1] or re.search(rf"\b{dimension}\b", place)) for place in seat.places)
return any(PLACE.search(place) and (dimension == DIMENSIONS[-1] or dimension in place_dimensions(place)) for place in seat.places)
def place_dimensions(place: str) -> list[str]:
"""The dimensions a place opens with, as in `Locality, Shape: `path:line` ...`; empty when any name before the first `: ` is no dimension."""
named = place.partition(": ")[0].split(", ")
return named if all(name in DIMENSIONS for name in named) else []
def ruling(counted: list[str]) -> str | None:
+22 -11
View File
@@ -48,19 +48,21 @@ class Seats(unittest.TestCase):
self.assertIsInstance(report(""), Failure)
def test_counts_each_vote_of_a_seat_naming_no_place_as_same(self):
seats = [Seat("Mid A", said("worse", "worse"), ["Locality: the whole skill"]), Seat("Inherited architect", said("better"), ["`a.py:3` `f`: Overall: shorter"])]
seats = [Seat("Mid A", said("worse", "worse"), ["Locality: the whole skill"]), Seat("Inherited architect", said("better"), ["Overall: `a.py:3` `f`: shorter"])]
written = votes(seats)
self.assertEqual(written, {"Mid A": ["same", "worse", "same", "same", "worse"], "Inherited architect": ["same", "same", "same", "same", "better"]})
self.assertEqual(counted(seats, written)["Mid A"], ["same"] * 5)
def test_counts_a_dimensions_vote_only_where_a_place_names_that_dimension(self):
seats = [Seat("Mid A", said("better", "worse"), ["`a.py:3` `f`: Shape, reshaped"]), Seat("Inherited architect", said("better", "worse"), ["`a.py:3` `f`: Locality, held at once"])]
seats = [Seat("Mid A", said("better", "worse"), ["Shape: `a.py:3` `f`: the Locality of it, reshaped"]), Seat("Inherited architect", said("better", "worse"), ["Locality, Shape: `a.py:3` `f`: held at once"])]
written = {seat.name: ["same", "worse", "same", "same", "better"] for seat in seats}
self.assertEqual(counted(seats, written), {"Mid A": ["same", "same", "same", "same", "better"], "Inherited architect": written["Inherited architect"]})
self.assertIsInstance(votes([Seat("Mid A", said("better"), ["`a.py:3` `f`: self sufficiency"]), seats[1]]), Failure)
self.assertIsInstance(votes([Seat("Mid A", said("better"), ["Locality, self sufficiency: `a.py:3` `f`: x"]), seats[1]]), Failure)
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):
seats = [Seat(name, said(vote), ["`f.py:1` `f`: x"]) for name, vote in (("Mid A", "worse"), ("Inherited architect", "worse"), ("Maintainability senior", "better"), ("Junior A", "better"))]
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)
def test_takes_the_first_two_seats_then_the_other_two_in_order_and_each_dimensions_vote(self):
@@ -135,6 +137,9 @@ class PendingFall(unittest.TestCase):
self.assertEqual(standing_ratchet(chunk_entries("", fell + later)), "Ratchet: worse.")
self.assertEqual(pending_fall(chunk_entries("", SCORING + paired("2026-10-08T13:00:00Z", "same\n\nFell: Locality"))), ["Locality"])
self.assertEqual(pending_fall(chunk_entries("", "")), [])
rescored = SCORING.replace("12:00:00Z", "15:00:00Z")
self.assertEqual(standing_ratchet(chunk_entries("", fell + later + rescored)), "Ratchet: worse.")
self.assertIsNone(standing_ratchet(chunk_entries("", fell + later + paired("2026-10-08T16:00:00Z", "same"))))
def test_reads_only_the_entries_the_default_branch_lacks(self):
fell = paired("2026-10-08T13:00:00Z", "better\n\nFell: Locality")
@@ -153,6 +158,11 @@ class Base(unittest.TestCase):
worse_last = HistoryChange("worse", SCORING, SCORING + paired("2026-10-08T13:00:00Z", "better") + paired("2026-10-08T14:00:00Z", "worse"))
self.assertEqual(measured_commit([worse_last, older]), "old")
self.assertIsNone(measured_commit([same]))
run = SCORING.replace("12:00:00Z", "14:00:00Z").replace("PR #1", "PR #2")
same_fell = HistoryChange("same fell", SCORING, SCORING + paired("2026-10-08T13:00:00Z", "same\n\nFell: Locality") + run)
self.assertEqual(measured_commit([same_fell, older]), "old")
better_fell = HistoryChange("better fell", SCORING, SCORING + paired("2026-10-08T13:00:00Z", "better\n\nFell: Locality") + run)
self.assertEqual(measured_commit([better_fell, older]), "better fell")
def test_falls_back_to_the_first_rulings_base_then_to_none(self):
ruled = paired("2026-10-08T13:00:00Z", "worse")
@@ -277,7 +287,7 @@ class LarvReviewTool(unittest.TestCase):
Mid A: {worse}
- `bin/a.py:3` `f`: Overall: three branches
- Overall: `bin/a.py:3` `f`: three branches
Inherited architect: {same}
"""
@@ -287,7 +297,7 @@ class LarvReviewTool(unittest.TestCase):
self.assertTrue(split.stdout.startswith("Split: Mid A worse, Inherited architect same."))
history = self.checkout / "docs" / "comprehension-history.md"
self.assertFalse(history.exists())
lines += f"\n\t\t\tMaintainability senior: {said('worse')}\n\n\t\t\t- `bin/a.py:3` `f`: Overall: hard\n\n\t\t\tJunior A: {said('worse')}\n"
lines += f"\n\t\t\tMaintainability senior: {said('worse')}\n\n\t\t\t- Overall: `bin/a.py:3` `f`: hard\n\n\t\t\tJunior A: {said('worse')}\n"
ran = self.run_tool("record-ruling", self.seats_file(lines))
self.assertEqual(ran.stdout.splitlines()[0], "Ruling: same. Overall votes as counted: Mid A worse, Inherited architect same, Maintainability senior worse, Junior A same (voted worse, naming no place).")
recorded = entries(history.read_text())
@@ -296,7 +306,7 @@ class LarvReviewTool(unittest.TestCase):
self.assertIn("| Junior A | same | same | same | same | same (voted worse, naming no place) |", history.read_text())
def test_holds_a_better_ruling_that_hides_a_fall_until_a_scoring_run_decides_it(self):
place = "\n\n- `bin/a.py:3` `f`: Locality, shorter\n\n"
place = "\n\n- Locality, Overall: `bin/a.py:3` `f`: shorter\n\n"
ran = self.run_tool("record-ruling", 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}"))
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("Fell: Locality. A scoring run is due", ran.stdout)
@@ -314,7 +324,7 @@ class LarvReviewTool(unittest.TestCase):
self.assertIn("The paired ruling stands: Locality fell and stays at or above the floor of 7.0.", stands.stdout)
def test_names_no_fall_on_a_worse_ruling(self):
place = "\n\n- `bin/a.py:3` `f`: Locality, longer\n\n"
place = "\n\n- Locality, Overall: `bin/a.py:3` `f`: longer\n\n"
ran = self.run_tool("record-ruling", self.seats_file(f"PR #2 at {self.start}, against {self.start}\n\nMid A: {said('worse', 'worse')}{place}Inherited architect: {said('worse', 'worse')}{place}"))
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertNotIn("Fell:", ran.stdout + (self.checkout / "docs" / "comprehension-history.md").read_text())
@@ -322,10 +332,11 @@ class LarvReviewTool(unittest.TestCase):
def test_records_a_scoring_run_with_its_means(self):
line = "Navigation 7, Locality 6.5, Shape 7, Self-sufficiency 6.5, Overall 7"
seats = "".join(f"\n{seat}: {line}\n\n- `bin/a.py:3` `f`: long\n" for seat in ("Junior A", "Mid A", "Maintainability senior", "Inherited architect"))
ran = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats))
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("Under the floor of 7.0, blocking nothing on a run due for no reason besides a fall: Locality 6.50, Self-sufficiency 6.50.", ran.stdout)
uncalled = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats))
self.assertEqual(uncalled.returncode, 1)
self.assertIn("name the item IDs the chunk ships", uncalled.stderr)
due = self.run_tool("record-scoring", self.seats_file(f"PR #3 at {self.start}\n" + seats), "1")
self.assertEqual(due.returncode, 0, due.stderr)
self.assertIn("Floor: Locality 6.50, Self-sufficiency 6.50 under the floor of 7.0 block the merge, as the chunk leaves release 0.1.0 with no plan item.", due.stdout)
text = (self.checkout / "docs" / "comprehension-history.md").read_text()
self.assertIn("| Mean | 7.00 | 6.50 | 7.00 | 6.50 | 7.00 |", text)
+1 -1
View File
@@ -67,7 +67,7 @@ lilleman decided to ship each of these under the floor on the day listed. Each l
## review: a paired ruling against the last measured commit decides the ratchet, and counts as worse when a dimension it rules fallen is under the floor; the four-seat scoring run checks the floor when a release's items run out, an item names the floor or a ruling names a fallen dimension
2026-10-08, lilleman. Serves goals 1.1 and 1.4. Two independent four-seat runs moved up to 0.4 on near-identical code, so a fall within that noise forced rounds that changed nothing (PR #224). A seat reading both versions judges the difference on the same material, so the noise the versions share cancels. No conventional significance level lets a sign test settle with four votes, so the human chose a lead of two votes over every other ruling, same included. Two seats that agree settle it, so a PR that leaves the reading as it was costs two seats. A third seat alone can never settle it, so the third and fourth launch together. The base is the default branch's newest merged change that adds a scoring run to the history, or whose last added paired ruling is better. The human chose the last measured commit on the architect's finding that with a merge base as the base, chunks without an architecture pass, and a suspended restructure's steps, could each lower comprehension unseen. A ruling of same leaves the base where it was, or a run of small falls each ruled same would add up unseen. A scoring run moves it too: otherwise a project never ruled better would compare against its first ruling forever, and a release's floor check is where the human sees the absolute level. Reading the default branch one merged change at a time keeps the rule working for merge commits and squash merges alike: a branch's own early ruling of better never counts, only the merged change's last ruling. The scoring run also runs on a chunk shipping an item that names the floor, so the chunk that lifts a project to the floor can prove it. A chunk that removes a release's last item without shipping it runs it too, so no release ends unmeasured. 2026-10-09, lilleman: each seat also rules each dimension, and a dimension falls by the same lead of two. A better or same ruling naming a fallen dimension calls the scoring run, and counts as worse when that dimension's mean is under the floor, so between releases a project cannot trade one dimension below the floor for gains in the other three. Such a run blocks on the fallen dimensions alone: the floor's own block stays with a release's end and an item naming the floor. Nor does it move the base, unless the ruling is better: a run of falls each ruled same must not add up unseen. A dimension's vote counts only where one of the seat's places names that dimension. Valid while seats reading both versions agree more often than two absolute runs do.
2026-10-08, lilleman. Serves goals 1.1 and 1.4. Two independent four-seat runs moved up to 0.4 on near-identical code, so a fall within that noise forced rounds that changed nothing (PR #224). A seat reading both versions judges the difference on the same material, so the noise the versions share cancels. No conventional significance level lets a sign test settle with four votes, so the human chose a lead of two votes over every other ruling, same included. Two seats that agree settle it, so a PR that leaves the reading as it was costs two seats. A third seat alone can never settle it, so the third and fourth launch together. The base is the default branch's newest merged change whose last added paired ruling is better, or that adds a scoring run to the history while that ruling names no fall. The human chose the last measured commit on the architect's finding that with a merge base as the base, chunks without an architecture pass, and a suspended restructure's steps, could each lower comprehension unseen. A ruling of same leaves the base where it was, or a run of small falls each ruled same would add up unseen. A scoring run moves it too: otherwise a project never ruled better would compare against its first ruling forever, and a release's floor check is where the human sees the absolute level. Reading the default branch one merged change at a time keeps the rule working for merge commits and squash merges alike: a branch's own early ruling of better never counts, only the merged change's last ruling. The scoring run also runs on a chunk shipping an item that names the floor, so the chunk that lifts a project to the floor can prove it. A chunk that removes a release's last item without shipping it runs it too, so no release ends unmeasured. 2026-10-09, lilleman: each seat also rules each dimension, and a dimension falls by the same lead of two. A better or same ruling naming a fallen dimension calls the scoring run, and counts as worse when that dimension's mean is under the floor, so between releases a project cannot trade one dimension below the floor for gains in the other three. Such a run blocks on the fallen dimensions alone: the floor's own block stays with a release's end and an item naming the floor. Nor does it move the base, unless the ruling is better: a run of falls each ruled same must not add up unseen. A dimension's vote counts only where one of the seat's places names that dimension. Valid while seats reading both versions agree more often than two absolute runs do.
## review: a project decision may suspend the comprehension check for the plan items it names
+1 -1
View File
@@ -90,5 +90,5 @@ Same means a reader of either version would find it as easy to understand and ch
Report, in this shape:
1. Your rulings, each better, same or worse, in this shape: Navigation <ruling>, Locality <ruling>, Shape <ruling>, Self-sufficiency <ruling>, Overall <ruling>
2. The places that decided them, most decisive first. Each: path:line and the unit's name, in the version the place is in, the dimensions it moves, each spelled as in your rulings line, or Overall, and one or two sentences on what reads easier or harder there than in the other version. Rulings with no named place are discarded.
2. The places that decided them, most decisive first. Each opens with the dimensions it moves, spelled as in your rulings line, or Overall, joined by ", " and followed by ": ". Then path:line and the unit's name, in the version the place is in, and one or two sentences on what reads easier or harder there than in the other version. Rulings with no named place are discarded.
```