Answer stability round 1: ship item 83 out of the plan, test both scores-file refusals, mark a pass past the cap and only a pass, say how to retry a refused scores file, and sort the allowlist and mypy's modules

This commit is contained in:
2026-10-09 15:13:32 +02:00
parent 3ec67085c5
commit 0aedb5f5e9
11 changed files with 26 additions and 22 deletions
+1 -1
View File
@@ -43,9 +43,9 @@
!bin/statusline.py
!bin/test_*.py
!bin/todo_table.py
!bin/utc_stamp.py
!bin/transcript_archive/
!bin/transcript_archive/*.py
!bin/utc_stamp.py
!docs/
!docs/*.md
!principles/
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- `larv-review round-count` ignores case in a round's commit title, counts a repeated round number as a round of its own, and says to ask you before another round once a pass is at or past the cap. `record-ruling` says to run it again with the votes file alone when it refuses a scores file.
- The stability reviewer keeps its scratch work in a directory it creates for the run, deletes that directory afterwards, and deletes nothing else.
- 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 <votes file> [<scores file>]` and `record-scoring <scores file> [<item ID>...]`, which append to `docs/comprehension-history.md` and refuse a second entry on what a seats file's first line reads; `record-scoring` refuses a run the plan does not call, and prints `Floor:` naming each mean under the floor). 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. 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.
+1 -1
View File
@@ -74,7 +74,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
- `reading-cost [--reset] [record]` appends a figure for each chunk `loop-claude` finished to a project's `docs/reading-cost.md`, and says whether the figures rise; `reading-cost --help` states the measure.
- `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it.
`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests; `rank_todo.py` and `statusline.py` are tools of one file each, tested beside them. The other modules at `bin/`'s root, `claude_code/` and `transcript_archive/` serve more than one tool: `claude_code/` reads and writes Claude Code's files and reads its output, and `transcript_archive/` writes and reads `loop-claude`'s archive. `test_env.py` serves the tests, and `repo_checks/` tests the repo itself.
`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests; `rank_todo.py` and `statusline.py` are tools of one file each, tested beside them. The other modules at `bin/`'s root, together with `claude_code/` and `transcript_archive/`, serve more than one tool: `claude_code/` reads and writes Claude Code's files and reads its output, and `transcript_archive/` writes and reads `loop-claude`'s archive. `test_env.py` serves the tests, and `repo_checks/` tests the repo itself.
Test on the host, with `uv` on `PATH` to fetch mypy and the Python version Install names (`docs/decisions.md` → `bin/`): `python3 -m unittest discover -s bin -p 'test_*.py'`
+1 -1
View File
@@ -116,7 +116,7 @@ def seat_places(body: str, labels: re.Pattern[str]) -> list[Place]:
listing = True
elif listing and line.startswith("- "):
places += bullet_places(line)
elif line and not line.startswith(" "):
elif not line.startswith(" "):
listing = False
return places
+14 -7
View File
@@ -5,7 +5,7 @@ usage: larv-review ruling-base | round-count | needs-scoring-run [<item ID>...]
The comprehension check keeps a project from reading worse, two ways. In a paired ruling, seats read
the branch's head beside a base and vote better, same or worse, overall and on each dimension; a
worse ruling blocks the merge, which is the ratchet. In a scoring run, four seats score the project
from 1 to 10; a mean under the floor of {floor} blocks the merge.
from 1 to 10; a mean under the floor of {floor} blocks the merge, unless you decide to ship.
Run it inside a project checkout or one of its worktrees. Each command but record-ruling first
fetches origin, when the checkout has that remote, and takes origin's default branch, or else the
@@ -19,10 +19,10 @@ history, or whose last added paired ruling, by heading time, is better; a merge
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 from the titles, ignoring case, of commits the default branch
does not hold that open `Answer <pass> round <n>:`: the highest <n>, or the number of such commits
where that is more. It marks each pass at the cap of {cap} rounds, telling you to ask the human
before another round, and each name in such a title that is not a pass.
round-count counts, for each pass, the commits not yet on the default branch whose titles open
`Answer <pass> round <n>:`, in any case: the highest <n>, or the number of such commits where that
is more. It marks a pass at or past the cap of {cap} rounds, telling you to ask the human before
another round, and each name in such a title that is not a pass.
needs-scoring-run takes the IDs of the todo.md items the chunk ships, none when it ships none, and
prints why the chunk is due a scoring run, or `No scoring run due.` It is due when the chunk ships
@@ -77,7 +77,8 @@ time and the seats file's first line. Each commit that line names must be in the
when the history already holds an entry on what that line reads.
Exit 1, saying why, on unknown arguments, an unknown item ID, a seats file it cannot read or that
breaks the shape above, or when git cannot start, finds no checkout or no default branch, cannot
breaks the shape above, a scores file record-ruling did not call for or one naming another commit,
or when git cannot start, finds no checkout or no default branch, cannot
fetch origin for ruling-base, needs-scoring-run or record-scoring, or cannot read or write the history or todo.md.
"""
import pathlib
@@ -160,10 +161,16 @@ def round_count(default: str) -> Failure | None:
if isinstance(titles, Failure):
return titles
for name, count in round_counts(titles.splitlines()).items():
print(f"{name}: {count}{', at the cap: ask the human before another round' if count >= CAP else ''}{'' if name in PASSES else ', not a pass: check the commit title'}")
print(f"{name}: {count}{cap_note(count) if name in PASSES else ', not a pass: check the commit title'}")
return None
def cap_note(count: int) -> str:
if count < CAP:
return ""
return f", {'at' if count == CAP else 'past'} the cap: ask the human before another round"
def needs_scoring_run(default: str, ids: list[int]) -> Failure | None:
reasons = plan_reasons(default, ids)
if isinstance(reasons, Failure):
+2 -1
View File
@@ -30,7 +30,8 @@ def record_ruling(votes_file: pathlib.Path, scores_file: pathlib.Path | None = N
scoring = None
notes = []
if not fell and scores_file:
return Failure("a worse ruling takes no scores file" if ruled == "worse" else f"no dimension fell in this {ruled} ruling, so it takes no scores file")
why = "a worse ruling takes no scores file" if ruled == "worse" else f"no dimension fell in this {ruled} ruling, so it takes no scores file"
return Failure(f"{why}; run record-ruling again with the votes file alone")
if fell and not scores_file:
print(f"Fell: {', '.join(fell)}, in a {ruled} ruling. Launch the four scoring seats on {heading_read.label} at {heading_read.commit}, write their lines to a scores file, and run this again with both files.")
return None
+1 -1
View File
@@ -19,7 +19,7 @@ def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure:
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 not split([first, second]):
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
+3 -1
View File
@@ -337,7 +337,9 @@ class LarvReviewTool(unittest.TestCase):
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertNotIn("Fell:", ran.stdout + (self.checkout / "docs" / "comprehension-history.md").read_text())
extra = self.run_tool("record-ruling", self.seats_file(f"PR #3 at {self.start}, against {self.start}\n\nMid A: {said('worse')}{place}Inherited architect: {said('worse')}{place}"), self.seats_file("PR #2", "scores.md"))
self.assertIn("takes no scores file", extra.stderr)
self.assertIn("a worse ruling takes no scores file; run record-ruling again with the votes file alone", extra.stderr)
better = self.run_tool("record-ruling", self.seats_file(f"PR #5 at {self.start}, against {self.start}\n\nMid A: {said('better')}{place}Inherited architect: {said('better')}{place}"), self.seats_file("PR #5", "scores.md"))
self.assertIn("no dimension fell in this better ruling, so it takes no scores file", better.stderr)
def test_records_a_scoring_run_with_its_means(self):
line = "Navigation 7, Locality 6.5, Shape 7, Self-sufficiency 6.5, Overall 7"
+1 -1
View File
@@ -15,5 +15,5 @@ class Types(unittest.TestCase):
self.assertIsNotNone(floor, "README.md's Install names `Python 3.N or newer`")
if shutil.which("uv") is None:
self.fail("uv on PATH fetches mypy; see README.md's Test line")
ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "--exclude", "/test_", "-p", "claude_code", "-m", "comprehension_history", "-p", "larv_review", "-p", "loop_claude", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-p", "reading_cost", "-m", "statusline", "-m", "todo_table", "-m", "utc_stamp", "-m", "markdown_text", "-p", "transcript_archive"], capture_output=True, cwd=ROOT / "bin", text=True)
ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "--exclude", "/test_", "-p", "claude_code", "-m", "comprehension_history", "-p", "larv_review", "-p", "loop_claude", "-m", "markdown_text", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-p", "reading_cost", "-m", "statusline", "-m", "todo_table", "-p", "transcript_archive", "-m", "utc_stamp"], capture_output=True, cwd=ROOT / "bin", text=True)
self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr)
+1 -1
View File
@@ -6,7 +6,7 @@ A scoring-run seat's prompt is the opening, the seat's background, the shared br
- `{main}`: the project's main checkout.
- `{forbidden}`: `todo.md, docs/decisions.md, docs/comprehension-history.md or docs/reading-cost.md (the plan, the decision log, past panels' records and past chunks' reading cost)`.
- `{git}`: `git -C {checkout} ls-files`, and for a paired seat also `git -C {base checkout} ls-files`, each in backticks.
- `{files}`: every tracked non-test file but those `{forbidden}` names, from `git -C {checkout} ls-files`, listed as one recursive glob per top-level source directory, with the test files it would take in named as left out, such as `bin/**/*.py` except `test_*.py`.
- `{files}`: every tracked non-test file but those `{forbidden}` names, from `git -C {checkout} ls-files`, listed as one recursive glob per top-level source directory, plus each file a glob misses, naming the test files a glob would match as left out, such as `bin/**/*.py` except `test_*.py`, and the launchers `bin/larv-review`, `bin/loop-claude`, `bin/metric-bench` and `bin/reading-cost`.
- `{preloaded}`: the files the harness pre-loads into a seat, found per `SKILL.md` → "What makes the result trustworthy".
- `{anchors}` and `{dimensions}`: the six anchor bullets and the four dimension bullets in `SKILL.md` → "The score", verbatim, without bold and each on one line.
- `{language}`, `{kind}`, `{domain}`, `{domain docs}` and `{3am question}`: the project's `AGENTS.md` → "Scoring run".
-7
View File
@@ -31,7 +31,6 @@
| 59 | 0.1.0 | | **Bound a run of unfinished verdicts on one chunk, so a worker and judge that disagree cannot cycle unattended without end.** | 3 | 3 | 6 | 6 | 1.4 | 19.8 |
| 12 | 0.1.0 | | **Run the test suite in CI on every PR, or record in `docs/decisions.md` why the local run is enough.** | 2 | 4 | 4 | 6 | 1.1 | 16.9 |
| 80 | 0.1.0 | | **State in README → Install that every machine taking this checkout must be a sandbox, as `settings.json`'s auto mode assumes.** | 1 | 1 | 5 | 5 | 4 | 16.8 |
| 83 | 0.1.0 | | **Group `bin/` by tool, so each tool's modules and tests sit together.** | 3 | 4 | 4 | 6 | 1.1 | 15.9 |
| 5 | 0.1.0 | decision | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 5 | 5 | 5 | 6 | 1.1 | 15.6 |
| 84 | 0.1.0 | | **Check, at each release's scoring run, that seats in a paired ruling agree more often than two scoring runs on near-identical code do, as the paired-ruling decision assumes.** | 2 | 2 | 4 | 5 | 1.4 | 15.1 |
| 67 | 0.1.0 | principle | **Point stability-reviewer at the technical principles in place of its own restatement of them.** | 2 | 3 | 4 | 5 | 1.3 | 14.9 |
@@ -88,12 +87,6 @@ The repo has no CI, so larv-review's gate is the local run, and larv-review's Ga
Raised by the principles audit of PR #224. The `settings.json` decision is valid while every machine taking this checkout is a sandbox, but Install asks for a sandbox only for `loop-claude`, so a new machine is never told.
### 83. Group `bin/` by tool, so each tool's modules and tests sit together.
Raised by the architect on PR #225 and by the inherited architect of PR #224's scoring run: `bin/` is one flat folder of tools, the modules they share and the repo's checks, with `loop_claude`'s tests beside them instead of beside the package. `loop_claude/claude_code/` parses Claude Code's own formats and `bin/reading_cost/measure.py` imports it too, so it is a package of its own.
2026-10-09, from two architecture studies on PR #232: lift `loop_claude/claude_code/` and the archive's layout out of `loop_claude/` into packages of their own, `claude_code/` and `transcript_archive/`, so `reading_cost` imports no tool. `transcript_archive` takes the write side (`archive`), the read side (`finished_chunks`, `FinishedChunk`, the stamps) and one `project_archive(checkout_root, home, env)` that both tools call, which derives the archive key one way, as item 5 asks. Move each tool's tests beside its package, and `test_loop_claude_black_box.host_env`, which three other tools' tests import, into a test helper of its own.
### 5. Key a project on its checkout's full path, and refuse to start while another session uses that key.
The key names the project's session, archive folder and models entry. `project_key` drops the leading `/`, so `~/code/a` and `/a` share all three, and one loop can resume or delete the other's session.