From 1f9536d6642a3dbb94a1b78fe6a6fc6de9cf5991 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 20:41:12 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20architecture=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1;=20move=20the=20pass=20list=20?= =?UTF-8?q?to=20review=5Fpasses,=20check=20the=20pass=20table=20by=20one?= =?UTF-8?q?=20pattern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + bin/larv_review/main.py | 2 +- bin/model_routing/ladder.py | 9 ++------- bin/repo_checks/test_reviewer_launches.py | 8 +++----- bin/repo_checks/test_types.py | 2 +- bin/review_passes.py | 16 ++++++++++++++++ bin/round_titles.py | 2 +- 7 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 bin/review_passes.py diff --git a/.gitignore b/.gitignore index ea57c2a8..e44d9417 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ !bin/repo_checks/*.py !bin/review-replay !bin/review_folder.py +!bin/review_passes.py !bin/review_replay/ !bin/review_replay/*.py !bin/round_titles.py diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index 396bd866..5e456cc6 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -108,7 +108,7 @@ from comprehension_history import FLOOR from larv_review.git import history_changes from larv_review.ruling_base import measured_commit from larv_review.agreement import MIN_PAIRS -from model_routing.ladder import PASSES +from review_passes import PASSES from larv_review.plan import plan_reasons from larv_review.record import record_ruling, record_scoring, show_agreement, show_places from review_folder import REPORTS, review_folder diff --git a/bin/model_routing/ladder.py b/bin/model_routing/ladder.py index 215cb277..34e46e3c 100644 --- a/bin/model_routing/ladder.py +++ b/bin/model_routing/ladder.py @@ -3,10 +3,10 @@ import dataclasses import re import typing +from review_passes import ReviewedPass, REVIEWERS + # How Rung.__str__ spells a rung that names an effort, and Rung.parse reads it back. WORDING = re.compile(r"(?P\S+) at (?P\S+) effort") -# A pass an agent under agents/ reviews, named as skills/larv-review/SKILL.md → "Passes" names it in lower case. -ReviewedPass = typing.Literal["architecture", "principles", "overrides", "stability", "product-owner", "prose"] # What a review launch reviews: such a pass, a comprehension seat or the security pass. ReviewKind = ReviewedPass | typing.Literal["seat", "security"] @@ -65,11 +65,6 @@ LADDER = ( WORKER_STEPS = {1: -1, 2: -1, 3: 0, 4: 1} # The rungs a task's E + I steps a review up from the project's rung; an E + I under 5 steps none. REVIEW_STEPS = {5: 1, 6: 2, 7: 3, 8: 4} -# Each pass of skills/larv-review/SKILL.md → "Passes", in the order of its table, and the agent under agents/ that reviews it; empty where a skill or plugin does. The auto-reviewer is no pass here: it posts no round commit. -PASS_AGENTS: dict[str, str] = {"architecture": "systems-architect", "principles": "principles-auditor", "full scan": "", "security": "", "overrides": "override-reviewer", "stability": "stability-reviewer", "product-owner": "product-owner-reviewer", "prose": "prose-reviewer"} -PASSES = tuple(PASS_AGENTS) -# The passes that have an agent, which `ReviewedPass` names for the type checker; test_ladder holds the two together. -REVIEWERS = typing.cast(dict[ReviewedPass, str], {name: agent for name, agent in PASS_AGENTS.items() if agent}) # The rung a pass's replay chose for the projects on a model: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds`. REPLAYED: dict[tuple[ReviewedPass, str], Rung] = {} diff --git a/bin/repo_checks/test_reviewer_launches.py b/bin/repo_checks/test_reviewer_launches.py index 43457318..5e53652a 100644 --- a/bin/repo_checks/test_reviewer_launches.py +++ b/bin/repo_checks/test_reviewer_launches.py @@ -5,7 +5,8 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from model_routing.ladder import PASS_AGENTS, PASSES, REVIEWERS +from review_passes import PASSES +from model_routing.ladder import REVIEWERS from repo_checks.test_python_floor import ROOT from rule_hook.reviewer_rung import SEAT, SECURITY_OPENER @@ -19,7 +20,7 @@ PASS_TABLE = LARV_REVIEW.split("## 3. Passes", 1)[1].split("A comment is prose", class ReviewerLaunches(unittest.TestCase): - """rule-hook holds a review launch to its rung by recognising it; these fail when what it recognises drifts from what the skills launch.""" + """rule-hook holds a review launch to its rung by recognising it, and `larv-review round-count` counts the passes by name; these fail when what they recognise drifts from what the skills launch.""" def test_the_passes_are_the_ones_larv_review_s_pass_table_names_in_its_order(self): self.assertEqual([name.lower() for name in PASS_ROW.findall(PASS_TABLE)], list(PASSES)) @@ -28,9 +29,6 @@ class ReviewerLaunches(unittest.TestCase): self.assertEqual({name.lower(): agent for name, agent in REVIEWED_ROW.findall(PASS_TABLE)}, REVIEWERS) self.assertEqual([name.lower() for name, _ in REVIEWED_ROW.findall(PASS_TABLE)], list(REVIEWERS)) - def test_the_reviewers_are_the_passes_that_have_an_agent(self): - self.assertEqual(REVIEWERS, {name: agent for name, agent in PASS_AGENTS.items() if agent}) - def test_the_seat_opening_is_the_sentence_that_opens_every_seat_prompt(self): opening = OPENING.search((ROOT / "skills" / "comprehension-panel" / "seat-prompts.md").read_text(encoding="utf-8")) self.assertIsNotNone(opening, "seat-prompts.md has a `## Opening` section whose code block opens with a sentence") diff --git a/bin/repo_checks/test_types.py b/bin/repo_checks/test_types.py index cd8bd7a4..2640677e 100644 --- a/bin/repo_checks/test_types.py +++ b/bin/repo_checks/test_types.py @@ -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", "chunk_preflight", "-p", "claude_code", "-m", "comprehension_history", "-m", "git_repo", "-p", "judge_replay", "-p", "larv_review", "-p", "loop_claude", "-m", "markdown_text", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-p", "reading_cost", "-p", "review_replay", "-m", "round_titles", "-p", "rule_hook", "-p", "rung_replay", "-p", "score_outcomes", "-m", "settings_filter", "-m", "shell_command", "-m", "statusline", "-p", "subagent_rung", "-m", "todo_table", "-p", "transcript_archive", "-m", "utc_stamp"], 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", "chunk_preflight", "-p", "claude_code", "-m", "comprehension_history", "-m", "git_repo", "-p", "judge_replay", "-p", "larv_review", "-p", "loop_claude", "-m", "markdown_text", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-p", "reading_cost", "-m", "review_passes", "-p", "review_replay", "-m", "round_titles", "-p", "rule_hook", "-p", "rung_replay", "-p", "score_outcomes", "-m", "settings_filter", "-m", "shell_command", "-m", "statusline", "-p", "subagent_rung", "-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) diff --git a/bin/review_passes.py b/bin/review_passes.py new file mode 100644 index 00000000..3c2f8a28 --- /dev/null +++ b/bin/review_passes.py @@ -0,0 +1,16 @@ +"""The passes of larv-review, as skills/larv-review/SKILL.md → "Passes" lists them.""" +import typing + +# A pass an agent under agents/ reviews, in lower case. A Literal cannot be built from `PASS_AGENTS`, so test_ladder holds the two together. +ReviewedPass = typing.Literal["architecture", "principles", "overrides", "stability", "product-owner", "prose"] +# Each pass in the order of SKILL.md's pass table, and the agent under agents/ that reviews it; None where a skill or plugin does. The auto-reviewer is left out: larv-review counts its rounds from its reviews on the PR, not from commit titles. +PASS_AGENTS: dict[str, str | None] = {"architecture": "systems-architect", "principles": "principles-auditor", "full scan": None, "security": None, "overrides": "override-reviewer", "stability": "stability-reviewer", "product-owner": "product-owner-reviewer", "prose": "prose-reviewer"} +PASSES = tuple(PASS_AGENTS) + + +def _reviewed(name: str) -> typing.TypeGuard[ReviewedPass]: + return name in typing.get_args(ReviewedPass) + + +# The passes that have an agent. A pass missing from `ReviewedPass` drops out of it, which test_ladder fails on. +REVIEWERS: dict[ReviewedPass, str] = {name: agent for name, agent in PASS_AGENTS.items() if agent and _reviewed(name)} diff --git a/bin/round_titles.py b/bin/round_titles.py index 027196fa..83795168 100644 --- a/bin/round_titles.py +++ b/bin/round_titles.py @@ -1,7 +1,7 @@ """The titles of larv-review's round commits, `Answer round : 🔴, 🟡; `: each pass's round count, and the findings the rounds reported.""" import re -from model_routing.ladder import PASSES +from review_passes import PASSES CAP = 3 ROUND = re.compile(r"^Answer (.+?) round ([0-9]+):", re.IGNORECASE)