From 92867f64cd13d7934923e951bd46e3a7f1a1acb3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 10 Nov 2026 23:45:06 +0100 Subject: [PATCH 01/10] Refuse chunk-pr merge while a scoring run the plan calls is unrecorded, and call one for a release cut with none --- bin/chunk_pr/main.py | 9 ++++- bin/chunk_pr/test_chunk_pr.py | 11 +++++- bin/larv_review/main.py | 24 +++++++++++- bin/larv_review/owed.py | 45 +++++++++++++++++++++ bin/larv_review/plan.py | 26 ++++++++---- bin/larv_review/test_larv_review.py | 61 +++++++++++++++++++++++++++++ bin/larv_review/unmeasured.py | 34 ++++++++++++++++ docs/reading-cost.md | 8 ++++ skills/larv-review/SKILL.md | 1 + 9 files changed, 208 insertions(+), 11 deletions(-) create mode 100644 bin/larv_review/owed.py create mode 100644 bin/larv_review/unmeasured.py diff --git a/bin/chunk_pr/main.py b/bin/chunk_pr/main.py index c2fed835..a752c79b 100644 --- a/bin/chunk_pr/main.py +++ b/bin/chunk_pr/main.py @@ -18,7 +18,9 @@ merge merges the pull request, and only while its head is still the commit ch push after the gate is never merged. It takes the first method the repository allows of: a merge commit, fast-forward only, a rebase followed by a merge commit, a rebase, a squash. GitHub offers only the merge commit, the rebase and the squash. --gate-passed says the - merge gate passed on that commit; without it, chunk-pr refuses. + merge gate passed on that commit; without it, chunk-pr refuses. It also refuses where + `larv-review scoring-run-owed` exits 1: the chunk owes a scoring run it has not recorded, + which no flag waives. clean acts once the forge reports the branch's pull request merged at the commit checked out, by any merge method. It fetches origin, fast-forwards the main checkout to origin's default branch, removes the chunk's worktree, then deletes the local branch; origin's @@ -32,6 +34,7 @@ It prints what it did, exit 0, or why it failed, exit 1. import dataclasses import json import os +import pathlib import sys import typing @@ -40,6 +43,7 @@ from chunk_preflight.gathered import Forge from chunk_preflight.choices import forge_of from deploy_release.forge import gitea, merged_pull, open_pull, Run, runner +BIN = pathlib.Path(__file__).resolve().parents[1] USAGE = "usage: chunk-pr open [<body>] | chunk-pr ready | chunk-pr merge --gate-passed | chunk-pr clean" # Each forge's merge methods in the order merge prefers them, as the repository setting that allows the method and the method's name in the forge's merge call. A merge commit and a fast-forward keep the branch's commits as they are; a rebase or a squash rewrites them. @@ -157,6 +161,9 @@ def merged(run: Run) -> str | Failure: if isinstance(found, Failure): return found forge, number, head = found + owed = run([str(BIN / "larv-review"), "scoring-run-owed"]) + if isinstance(owed, Failure): + return owed method = merge_method(forge, run) if isinstance(method, Failure): return method diff --git a/bin/chunk_pr/test_chunk_pr.py b/bin/chunk_pr/test_chunk_pr.py index 6efed6e0..1dcc022c 100644 --- a/bin/chunk_pr/test_chunk_pr.py +++ b/bin/chunk_pr/test_chunk_pr.py @@ -21,6 +21,7 @@ GH_LIST = ["gh", "pr", "list", "--head", "item-7", "--json", "number,headRefOid, TEA_LIST = ["tea", "api", "repos/{owner}/{repo}/pulls?state=open&limit=50"] GH_SETTINGS = ["gh", "repo", "view", "--json", "mergeCommitAllowed,rebaseMergeAllowed,squashMergeAllowed"] TEA_SETTINGS = ["tea", "api", "repos/{owner}/{repo}"] +OWED = [str(pathlib.Path(__file__).resolve().parents[1] / "larv-review"), "scoring-run-owed"] class Checkout: @@ -58,7 +59,7 @@ class Checkout: def acted(self) -> list[list[str]]: """What it ran beyond reading the checkout, the pull requests and the repository's settings.""" - reads = [GH_LIST, TEA_LIST, GH_SETTINGS, TEA_SETTINGS] + reads = [GH_LIST, TEA_LIST, GH_SETTINGS, TEA_SETTINGS, OWED] return [command for command in self.ran if tuple(command) not in self.answers and command not in reads] @@ -137,6 +138,14 @@ class Merge(unittest.TestCase): self.assertIsInstance(step(["merge"], checkout), Failure) self.assertEqual(checkout.ran, []) + def test_a_scoring_run_the_chunk_owes_and_has_not_recorded_refuses_the_merge(self): + for origin in (GITHUB, GITEA): + with self.subTest(origin=origin): + checkout = Checkout(origin, open=True) + checkout.answers[tuple(OWED)] = Failure("larv-review scoring-run-owed: the chunk owes 2 scoring runs") + self.assertEqual(step(["merge", "--gate-passed"], checkout), Failure("larv-review scoring-run-owed: the chunk owes 2 scoring runs")) + self.assertEqual(checkout.acted(), []) + def test_github_merges_with_a_merge_commit_pinned_to_the_head(self): checkout = Checkout(GITHUB, open=True, allowed=("squashMergeAllowed", "mergeCommitAllowed")) self.assertEqual(step(["merge", "--gate-passed"], checkout), "Merged pull request #12 (merge).") diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index b2412130..12e2ca7a 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -1,6 +1,6 @@ """Hold larv-review's mechanical rules: the chunk's review folder, the paired ruling's base and vote count, each pass's rounds, the scoring run's trigger; the comprehension history's format, its latest places and its count of how often seats agree; and the header of each reviewer's prompt. -usage: larv-review review-folder | ruling-base | round-count | needs-scoring-run [<item ID>...] | record-ruling <votes file> | record-scoring <scores file> [<item ID>...] | places | agreement | reviewer-header <pass> [--rerun] +usage: larv-review review-folder | ruling-base | round-count | needs-scoring-run [<item ID>...] | scoring-run-owed | record-ruling <votes file> | record-scoring <scores file> [<item ID>...] | places | agreement | reviewer-header <pass> [--rerun] The comprehension check records how hard a project is to read, two ways, and blocks no merge. In a paired ruling, simulated readers, the seats, read the branch's head beside a base and vote better, @@ -36,6 +36,16 @@ an item whose tagline names the comprehension floor. It is also due when the chu with no item in the checkout's todo.md, once the shipped items are set aside, and work has landed towards that release; bin/larv_review/plan.py's `work_landed` and `landed_towards` say when. A release the checkout's todo.md marks renamed in its ## Renamed section, as `- 0.2.1 renamed to 0.3.0`, is due none. +It is also due while no scoring run in the default branch's history is newer than the commit of its +second-newest v* tag, so a release cut unmeasured is caught up by the next chunk. + +scoring-run-owed prints `No scoring run owed.` or exits 1 saying which scoring runs the chunk owes and +has not recorded. It reads the plan at the moment it runs: the items the default branch's todo.md +holds and the checkout's does not count as shipped, and the due rule is needs-scoring-run's. A chunk +that empties a release owes two runs, any other due chunk one. The branch records a run when its +docs/comprehension-history.md holds a scoring run that the default branch's lacks. A project whose +docs/decisions.md opts out of the comprehension check, or whose checkout has no todo.md, owes none. +chunk-pr merge runs it and refuses to merge on exit 1. A second scoring run of one head names itself `<PR or branch> rerun at <commit>`, so record-scoring does not refuse it as a repeat of the first. @@ -126,12 +136,13 @@ from larv_review.history_changes import history_changes from review_rules.review_folder import made_review_folder from larv_review.ruling_base import measured_commit from larv_review.agreement import MIN_PAIRS +from larv_review.owed import owed_scoring_run from review_rules.review_passes import PASSES, REVIEWERS from larv_review.plan import plan_reasons from larv_review.history_commands import record_ruling, record_scoring, show_agreement, show_places from larv_review.reviewer_header import reviewer_header -USAGE = "usage: larv-review review-folder | ruling-base | round-count | needs-scoring-run [<item ID>...] | record-ruling <votes file> | record-scoring <scores file> [<item ID>...] | places | agreement | reviewer-header <pass> [--rerun]" +USAGE = "usage: larv-review review-folder | ruling-base | round-count | needs-scoring-run [<item ID>...] | scoring-run-owed | record-ruling <votes file> | record-scoring <scores file> [<item ID>...] | places | agreement | reviewer-header <pass> [--rerun]" def main(argv: list[str]) -> int: @@ -147,6 +158,8 @@ def main(argv: list[str]) -> int: done = with_default_branch(round_count, stale_ok=True) elif command == "needs-scoring-run" and all(re.fullmatch(r"[0-9]+", id_) for id_ in given): done = with_default_branch(lambda default: needs_scoring_run(default, [int(id_) for id_ in given]), stale_ok=False) + elif command == "scoring-run-owed" and not given: + done = with_default_branch(owed, stale_ok=False) elif command == "record-ruling" and len(given) == 1: done = record_ruling(pathlib.Path(given[0])) elif command == "record-scoring" and given and all(re.fullmatch(r"[0-9]+", id_) for id_ in given[1:]): @@ -223,6 +236,13 @@ def cap_note(count: int, most: int) -> str: return f", {'at' if count == most else 'past'} the cap: no more rounds" +def owed(default: str) -> Failure | None: + unrecorded = owed_scoring_run(default) + if unrecorded is None: + print("No scoring run owed.") + return unrecorded + + def needs_scoring_run(default: str, ids: list[int]) -> Failure | None: reasons = plan_reasons(default, ids) if isinstance(reasons, Failure): diff --git a/bin/larv_review/owed.py b/bin/larv_review/owed.py new file mode 100644 index 00000000..c2467ba8 --- /dev/null +++ b/bin/larv_review/owed.py @@ -0,0 +1,45 @@ +import pathlib + +from larv_review.plan import EMPTIED_WORDS, plan_reasons +from review_rules.comprehension_history import entries, HISTORY +from failure import Failure +from git_cli.git_repo import file_at, top +from larv_review.history_commands import history_file +from release_plan.ranking import OPTED_OUT + + +def owed_scoring_run(default: str) -> Failure | None: + """A Failure saying which scoring runs the chunk owes and has not recorded; None where it owes none. + + The chunk owes the runs the plan calls (`plan_reasons`, which takes the chunk's shipped items as the plan's removed ones): two where it empties a release, else one. The branch records a run when its history holds a scoring run the default branch's lacks. A project that opts out of the comprehension check, or has no todo.md, owes none. Run at merge time, it reads the plan as it stands then, so a due line that preflight printed from an older plan can't stand in for it. + """ + checkout = top() + if isinstance(checkout, Failure): + return checkout + if not pathlib.Path(checkout, "todo.md").exists(): + return None + decisions = file_at(default, "docs/decisions.md", checkout) + if isinstance(decisions, Failure): + return decisions + if OPTED_OUT.search(decisions): + return None + reasons = plan_reasons(default, None) + if isinstance(reasons, Failure): + return reasons + if not reasons: + return None + base = file_at(default, HISTORY, checkout) + if isinstance(base, Failure): + return base + head = history_file() + if isinstance(head, Failure): + return head + recorded = len(scoring_runs(head[1])) - len(scoring_runs(base)) + needed = 2 if any(reason.endswith(EMPTIED_WORDS) for reason in reasons) else 1 + if recorded >= needed: + return None + return Failure(f"the chunk owes {needed} scoring run{'s' if needed > 1 else ''}, since it {' and '.join(reasons)}, and the branch records {max(recorded, 0)} of {needed}: launch the four seats on the head and record each run with `larv-review record-scoring`, as larv-review's SKILL.md → 'Scoring run' says") + + +def scoring_runs(history: str) -> list[str]: + return [entry.heading for entry in entries(history) if not entry.paired] diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index facd184a..1bd02a14 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -6,24 +6,31 @@ from larv_review.scoring import FLOOR_ITEM from release_plan.todo_table import Item, items, NoItemsTable, renames from release_plan.release import Release, version from git_cli.git_repo import top +from larv_review.unmeasured import unmeasured_cut -def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed_release: Release | None, renamed: set[Release]) -> list[str] | Failure: +# What a reason that a chunk empties a release ends with; such a chunk is due two scoring runs, any other reason one. +EMPTIED_WORDS = "with no plan item" + + +def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed_release: Release | None, renamed: set[Release], unmeasured: str | None = None) -> list[str] | Failure: """Why the plan calls a scoring run, empty when it does not. - A chunk that ships an item naming the floor is due one, so it can prove the floor met. So is a chunk that empties a release after work has landed towards it, so no release ends unmeasured. A release the chunk's plan marks renamed is due none. + A chunk that ships an item naming the floor is due one, so it can prove the floor met. So is a chunk that empties a release after work has landed towards it, so no release ends unmeasured. A release the chunk's plan marks renamed is due none. A chunk after a release `unmeasured_cut` names is due one too, so a release cut with no scoring run is caught up. - before is the default branch's plan and after the chunk's. ships holds the IDs of the items the chunk ships. landed_release is the next release where work has landed towards it, else None (`landed_towards`). renamed holds the releases the chunk's plan marks renamed. + before is the default branch's plan and after the chunk's. ships holds the IDs of the items the chunk ships. landed_release is the next release where work has landed towards it, else None (`landed_towards`). renamed holds the releases the chunk's plan marks renamed. unmeasured is `unmeasured_cut`'s answer. """ 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 FLOOR_ITEM in item.tagline.lower()] + if unmeasured: + reasons.append(f"follows {unmeasured}") for release in emptied(before, after, shipped, renamed): if work_landed(release, shipped, landed_release): # SKILL.md → "Second run" keys on this wording. - reasons.append(f"leaves release {version(release)} with no plan item") + reasons.append(f"leaves release {version(release)} {EMPTIED_WORDS}") return reasons @@ -55,8 +62,8 @@ def emptied(before: list[Item], after: list[Item], shipped: list[Item], renamed: return sorted(named - {item.release for item in kept} - renamed) -def plan_reasons(default: str, ids: list[int]) -> list[str] | Failure: - """Why the plan calls a scoring run, from the default branch's todo.md and the checkout's.""" +def plan_reasons(default: str, ids: list[int] | None) -> list[str] | Failure: + """Why the plan calls a scoring run, from the default branch's todo.md and the checkout's. Where ids is None, the chunk ships each item the default branch's plan holds and the checkout's does not.""" checkout = top() if isinstance(checkout, Failure): return checkout @@ -80,7 +87,12 @@ def plan_reasons(default: str, ids: list[int]) -> list[str] | Failure: landed_release = landed_towards(planned, held.cut) if isinstance(landed_release, Failure): return landed_release - return scoring_run_due(planned, chunk, ids, landed_release, renamed) + unmeasured = unmeasured_cut(default, checkout) + if isinstance(unmeasured, Failure): + return unmeasured + if ids is None: + ids = sorted({item.id for item in planned} - {item.id for item in chunk}) + return scoring_run_due(planned, chunk, ids, landed_release, renamed, unmeasured) def checkout_plan(checkout: str) -> tuple[str, list[Item]] | Failure: diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index f7a8a488..97430ac7 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -502,6 +502,67 @@ class LarvReviewTool(unittest.TestCase): self.assertEqual(self.run_tool("needs-scoring-run").stdout, "No scoring run due.\n") self.assertIn("todo.md's ID column", self.run_tool("needs-scoring-run", "item-85").stderr) + def test_a_scoring_run_that_a_release_ending_chunk_owes_is_refused_until_the_branch_records_two(self): + rest = ("| 2 | 0.2.0 | | **Then this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", "| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |") + self.commit("Ship item 1", {"todo.md": todo(*rest)}) + owed = self.run_tool("scoring-run-owed") + self.assertEqual(owed.returncode, 1) + self.assertIn("leaves release 0.1.0 with no plan item", owed.stderr) + self.assertIn("records 0 of 2", owed.stderr) + history = "# Comprehension history\n\n" + SCORING + self.commit("Record a run", {"docs/comprehension-history.md": history}) + self.assertIn("records 1 of 2", self.run_tool("scoring-run-owed").stderr) + self.commit("Record a rerun", {"docs/comprehension-history.md": history + "\n" + SCORING.replace("PR #1 at", "PR #1 rerun at")}) + done = self.run_tool("scoring-run-owed") + self.assertEqual((done.returncode, done.stdout), (0, "No scoring run owed.\n"), done.stderr) + + def test_a_scoring_run_the_floor_calls_is_owed_once(self): + row = "| 1 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |" + other = "| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |" + self.commit("Plan the floor item", {"todo.md": todo(row, "| 2 | 0.2.0 | | **Reach the comprehension floor.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", other)}) + self.git("push", "-q", "origin", "HEAD:main") + self.commit("Ship it", {"todo.md": todo(row, other)}) + self.assertIn("names the comprehension floor", self.run_tool("scoring-run-owed").stderr) + self.commit("Record a run", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING}) + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 0) + + def test_no_scoring_run_is_owed_where_none_is_due_the_project_opts_out_or_it_has_no_plan(self): + self.commit("Ship item 2", {"todo.md": todo("| 1 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", "| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |")}) + self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + self.commit("Ship item 1", {"todo.md": todo("| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |")}) + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 1) + self.git("switch", "-q", "main") + self.commit("Opt out", {"docs/decisions.md": "## review opt-out: the comprehension check\n\n2026-11-10, lilleman.\n"}) + self.git("push", "-q", "origin", "HEAD:main") + self.git("switch", "-q", "chunk") + self.git("merge", "-q", "main") + self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + self.git("rm", "-q", "todo.md") + self.commit("Drop the plan") + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 0) + + def release(self, tag, date, files=None): + """Cut tag on the default branch at a commit dated date.""" + self.env["GIT_COMMITTER_DATE"] = date + self.addCleanup(self.env.pop, "GIT_COMMITTER_DATE", None) + self.commit(f"Release {tag}", files) + self.git("tag", tag) + self.git("push", "-q", "origin", "HEAD:main") + + def test_a_release_cut_with_no_scoring_run_since_the_one_before_it_calls_one_and_a_later_run_ends_that(self): + self.release("v0.0.1", "2026-10-09T12:00:00Z") + self.release("v0.0.2", "2026-10-20T12:00:00Z", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING}) + self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, "Scoring run due: the chunk follows v0.0.2, cut with no scoring run since v0.0.1.\n") + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 1) + self.commit("Record a run", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING + "\n" + SCORING.replace("PR #1 at", "PR #2 at")}) + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 0) + self.release("v0.0.3", "2026-10-21T12:00:00Z", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING.replace("2026-10-08T12", "2026-10-20T18")}) + self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, "No scoring run due.\n") + + def test_one_release_alone_calls_no_scoring_run_for_lacking_one(self): + self.release("v0.0.1", "2026-10-09T12:00:00Z") + self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, "No scoring run due.\n") + def test_calls_a_scoring_run_for_a_deferred_release_and_none_for_one_the_checkouts_plan_marks_renamed(self): rows = ("| 1 | 0.2.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", "| 2 | 0.2.0 | | **Then this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", "| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |") self.commit("Move 0.1.0's item to 0.2.0", {"todo.md": todo(*rows)}) diff --git a/bin/larv_review/unmeasured.py b/bin/larv_review/unmeasured.py new file mode 100644 index 00000000..a55833b9 --- /dev/null +++ b/bin/larv_review/unmeasured.py @@ -0,0 +1,34 @@ +import datetime + +from review_rules.comprehension_history import entries, HISTORY +from failure import Failure +from git_cli.git_repo import file_at, git + + +def unmeasured_cut(default: str, checkout: str) -> str | None | Failure: + """The default branch's newest release, named with the one before it, where no scoring run in the default branch's history is newer than that earlier release's tag: `v0.7.0, cut with no scoring run since v0.6.0`. None where it holds fewer than two release tags, or a run since the earlier one. + + A scoring run counts by the time its history heading records, against the tag's commit time; a heading whose time doesn't parse counts for nothing, so the run is asked for again. + """ + # Sorts v1.0.0-rc.1 below v1.0.0, as release.newest_tag does. + tags = git("-c", "versionsort.suffix=-", "tag", "--list", "v*", "--merged", default, "--sort=-v:refname", cwd=checkout) + if isinstance(tags, Failure): + return tags + newest, earlier, *_ = [*tags.split(), None, None] + if earlier is None: + return None + since = git("log", "-1", "--format=%ct", earlier, cwd=checkout) + history = file_at(default, HISTORY, checkout) + if isinstance(since, Failure) or isinstance(history, Failure): + return since if isinstance(since, Failure) else history + if any(at > int(since) for at in (seconds(entry.time) for entry in entries(history) if not entry.paired)): + return None + return f"{newest}, cut with no scoring run since {earlier}" + + +def seconds(heading_time: str) -> float: + """A history heading's UTC time as seconds since the epoch; 0 where it doesn't parse.""" + try: + return datetime.datetime.strptime(heading_time, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=datetime.timezone.utc).timestamp() + except ValueError: + return 0 diff --git a/docs/reading-cost.md b/docs/reading-cost.md index bdfa96a5..f94e43cc 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -1528,3 +1528,11 @@ Read most (opens and searches): Read most (opens and searches): - `todo.md` 5 + +## Reading cost, chunk 31a25a029608, finished 2026-11-10T22:36:58Z + +40731 new input tokens before the first commit. + +Read most (opens and searches): + +- `todo.md` 1 diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index c18e27e4..a2a92483 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -148,6 +148,7 @@ The comprehension check records how hard the project is for its contributor to r - **Seats.** Junior A, Mid A, the maintainability senior and the inherited architect each score the project at the head from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. Write their lines into a scores file and run `~/.claude/bin/larv-review record-scoring <scores file> <the same item IDs>`, which appends the run to the history and prints the four seats' means. - **Floor item.** Where `record-scoring` prints `Floor:`, a `Next:` line follows: file one floor item, or refresh the open one. A floor item is a plan item meant to bring every mean to 7.0. File it as one ambitious refactor, not touch-ups. It restructures the area behind the places `larv-review places` prints for this run, chosen where they bear on the lowest dimension, sized to bring every mean to 7.0, and quotes those places. Its tagline holds the words `comprehension floor`, so its own chunk runs a scoring run; while a mean stays under 7.0, that run's `Next:` line asks for the next floor item. Mark it `owner`, since the human asked that such a project always hold one, so no score deletes it. Put it in the earliest release the plan names after the one the chunk ships into, or else in the next version after that one that `~/.claude/rules/todo-items.md` allows, so the floor doesn't hold up any release. While one is open, refresh its places and aim from the newest run instead of filing another; the item the chunk ships doesn't count as open. Commit it with the run, as "Record" says. +- **Owed.** `chunk-pr merge` runs `~/.claude/bin/larv-review scoring-run-owed` against the plan as it stands at merge time and refuses while the run the plan calls is unrecorded on the branch. A due line from earlier in the chunk, such as `chunk-preflight`'s, is a snapshot: the merge gate decides. - **Second run.** Where `needs-scoring-run` printed that the chunk `leaves release … with no plan item`, launch the same four seats afresh on the same head. Their scores file's first line is `<PR or branch> rerun at <commit>`. Record it with the same `record-scoring` command. - **Agreement.** After the second run, run `~/.claude/bin/larv-review agreement` and put its counts in the summary. On `Assumption fails:`, ask the user whether to keep the paired ruling or change the decision `review: the comprehension check records …`. Record the answer as a decision in the repo whose history was counted, with the counts that led to the ask. A later run asks again only when the rulings' rate falls, or the runs' rate rises, against the recorded counts. -- 2.52.0 From 1c6e04c8b89b165c3ba327433cd63f8a0d6d0048 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Tue, 10 Nov 2026 23:45:35 +0100 Subject: [PATCH 02/10] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From e69eb982bc016a76b5ecaaec2ce5db78764ef04d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Tue, 10 Nov 2026 23:59:10 +0100 Subject: [PATCH 03/10] =?UTF-8?q?Answer=20stability=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=206=20=F0=9F=9F=A1=20(0=20misread);=20read=20the?= =?UTF-8?q?=20owed=20runs=20against=20the=20merge=20base=20and=20committed?= =?UTF-8?q?=20history,=20skip=20a=20project=20with=20no=20plan=20table,=20?= =?UTF-8?q?cover=20the=20surviving=20mutants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/chunk_pr/main.py | 4 +- bin/larv_review/main.py | 26 +++++----- bin/larv_review/owed.py | 49 +++++++++++------- bin/larv_review/plan.py | 12 +++-- bin/larv_review/test_larv_review.py | 78 ++++++++++++++++++++++++++--- bin/larv_review/unmeasured.py | 4 +- skills/larv-review/SKILL.md | 7 ++- 7 files changed, 133 insertions(+), 47 deletions(-) diff --git a/bin/chunk_pr/main.py b/bin/chunk_pr/main.py index a752c79b..f39efc9c 100644 --- a/bin/chunk_pr/main.py +++ b/bin/chunk_pr/main.py @@ -19,8 +19,8 @@ merge merges the pull request, and only while its head is still the commit ch a merge commit, fast-forward only, a rebase followed by a merge commit, a rebase, a squash. GitHub offers only the merge commit, the rebase and the squash. --gate-passed says the merge gate passed on that commit; without it, chunk-pr refuses. It also refuses where - `larv-review scoring-run-owed` exits 1: the chunk owes a scoring run it has not recorded, - which no flag waives. + `larv-review scoring-run-owed` exits 1, because the chunk owes a scoring run it has not + recorded; no flag waives that. clean acts once the forge reports the branch's pull request merged at the commit checked out, by any merge method. It fetches origin, fast-forwards the main checkout to origin's default branch, removes the chunk's worktree, then deletes the local branch; origin's diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index 12e2ca7a..28f9ca98 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -2,7 +2,7 @@ usage: larv-review review-folder | ruling-base | round-count | needs-scoring-run [<item ID>...] | scoring-run-owed | record-ruling <votes file> | record-scoring <scores file> [<item ID>...] | places | agreement | reviewer-header <pass> [--rerun] -The comprehension check records how hard a project is to read, two ways, and blocks no merge. In a +The comprehension check records how hard a project is to read, two ways, and no score blocks a merge. In a paired ruling, simulated readers, the seats, read the branch's head beside a base and vote better, same or worse, overall and on each dimension. In a scoring run, four seats score the project from 1 to 10. Each seat names the places it found hard. @@ -11,7 +11,7 @@ Run it inside a project checkout or one of its worktrees. Each command but revie record-ruling, places and agreement first fetches origin, when the checkout has that remote, and takes origin's default branch, or else the local main or master, as the default branch. When the fetch fails, round-count and reviewer-header read origin as last fetched and say so on stderr; the -other three exit 1. +other four exit 1. The history is docs/comprehension-history.md in the checkout. review-folder makes the chunk's review folder, where each reviewer writes its report, and prints its @@ -36,16 +36,18 @@ an item whose tagline names the comprehension floor. It is also due when the chu with no item in the checkout's todo.md, once the shipped items are set aside, and work has landed towards that release; bin/larv_review/plan.py's `work_landed` and `landed_towards` say when. A release the checkout's todo.md marks renamed in its ## Renamed section, as `- 0.2.1 renamed to 0.3.0`, is due none. -It is also due while no scoring run in the default branch's history is newer than the commit of its -second-newest v* tag, so a release cut unmeasured is caught up by the next chunk. +A chunk is also due one while no scoring run in the default branch's history is newer than the +commit of its second-newest v* tag, so a release cut unmeasured is caught up by the next chunk. A project whose +docs/decisions.md opts out of the comprehension check is never due one. -scoring-run-owed prints `No scoring run owed.` or exits 1 saying which scoring runs the chunk owes and -has not recorded. It reads the plan at the moment it runs: the items the default branch's todo.md -holds and the checkout's does not count as shipped, and the due rule is needs-scoring-run's. A chunk -that empties a release owes two runs, any other due chunk one. The branch records a run when its -docs/comprehension-history.md holds a scoring run that the default branch's lacks. A project whose -docs/decisions.md opts out of the comprehension check, or whose checkout has no todo.md, owes none. -chunk-pr merge runs it and refuses to merge on exit 1. +scoring-run-owed prints `No scoring run owed.` or exits 1 naming the runs the chunk owes and has +not recorded. chunk-pr merge runs it and refuses to merge on exit 1, so a due line read earlier in +the chunk can't stand in for it. It applies needs-scoring-run's rule to the branch as committed, against the +merge base with the default branch, so a default branch that has moved on adds nothing: the items +the merge base's todo.md holds and the checkout's does not count as shipped. A chunk that empties a +release owes two runs, any other due chunk one. The chunk has recorded the scoring runs that its +committed docs/comprehension-history.md holds beyond the merge base's. A project that opts out or +has no todo.md items table owes none. A second scoring run of one head names itself `<PR or branch> rerun at <commit>`, so record-scoring does not refuse it as a repeat of the first. @@ -120,7 +122,7 @@ missing. Exit 1, saying why, on unknown arguments, an unknown item ID, a seats file it cannot read or that breaks the shape above, a todo.md that fails rank_todo.py after record-scoring records a run, 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, todo.md or the review +needs-scoring-run, scoring-run-owed or record-scoring, or cannot read or write the history, todo.md or the review folder. """ import pathlib diff --git a/bin/larv_review/owed.py b/bin/larv_review/owed.py index c2467ba8..cf221ecb 100644 --- a/bin/larv_review/owed.py +++ b/bin/larv_review/owed.py @@ -3,42 +3,53 @@ import pathlib from larv_review.plan import EMPTIED_WORDS, plan_reasons from review_rules.comprehension_history import entries, HISTORY from failure import Failure -from git_cli.git_repo import file_at, top -from larv_review.history_commands import history_file -from release_plan.ranking import OPTED_OUT +from git_cli.git_repo import file_at, git, top +from release_plan.todo_table import items, NoItemsTable def owed_scoring_run(default: str) -> Failure | None: """A Failure saying which scoring runs the chunk owes and has not recorded; None where it owes none. - The chunk owes the runs the plan calls (`plan_reasons`, which takes the chunk's shipped items as the plan's removed ones): two where it empties a release, else one. The branch records a run when its history holds a scoring run the default branch's lacks. A project that opts out of the comprehension check, or has no todo.md, owes none. Run at merge time, it reads the plan as it stands then, so a due line that preflight printed from an older plan can't stand in for it. + The chunk owes the runs `plan_reasons` calls, two where it empties a release, else one. It has recorded the scoring runs its committed history holds beyond those at the merge base, so a default branch that has moved on since the branch began counts for nothing. A project with no plan owes none. A missing run blocks the merge and a low score never does, which keeps the decision `review: the comprehension check records …`: it bars only scores from blocking. """ checkout = top() if isinstance(checkout, Failure): return checkout - if not pathlib.Path(checkout, "todo.md").exists(): + if not has_plan(checkout): return None - decisions = file_at(default, "docs/decisions.md", checkout) - if isinstance(decisions, Failure): - return decisions - if OPTED_OUT.search(decisions): - return None - reasons = plan_reasons(default, None) + base = git("merge-base", default, "HEAD", cwd=checkout) + if isinstance(base, Failure): + return base + reasons = plan_reasons(base.strip(), None) if isinstance(reasons, Failure): return reasons if not reasons: return None - base = file_at(default, HISTORY, checkout) - if isinstance(base, Failure): - return base - head = history_file() - if isinstance(head, Failure): - return head - recorded = len(scoring_runs(head[1])) - len(scoring_runs(base)) + before = file_at(base.strip(), HISTORY, checkout) + if isinstance(before, Failure): + return before + after = file_at("HEAD", HISTORY, checkout) + if isinstance(after, Failure): + return after + return shortfall(reasons, len(scoring_runs(after)) - len(scoring_runs(before))) + + +def shortfall(reasons: list[str], recorded: int) -> Failure | None: + """Which scoring runs the plan's reasons call that recorded, the count the branch added to the history, leaves unrecorded; None where it holds them all.""" needed = 2 if any(reason.endswith(EMPTIED_WORDS) for reason in reasons) else 1 if recorded >= needed: return None - return Failure(f"the chunk owes {needed} scoring run{'s' if needed > 1 else ''}, since it {' and '.join(reasons)}, and the branch records {max(recorded, 0)} of {needed}: launch the four seats on the head and record each run with `larv-review record-scoring`, as larv-review's SKILL.md → 'Scoring run' says") + return Failure(f"the chunk owes {needed} scoring run{'s' if needed > 1 else ''} and the branch's committed history records {max(recorded, 0)}: it {' and '.join(reasons)}. larv-review's SKILL.md → 'Scoring run' says how to run and record {'them' if needed > 1 else 'it'}; → 'Second run' says how the second is titled") + + +def has_plan(checkout: str) -> bool: + """Whether the checkout has a todo.md holding an items table. A file that can't be read counts, so `plan_reasons` reports it.""" + try: + return not isinstance(items(pathlib.Path(checkout, "todo.md").read_text(encoding="utf-8")), NoItemsTable) + except FileNotFoundError: + return False + except (OSError, UnicodeDecodeError): + return True def scoring_runs(history: str) -> list[str]: diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index 1bd02a14..5d478e51 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -2,14 +2,15 @@ import pathlib from release_plan.release_standing import Cut, default_plan, LastCut, next_release, Unknown from failure import Failure +from git_cli.git_repo import file_at, top from larv_review.scoring import FLOOR_ITEM from release_plan.todo_table import Item, items, NoItemsTable, renames +from release_plan.ranking import OPTED_OUT from release_plan.release import Release, version -from git_cli.git_repo import top from larv_review.unmeasured import unmeasured_cut -# What a reason that a chunk empties a release ends with; such a chunk is due two scoring runs, any other reason one. +# The words that end the reason a chunk empties a release. Such a chunk is due two scoring runs; a chunk with any other reason, one. EMPTIED_WORDS = "with no plan item" @@ -63,10 +64,15 @@ def emptied(before: list[Item], after: list[Item], shipped: list[Item], renamed: def plan_reasons(default: str, ids: list[int] | None) -> list[str] | Failure: - """Why the plan calls a scoring run, from the default branch's todo.md and the checkout's. Where ids is None, the chunk ships each item the default branch's plan holds and the checkout's does not.""" + """Why the plan calls a scoring run, from the default branch's todo.md and the checkout's; empty where the project opts out of the comprehension check. Where ids is None, the chunk ships each item the default branch's plan holds and the checkout's does not.""" checkout = top() if isinstance(checkout, Failure): return checkout + decisions = file_at(default, "docs/decisions.md", checkout) + if isinstance(decisions, Failure): + return decisions + if OPTED_OUT.search(decisions): + return [] held = default_plan(checkout, default) before = held.todo if isinstance(before, Failure): diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 97430ac7..cf6fa332 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -23,6 +23,7 @@ from release_plan.todo_table import Item, items, NoItemsTable from release_plan.release_standing import LastCut from larv_review.ruling_base import measured_commit from larv_review.seats import score_line, scores, seats_file, SeatsFile +from larv_review.owed import shortfall TOOL = pathlib.Path(__file__).resolve().parents[1] / "larv-review" SCORING = "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\n| Seat | Overall |\n|---|---|\n| Mean | 7.00 |\n" @@ -425,6 +426,17 @@ class LandedTowards(unittest.TestCase): self.assertEqual(landed_towards(plan, LastCut(Failure("fatal: bad object"), "", 3, [])), Failure("could not tell the next release: the default branch's tags cannot be read: fatal: bad object")) +class Shortfall(unittest.TestCase): + def test_a_chunk_that_empties_a_release_owes_two_runs_and_any_other_reason_one(self): + emptied = ["leaves release 0.1.0 with no plan item"] + floor = ["ships item 2, which names the comprehension floor"] + self.assertIn("owes 2 scoring runs and the branch's committed history records 1", shortfall(emptied + floor, 1).reason) + self.assertIn("owes 1 scoring run and", shortfall(floor, 0).reason) + self.assertIn("records 0:", shortfall(floor, -1).reason) + self.assertIsNone(shortfall(emptied, 2)) + self.assertIsNone(shortfall(floor, 1)) + + class LarvReviewTool(unittest.TestCase): def setUp(self): temp = tempfile.TemporaryDirectory() @@ -508,10 +520,10 @@ class LarvReviewTool(unittest.TestCase): owed = self.run_tool("scoring-run-owed") self.assertEqual(owed.returncode, 1) self.assertIn("leaves release 0.1.0 with no plan item", owed.stderr) - self.assertIn("records 0 of 2", owed.stderr) + self.assertIn("records 0:", owed.stderr) history = "# Comprehension history\n\n" + SCORING self.commit("Record a run", {"docs/comprehension-history.md": history}) - self.assertIn("records 1 of 2", self.run_tool("scoring-run-owed").stderr) + self.assertIn("records 1:", self.run_tool("scoring-run-owed").stderr) self.commit("Record a rerun", {"docs/comprehension-history.md": history + "\n" + SCORING.replace("PR #1 at", "PR #1 rerun at")}) done = self.run_tool("scoring-run-owed") self.assertEqual((done.returncode, done.stdout), (0, "No scoring run owed.\n"), done.stderr) @@ -526,10 +538,28 @@ class LarvReviewTool(unittest.TestCase): self.commit("Record a run", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING}) self.assertEqual(self.run_tool("scoring-run-owed").returncode, 0) - def test_no_scoring_run_is_owed_where_none_is_due_the_project_opts_out_or_it_has_no_plan(self): - self.commit("Ship item 2", {"todo.md": todo("| 1 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", "| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |")}) + ROW = "| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |" + + def ship_item_1(self): + self.commit("Ship item 1", {"todo.md": todo(self.ROW)}) + + def test_no_scoring_run_is_owed_where_none_is_due(self): + self.commit("Ship item 2", {"todo.md": todo("| 1 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", self.ROW)}) self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") - self.commit("Ship item 1", {"todo.md": todo("| 3 | 0.2.0 | | **And this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |")}) + self.ship_item_1() + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 1) + + def test_a_run_counts_only_as_committed_and_a_ruling_is_no_run(self): + self.ship_item_1() + (self.checkout / "docs").mkdir() + (self.checkout / "docs" / "comprehension-history.md").write_text("# Comprehension history\n\n" + SCORING) + self.assertIn("records 0", self.run_tool("scoring-run-owed").stderr) + self.commit("Record a ruling", {"docs/comprehension-history.md": "# Comprehension history\n\n" + paired("2026-10-08T12:00:00Z", "better")}) + self.assertIn("records 0", self.run_tool("scoring-run-owed").stderr) + + def test_a_project_that_opts_out_owes_none_and_is_never_due_one_but_a_branch_cannot_opt_itself_out(self): + self.ship_item_1() + self.commit("Opt out on the branch", {"docs/decisions.md": "## review opt-out: the comprehension check\n\n2026-11-10, lilleman.\n"}) self.assertEqual(self.run_tool("scoring-run-owed").returncode, 1) self.git("switch", "-q", "main") self.commit("Opt out", {"docs/decisions.md": "## review opt-out: the comprehension check\n\n2026-11-10, lilleman.\n"}) @@ -537,9 +567,25 @@ class LarvReviewTool(unittest.TestCase): self.git("switch", "-q", "chunk") self.git("merge", "-q", "main") self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + self.assertEqual(self.run_tool("needs-scoring-run", "1").stdout, "No scoring run due.\n") + + def test_a_project_with_no_plan_or_no_items_table_owes_none(self): + self.ship_item_1() + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 1) + self.commit("Reshape the plan", {"todo.md": "# Plan\n"}) + self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") self.git("rm", "-q", "todo.md") self.commit("Drop the plan") - self.assertEqual(self.run_tool("scoring-run-owed").returncode, 0) + self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + + def test_a_default_branch_that_moved_on_since_the_branch_began_adds_no_owed_run(self): + self.git("switch", "-q", "main") + self.commit("Plan release 0.3.0", {"todo.md": todo("| 1 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", "| 2 | 0.2.0 | | **Then this.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |", self.ROW, "| 4 | 0.3.0 | | **Later.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |"), "docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING}) + self.git("push", "-q", "origin", "HEAD:main") + self.git("switch", "-q", "chunk") + self.commit("Do some work") + self.assertEqual(self.run_tool("needs-scoring-run").stdout, "No scoring run due.\n") + self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") def release(self, tag, date, files=None): """Cut tag on the default branch at a commit dated date.""" @@ -559,6 +605,26 @@ class LarvReviewTool(unittest.TestCase): self.release("v0.0.3", "2026-10-21T12:00:00Z", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING.replace("2026-10-08T12", "2026-10-20T18")}) self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, "No scoring run due.\n") + def test_a_run_ends_an_unmeasured_release_only_when_it_is_a_scoring_run_newer_than_the_tag_with_a_time_that_reads(self): + self.release("v0.0.1", "2026-10-09T12:00:00Z") + history = "# Comprehension history\n\n" + due = "Scoring run due: the chunk follows v0.0.2, cut with no scoring run since v0.0.1.\n" + self.release("v0.0.2", "2026-10-20T12:00:00Z", {"docs/comprehension-history.md": history + paired("2026-10-21T12:00:00Z", "better") + "\n" + SCORING.replace("2026-10-08T12:00:00Z", "2026-10-09T12:00:00Z")}) + self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, due, "a ruling, and a run at the earlier tag's own second, end nothing") + self.release("v0.0.3", "2026-10-21T12:00:00Z", {"docs/comprehension-history.md": history + SCORING.replace("2026-10-08T12:00:00Z", "2026-10-30")}) + self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, due.replace("v0.0.2", "v0.0.3").replace("v0.0.1", "v0.0.2"), "a run whose time doesn't parse ends nothing") + + def test_an_unmeasured_release_is_judged_by_the_default_branch_alone_and_names_a_release_over_its_candidate(self): + self.release("v0.0.1", "2026-10-09T12:00:00Z") + self.release("v0.0.2-rc.1", "2026-10-10T12:00:00Z") + self.release("v0.0.2", "2026-10-20T12:00:00Z") + self.git("switch", "-q", "-c", "side") + self.commit("Tag a side branch") + self.git("tag", "v0.9.0") + self.git("switch", "-q", "chunk") + self.commit("Record a run on the branch", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING.replace("2026-10-08T12", "2026-10-25T12")}) + self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, "Scoring run due: the chunk follows v0.0.2, cut with no scoring run since v0.0.2-rc.1.\n") + def test_one_release_alone_calls_no_scoring_run_for_lacking_one(self): self.release("v0.0.1", "2026-10-09T12:00:00Z") self.assertEqual(self.run_tool("needs-scoring-run", "2").stdout, "No scoring run due.\n") diff --git a/bin/larv_review/unmeasured.py b/bin/larv_review/unmeasured.py index a55833b9..97890639 100644 --- a/bin/larv_review/unmeasured.py +++ b/bin/larv_review/unmeasured.py @@ -6,7 +6,9 @@ from git_cli.git_repo import file_at, git def unmeasured_cut(default: str, checkout: str) -> str | None | Failure: - """The default branch's newest release, named with the one before it, where no scoring run in the default branch's history is newer than that earlier release's tag: `v0.7.0, cut with no scoring run since v0.6.0`. None where it holds fewer than two release tags, or a run since the earlier one. + """Whether the default branch's newest release was cut unmeasured, as `v0.7.0, cut with no scoring run since v0.6.0`. It was where no scoring run in the default branch's history is newer than the second-newest v* tag. None where the branch holds fewer than two such tags, or a run since the earlier one. + + The reason ends once a run follows the earlier tag, so it asks only after a release was cut with none; it lets the chunk that finds the gap record the run (item 296 filed the gap after v0.5.0 to v0.7.0). A scoring run counts by the time its history heading records, against the tag's commit time; a heading whose time doesn't parse counts for nothing, so the run is asked for again. """ diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index a2a92483..6e797e3a 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -136,7 +136,7 @@ Launch one principles-auditor on the trigger in §3, so the project is read once ### Comprehension check -The comprehension check records how hard the project is for its contributor to read (`~/.claude/rules/goals-and-audience.md`), and blocks no merge. Simulated readers, the seats, launched per `~/.claude/skills/comprehension-panel/SKILL.md`, each read the whole project, not the diff. It reports no findings and is no pass: it runs once, in §5, after every pass is done, the auto-reviewer included, so it reads the branch as review left it. It runs a paired ruling in the release review, even where an opt-out skips its architect, and a scoring run where one is due. It skips only as "Opt-out" or "Suspended" below says. +The comprehension check records how hard the project is for its contributor to read (`~/.claude/rules/goals-and-audience.md`), and no score blocks a merge; only a run the plan calls and the branch lacks does, per "Scoring run". Simulated readers, the seats, launched per `~/.claude/skills/comprehension-panel/SKILL.md`, each read the whole project, not the diff. It reports no findings and is no pass: it runs once, in §5, after every pass is done, the auto-reviewer included, so it reads the branch as review left it. It runs a paired ruling in the release review, even where an opt-out skips its architect, and a scoring run where one is due. It skips only as "Opt-out" or "Suspended" below says. **Paired ruling.** Each seat votes whether the project reads better, the same or worse at this branch's head than at the base. @@ -144,11 +144,10 @@ The comprehension check records how hard the project is for its contributor to r - **Head.** The head holds `origin/<default branch>`, merged in at §4 step 1, so it differs from the default branch only by this branch's change. - **Seats.** Mid A and the inherited architect. Write what they read and their replies into a votes file in the chunk's review folder, in the shape `~/.claude/bin/larv-review --help` shows, and run `~/.claude/bin/larv-review record-ruling <votes file>`. On `Split:`, launch the maintainability senior and Junior A together, add their lines, and run it again. -**Scoring run**, when `~/.claude/bin/larv-review needs-scoring-run <the IDs of the items the chunk ships, if any>` prints `Scoring run due:`. Run `needs-scoring-run` before removing the chunk's items from `todo.md`. +**Scoring run**, when `~/.claude/bin/larv-review needs-scoring-run <the IDs of the items the chunk ships, if any>` prints `Scoring run due:`. Run `needs-scoring-run` before removing the chunk's items from `todo.md`. `chunk-pr merge` refuses until the branch's committed history records every run the plan calls, which `larv-review scoring-run-owed` counts at merge time from the merge base; an earlier due line is only a snapshot. - **Seats.** Junior A, Mid A, the maintainability senior and the inherited architect each score the project at the head from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. Write their lines into a scores file and run `~/.claude/bin/larv-review record-scoring <scores file> <the same item IDs>`, which appends the run to the history and prints the four seats' means. - **Floor item.** Where `record-scoring` prints `Floor:`, a `Next:` line follows: file one floor item, or refresh the open one. A floor item is a plan item meant to bring every mean to 7.0. File it as one ambitious refactor, not touch-ups. It restructures the area behind the places `larv-review places` prints for this run, chosen where they bear on the lowest dimension, sized to bring every mean to 7.0, and quotes those places. Its tagline holds the words `comprehension floor`, so its own chunk runs a scoring run; while a mean stays under 7.0, that run's `Next:` line asks for the next floor item. Mark it `owner`, since the human asked that such a project always hold one, so no score deletes it. Put it in the earliest release the plan names after the one the chunk ships into, or else in the next version after that one that `~/.claude/rules/todo-items.md` allows, so the floor doesn't hold up any release. While one is open, refresh its places and aim from the newest run instead of filing another; the item the chunk ships doesn't count as open. Commit it with the run, as "Record" says. -- **Owed.** `chunk-pr merge` runs `~/.claude/bin/larv-review scoring-run-owed` against the plan as it stands at merge time and refuses while the run the plan calls is unrecorded on the branch. A due line from earlier in the chunk, such as `chunk-preflight`'s, is a snapshot: the merge gate decides. - **Second run.** Where `needs-scoring-run` printed that the chunk `leaves release … with no plan item`, launch the same four seats afresh on the same head. Their scores file's first line is `<PR or branch> rerun at <commit>`. Record it with the same `record-scoring` command. - **Agreement.** After the second run, run `~/.claude/bin/larv-review agreement` and put its counts in the summary. On `Assumption fails:`, ask the user whether to keep the paired ruling or change the decision `review: the comprehension check records …`. Record the answer as a decision in the repo whose history was counted, with the counts that led to the ask. A later run asks again only when the rulings' rate falls, or the runs' rate rises, against the recorded counts. @@ -195,7 +194,7 @@ Launch prose-reviewer with what the diff touched and every section this review c 1. Read the finished PR against the README goals and code health, unless the README voids it: does anything in it work against one? It breaks a maintain goal → do not merge; redesign the change or drop its item. It works against an achieve goal → do not merge; ask the human, stating the conflict. 2. Run the comprehension check (§3) where it runs; it runs once. When `origin/<default branch>` moves after that, return to §4, and keep the ruling and scoring run already recorded. 3. Remove the chunk's items from `todo.md` per `~/.claude/CLAUDE.md` → "Working loop" in the branch, commit and push that, and wait for the forge's checks (§4 step 4); the commit re-enters no pass. -4. Aligned, every pass done and everything green → **merge** with `~/.claude/bin/chunk-pr merge --gate-passed`, which takes the first merge method the repository allows on its forge. A repo whose `AGENTS.md` names another method merges that way with the forge's CLI instead. A repo withholds this in its `AGENTS.md` → leave the PR ready and unmerged, and say which line withheld it. +4. Aligned, every pass done and everything green → **merge** with `~/.claude/bin/chunk-pr merge --gate-passed`, which takes the first merge method the repository allows on its forge. A repo whose `AGENTS.md` names another method merges that way with the forge's CLI instead, after `~/.claude/bin/larv-review scoring-run-owed` exits 0. A repo withholds this in its `AGENTS.md` → leave the PR ready and unmerged, and say which line withheld it. 5. Merged → run `~/.claude/bin/chunk-pr clean` in the chunk's worktree, and put a failure it prints in the summary. 6. Stop. The next chunk gets a fresh session. -- 2.52.0 From ac98e0e4a794ec0d8c37ba4332f1939ce6ef61fd Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Tue, 10 Nov 2026 23:59:10 +0100 Subject: [PATCH 04/10] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=204=20=F0=9F=9F=A1=20(0=20misread);=20the=20me?= =?UTF-8?q?rge-base=20fix=20answers=20the=20behind-main=20and=20no-table?= =?UTF-8?q?=20findings,=20the=20opt-out=20check=20moves=20into=20plan=5Fre?= =?UTF-8?q?asons,=20and=20the=20title=20and=20AGENTS.md=20lines=20that=20s?= =?UTF-8?q?ay=20the=20check=20blocks=20no=20merge=20stay:=20the=20decision?= =?UTF-8?q?'s=20body=20bars=20only=20a=20score=20from=20blocking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 538fbc52b920d59ad4c615579d08a4e79188a2cd Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Tue, 10 Nov 2026 23:59:10 +0100 Subject: [PATCH 05/10] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=207=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20help,=20SKILL.md=20and=20docstrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 567ff471ecd7ac324f1e7e36f9066e4366ab013e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Wed, 11 Nov 2026 00:05:20 +0100 Subject: [PATCH 06/10] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=203=20=F0=9F=9F=A1=20(0=20misread);=20say=20the?= =?UTF-8?q?=20gate=20reads=20the=20checkout's=20todo.md,=20and=20test=20ma?= =?UTF-8?q?in's=20runs,=20and=20an=20unreadable=20plan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/larv_review/main.py | 2 +- bin/larv_review/test_larv_review.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index 28f9ca98..bd41c576 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -42,7 +42,7 @@ docs/decisions.md opts out of the comprehension check is never due one. scoring-run-owed prints `No scoring run owed.` or exits 1 naming the runs the chunk owes and has not recorded. chunk-pr merge runs it and refuses to merge on exit 1, so a due line read earlier in -the chunk can't stand in for it. It applies needs-scoring-run's rule to the branch as committed, against the +the chunk can't stand in for it. It applies needs-scoring-run's rule to the checkout's todo.md and the committed history, against the merge base with the default branch, so a default branch that has moved on adds nothing: the items the merge base's todo.md holds and the checkout's does not count as shipped. A chunk that empties a release owes two runs, any other due chunk one. The chunk has recorded the scoring runs that its diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index cf6fa332..5315285b 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -577,6 +577,10 @@ class LarvReviewTool(unittest.TestCase): self.git("rm", "-q", "todo.md") self.commit("Drop the plan") self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + (self.checkout / "todo.md").write_bytes(b"\xff\xfe") + self.git("add", "todo.md") + self.commit("Break the plan") + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 1, "a plan that can't be read is no plan the gate may skip") def test_a_default_branch_that_moved_on_since_the_branch_began_adds_no_owed_run(self): self.git("switch", "-q", "main") @@ -586,6 +590,9 @@ class LarvReviewTool(unittest.TestCase): self.commit("Do some work") self.assertEqual(self.run_tool("needs-scoring-run").stdout, "No scoring run due.\n") self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + self.ship_item_1() + self.commit("Ship item 1 and record a run", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING.replace("PR #1", "PR #7")}) + self.assertIn("owes 2 scoring runs and the branch's committed history records 1:", self.run_tool("scoring-run-owed").stderr, "main's own run is no credit to the branch") def release(self, tag, date, files=None): """Cut tag on the default branch at a commit dated date.""" -- 2.52.0 From 58402083cb0a06c237dd9b4586259351dc4efabc Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Wed, 11 Nov 2026 00:06:23 +0100 Subject: [PATCH 07/10] Name the second run's title only where two runs are owed --- bin/larv_review/owed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/larv_review/owed.py b/bin/larv_review/owed.py index cf221ecb..85d562f6 100644 --- a/bin/larv_review/owed.py +++ b/bin/larv_review/owed.py @@ -39,7 +39,7 @@ def shortfall(reasons: list[str], recorded: int) -> Failure | None: needed = 2 if any(reason.endswith(EMPTIED_WORDS) for reason in reasons) else 1 if recorded >= needed: return None - return Failure(f"the chunk owes {needed} scoring run{'s' if needed > 1 else ''} and the branch's committed history records {max(recorded, 0)}: it {' and '.join(reasons)}. larv-review's SKILL.md → 'Scoring run' says how to run and record {'them' if needed > 1 else 'it'}; → 'Second run' says how the second is titled") + return Failure(f"the chunk owes {needed} scoring run{'s' if needed > 1 else ''} and the branch's committed history records {max(recorded, 0)}: it {' and '.join(reasons)}. larv-review's SKILL.md → 'Scoring run' says how to run and record {'them' if needed > 1 else 'it'}{"; → 'Second run' says how the second is titled" if needed > 1 else ""}") def has_plan(checkout: str) -> bool: -- 2.52.0 From 13d15502996afddb4470732c88de8fdfbdabf45a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Wed, 11 Nov 2026 00:11:20 +0100 Subject: [PATCH 08/10] Name plan_reasons' first argument ref, since it can be a commit, and pin the emptied-release words in SKILL.md --- bin/larv_review/plan.py | 12 ++++++------ bin/larv_review/test_larv_review.py | 5 ++++- bin/larv_review/unmeasured.py | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index 5d478e51..7a0a3607 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -63,17 +63,17 @@ def emptied(before: list[Item], after: list[Item], shipped: list[Item], renamed: return sorted(named - {item.release for item in kept} - renamed) -def plan_reasons(default: str, ids: list[int] | None) -> list[str] | Failure: - """Why the plan calls a scoring run, from the default branch's todo.md and the checkout's; empty where the project opts out of the comprehension check. Where ids is None, the chunk ships each item the default branch's plan holds and the checkout's does not.""" +def plan_reasons(ref: str, ids: list[int] | None) -> list[str] | Failure: + """Why the plan calls a scoring run, from todo.md at ref and the checkout's; empty where the project opts out of the comprehension check. ref is the default branch, or the commit where the chunk began. Where ids is None, the chunk ships each item the plan at ref holds and the checkout's does not.""" checkout = top() if isinstance(checkout, Failure): return checkout - decisions = file_at(default, "docs/decisions.md", checkout) + decisions = file_at(ref, "docs/decisions.md", checkout) if isinstance(decisions, Failure): return decisions if OPTED_OUT.search(decisions): return [] - held = default_plan(checkout, default) + held = default_plan(checkout, ref) before = held.todo if isinstance(before, Failure): return before @@ -86,14 +86,14 @@ def plan_reasons(default: str, ids: list[int] | None) -> list[str] | Failure: if isinstance(planned, NoItemsTable): planned = [] if isinstance(planned, Failure): - return Failure(f"{default}'s todo.md: {planned.reason}") + return Failure(f"{ref}'s todo.md: {planned.reason}") renamed = renames(after) if isinstance(renamed, Failure): return Failure(f"the checkout's todo.md: {renamed.reason}") landed_release = landed_towards(planned, held.cut) if isinstance(landed_release, Failure): return landed_release - unmeasured = unmeasured_cut(default, checkout) + unmeasured = unmeasured_cut(ref, checkout) if isinstance(unmeasured, Failure): return unmeasured if ids is None: diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 5315285b..194284de 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -12,7 +12,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from larv_review.agreement import agreement_report, ruling_agreement, run_agreement from review_rules.comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat -from larv_review.plan import checkout_plan, landed_towards, plan_reasons, scoring_run_due +from larv_review.plan import checkout_plan, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due from review_rules import comprehension_history from larv_review.ruling import counted, ruling, split, surplus, votes from larv_review.history_commands import decided @@ -427,6 +427,9 @@ class LandedTowards(unittest.TestCase): class Shortfall(unittest.TestCase): + def test_skill_md_names_the_words_that_end_the_reason_a_release_empties(self): + self.assertIn(EMPTIED_WORDS, (pathlib.Path(__file__).resolve().parents[2] / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8")) + def test_a_chunk_that_empties_a_release_owes_two_runs_and_any_other_reason_one(self): emptied = ["leaves release 0.1.0 with no plan item"] floor = ["ships item 2, which names the comprehension floor"] diff --git a/bin/larv_review/unmeasured.py b/bin/larv_review/unmeasured.py index 97890639..f20d32c0 100644 --- a/bin/larv_review/unmeasured.py +++ b/bin/larv_review/unmeasured.py @@ -8,7 +8,7 @@ from git_cli.git_repo import file_at, git def unmeasured_cut(default: str, checkout: str) -> str | None | Failure: """Whether the default branch's newest release was cut unmeasured, as `v0.7.0, cut with no scoring run since v0.6.0`. It was where no scoring run in the default branch's history is newer than the second-newest v* tag. None where the branch holds fewer than two such tags, or a run since the earlier one. - The reason ends once a run follows the earlier tag, so it asks only after a release was cut with none; it lets the chunk that finds the gap record the run (item 296 filed the gap after v0.5.0 to v0.7.0). + The reason ends once a run follows the earlier tag, so it asks only after a release was cut with none; it lets the chunk that finds the gap record the run. A scoring run counts by the time its history heading records, against the tag's commit time; a heading whose time doesn't parse counts for nothing, so the run is asked for again. """ -- 2.52.0 From 87273e94a431aa616428d498d130499423e62d43 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Wed, 11 Nov 2026 00:12:57 +0100 Subject: [PATCH 09/10] Record the comprehension check: PR #473 at 13d1550 means 6.00 overall; file floor item 300 --- docs/comprehension-history.md | 43 +++++++++++++++++++++++++++++++++++ todo.md | 24 ++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/docs/comprehension-history.md b/docs/comprehension-history.md index af586aa0..cd31ccdc 100644 --- a/docs/comprehension-history.md +++ b/docs/comprehension-history.md @@ -3435,3 +3435,46 @@ Inherited architect, decided by: - Locality, Shape: `bin/loop_claude/routing.py:84` `next_route`: each verdict kind has its own function, and `steps` and `below_cap` name the two conditions - Locality: `bin/model_routing/route.py:88` `route_of`: the archive line and the reload hand-over decode a Route through one decoder - Shape: `bin/loop_claude/loop/main.py:66` `next_cycle`: signatures of seven or eight positional parameters shrink to `(loop_run, loop)` + +## 2026-11-10T23:11:34Z, PR #473 at 13d1550 + +| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall | +|---|---|---|---|---|---| +| Junior A | 7 | 5.5 | 6 | 6 | 6 | +| Mid A | 7 | 5.5 | 6 | 6.5 | 6 | +| Maintainability senior | 7 | 5.5 | 6 | 6 | 6 | +| Inherited architect | 7 | 5.5 | 6 | 7 | 6 | +| Mean | 7.00 | 5.50 | 6.00 | 6.38 | 6.00 | + +Junior A, hardest first: + +- Locality, Shape: `bin/loop_claude/routing.py:93` `unfinished_route`: the floor rung, the escalation mark, the unfinished count and the cap are held at once, with escalation_mark.py open beside it +- Locality, Shape: `bin/larv_review/plan.py:66` `plan_reasons`: eight failure branches mix git reads, file reads and logic, and a parameter named `default` receives a merge-base commit +- Locality: `bin/larv_review/owed.py:37` `shortfall`: whether one or two runs are owed hangs on the wording of an English sentence that SKILL.md also keys on +- Shape: `bin/loop_claude/cycle/run.py:59` `run_cycle`: four near-identical archive helpers and a route replaced partway through the loop +- Shape: `bin/release_plan/ranking.py:56` `rank`: nearly every function forks on the table's two shapes +- Self-sufficiency: `skills/larv-review/SKILL.md:147` "Scoring run": dense rule prose with many cross-references, three sections to rebuild one rule + +Mid A, hardest first: + +- Locality, Shape: `bin/larv_review/plan.py:66` `plan_reasons`: `default` holds a merge-base commit on one call path and `after` means the checkout's text, then its items +- Locality: `bin/loop_claude/routing.py:93` `unfinished_route`: six concepts meet in about twelve lines and need four modules open beside it +- Locality: `bin/larv_review/owed.py:37` `shortfall`: a rule keyed on the text of a sentence that plan.py builds, and `scoring_runs` defines a scoring run differently from `Entry.scored` +- Locality: `bin/loop_claude/cycle/judge.py:211` `quotes_checked`: a verdict is rewritten four times, half the behaviour in prompt prose and half in code +- Shape: `bin/release_plan/ranking.py:304` `score`: every function branches on the old and the current table shape + +Maintainability senior, hardest first: + +- Locality, Shape: `bin/larv_review/plan.py:66` `plan_reasons`: a merge-base commit enters the parameter named for the default branch, and its error text would print the commit as a branch +- Locality: `bin/larv_review/owed.py:37` `shortfall`: the one-run-or-two rule is spread over three files and a skill document +- Locality, Shape: `bin/loop_claude/routing.py:93` `unfinished_route`: the six inputs interlock and a wrong answer runs the worker on the wrong rung without failing +- Locality: `bin/model_routing/route.py:88` `route_of`: a route has two serializations, a flat archive line and a nested handover +- Self-sufficiency: `bin/larv_review/plan.py:66` `plan_reasons`: its docstring doesn't say the first argument may be a commit + +Inherited architect, would restructure first: + +- Navigation, Shape: `bin/larv_review/owed.py:10` `owed_scoring_run`: the name gives the merge gate's question, not the module's subject, and the scoring-run logic sits in three files whose imports read as circular +- Locality: `bin/larv_review/plan.py:14` `EMPTIED_WORDS`: prose and code share an exact string that SKILL.md keys on +- Locality: `bin/loop_claude/routing.py:93` `unfinished_route`: routing logic spreads over about eight places, so a new trigger touches five files in three packages +- Shape: `bin/rule_hook/rules.py:25` `RULES`: rules sit inline in one module while five others have a module each +- Navigation: `bin/` README.md:116 "bin/": 56 entries in one flat list, the worst fan-out level diff --git a/todo.md b/todo.md index 4c162878..c7271488 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 0.1` -`Next ID = 300` +`Next ID = 301` ## Items @@ -28,6 +28,7 @@ | 273 | 0.9.0 | | decision | **Re-tune the E + I steps of `REVIEW_STEPS` for 6 to 8 once 10 finished chunks have scored an E + I of 6 or more, from how well E + I orders their review rounds and 🔴 findings.** | 1 | 2 | 2 | 3 | 2 | 1.1 by 2, 1.4 by 3 | 2.3 | | 268 | 0.9.0 | | | **End a run whose release is ready to cut with a notice on loop-claude's terminal, in place of an interrupt that waits for an answer.** | 2 | 2 | 3 | 5 | 3 | 1 by 5 | 2.2 | | 171 | 0.9.0 | | decision | **Group the routing figures' review rounds by the reviewers' rung as well as the worker's, so a call blames a rung only for rounds its own reviews raised.** | 3 | 2 | 2 | 5 | 4 | 1.2 by 3, 1.4 by 3 | 2.0 | +| 300 | 0.9.0 | | owner | **Restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Locality first: today the comprehension floor run at 13d1550 scored Locality 5.50, Shape 6.00, Self-sufficiency 6.38 and Overall 6.00.** | 4 | 2 | 3 | 7 | 8 | code health by 8 | 2.0 | | 264 | 0.9.0 | | | **Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 5 | 2.0 | | 149 | 0.9.0 | | decision | **Fill each release by priority up to a capacity it states, in place of the bar, and move what does not fit to a later release.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 7 | 1.8 | | 165 | 0.9.0 | | | **Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 4, 1.4 by 3 | 1.8 | @@ -161,6 +162,27 @@ Releases are the human's, and `CLAUDE.md` → "Working loop" already ends the lo Raised by the goals audit of PR #296. `bin/routing_figures/calls.py` groups a chunk's review rounds by the rung its worker started on, and calls for a routing change when a lower rung took more of them. Since PR #296 the reviewers may run above the worker's rung, on the one their item's E + I picks, and no figure groups rounds by it, though the archived worker line names the E + I it follows from. A cheap worker on an item of high E + I gets stronger reviewers, who may raise more rounds, and a call could then blame the worker's rung for them: an interrupt of lilleman that settles nothing (goal 1.2). +### 300. Restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Locality first: today the comprehension floor run at 13d1550 scored Locality 5.50, Shape 6.00, Self-sufficiency 6.38 and Overall 6.00. + +Filed by the comprehension check of PR #473 at 13d1550 (`larv-review record-scoring`), which printed `Floor:` and `Next:`. The lowest mean is Locality, 5.50. Refresh this item's places and aim from the newest run before the chunk starts; do not file a second floor item. + +Aim: one ambitious refactor of the areas below, sized so every mean reaches 7.0 on the chunk's own scoring run. Where a place is already easier to read when the chunk starts, drop it. + +Places the seats named, hardest first (`larv-review places`): + +- Locality, Shape: `bin/loop_claude/routing.py:93` `unfinished_route`: the floor rung, the escalation mark, the unfinished count and the cap are held at once, and the logic spreads over about eight places in three packages. +- Locality, Shape: `bin/larv_review/plan.py:66` `plan_reasons`: a merge-base commit enters the parameter that item 296's chunk renamed `ref`, eight failure branches mix git reads, file reads and logic, and `after` means the checkout's text and then its items. +- Locality: `bin/larv_review/owed.py:37` `shortfall`: the one-run-or-two rule is keyed on the wording `EMPTIED_WORDS` that plan.py builds and SKILL.md quotes; `scoring_runs` defines a scoring run differently from `Entry.scored`. Give the scoring-run logic one module, and have the number of runs owed come from a value, not from a sentence. +- Locality: `bin/loop_claude/cycle/judge.py:211` `quotes_checked`: a verdict is rewritten four times, half the behaviour in prompt prose and half in code. +- Locality: `bin/model_routing/route.py:88` `route_of`: a route has two serializations, a flat archive line and a nested handover. +- Shape: `bin/release_plan/ranking.py:56` `rank` and `:304` `score`: nearly every function forks on the table's two shapes; item 156 removes the old one. +- Shape: `bin/loop_claude/cycle/run.py:59` `run_cycle`: four near-identical archive helpers and a route replaced partway through the loop. +- Shape: `bin/rule_hook/rules.py:25` `RULES`: rules sit inline in one module while five others have a module each. +- Navigation: `README.md:116` `bin/`: 56 entries in one flat list, the worst fan-out level. +- Self-sufficiency: `skills/larv-review/SKILL.md:147` "Scoring run": dense rule prose with many cross-references; three sections rebuild one rule. + +Scored L 4 because the refactor touches several components that hold known defects, E 2 because review and a manual check see a regression, I 3 because every session runs these tools. The chunk runs a scoring run, since its tagline names the comprehension floor. + ### 264. Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars. Seats launch as `general-purpose`, so they hide inside that type: $301.24 of the $962.17 the figures of 2026-11-04 count, from 221 subagents. By 2026-11-10 general-purpose was the second-largest spend, $585 of about $2,385, and by transcript size about two thirds of it were seats (291 launches), then 177 security passes. Escalations are counted by trigger only, never in dollars. `bin/routing_figures/chunk.py` groups subagents by their `subagent_type`; a seat is told apart by its prompt, and an escalated subagent by the escalation marker its prompt opens with. -- 2.52.0 From 0fdaf926c5cbd962ffaa6e2b432e8fb881dba6be Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv <lilleman@larvit.se> Date: Wed, 11 Nov 2026 00:22:33 +0100 Subject: [PATCH 10/10] Finish item 296 --- CHANGELOG.md | 4 ++++ todo.md | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c078e56e..0340441b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- `chunk-pr merge` now refuses while a scoring run the plan calls is unrecorded on the branch, and `larv-review needs-scoring-run` calls one after a release is cut with none. + ## 0.7.0 - README's test, CI and mutation-test commands now have their own section, README → Test. diff --git a/todo.md b/todo.md index c7271488..5dadb141 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 296 | 0.8.0 | | | **Run the scoring run that releases 0.5.0 to 0.7.0 skipped, and make a due scoring run fail a check the worker cannot dismiss.** | 2 | 2 | 3 | 5 | 3 | code health by 4 | 7.2 | | 294 | 0.8.0 | | | **Check the files a commit stages against rule-hook's file rules, so a file a Bash command wrote is held to them as an Edit or Write is.** | 2 | 2 | 3 | 5 | 4 | 1.3 by 5 | 5.2 | | 297 | 0.8.0 | | | **Have loop-claude compute the judge's taken-in items, release-ready and escalation fields from `chunk-preflight`, git and the worker's structured lines, and leave the judge only the verdict kind.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 2, code health by 2 | 3.7 | | 293 | 0.8.0 | | | **Run mutation tests on a chunk's changed lines in the worker's pre-review gate, through one command that picks the tool by language, and hand stability-reviewer the surviving mutants.** | 3 | 2 | 3 | 6 | 5 | 1.1 by 5, 1.4 by 4, 1.5 by 2 | 2.8 | @@ -60,10 +59,6 @@ ## Details -### 296. Run the scoring run that releases 0.5.0 to 0.7.0 skipped, and make a due scoring run fail a check the worker cannot dismiss. - -The last scoring run in `docs/comprehension-history.md` is from 2026-10-29: overall 6.00, Locality 5.63, under the 7.0 floor. v0.5.0, v0.6.0 and v0.7.0 were cut without one, and `larv-review places` still prints that run's places, 254 commits stale. Workers twice dismissed `needs-scoring-run`'s due line as preflight reading a stale branch's plan; find why before choosing the check. Without a run, the floor item the scoring run files under 7.0 never fires. - ### 294. Check the files a commit stages against rule-hook's file rules, so a file a Bash command wrote is held to them as an Edit or Write is. From 2026-11-08 to 2026-11-10, workers in other projects wrote 1,266 files through Bash (a python heredoc, `sed -i`, `cat >`) against 260 through Edit and Write, and `rule-hook --help` says it doesn't check a file a Bash command writes. So `action-pin`, `image-pin`, `ignorefile-sorted` and the attribution check miss most edits. rule-hook already checks at `git commit` for `todo-rank-check`, so checking staged files there follows a pattern the repo has. Ship item 192 in the same chunk: its unsorted `.gitignore` block is one symptom of this gap. -- 2.52.0