List larv-review's passes in one place that round_titles and the ladder derive from, and check the pass table against it

This commit is contained in:
2026-10-22 20:25:37 +02:00
parent e2033abbaf
commit 6cff688951
5 changed files with 21 additions and 17 deletions
+2 -1
View File
@@ -101,13 +101,14 @@ import re
import sys
import typing
from round_titles import CAP, PASSES, round_counts
from round_titles import CAP, round_counts
from git_repo import default_branch, git, top
from failure import Failure
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 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
+5 -2
View File
@@ -65,8 +65,11 @@ 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 an agent under agents/ reviews, in the order of SKILL.md's pass table, and that agent.
REVIEWERS: dict[ReviewedPass, str] = {"architecture": "systems-architect", "principles": "principles-auditor", "overrides": "override-reviewer", "stability": "stability-reviewer", "product-owner": "product-owner-reviewer", "prose": "prose-reviewer"}
# 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] = {}
+12 -8
View File
@@ -5,27 +5,31 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from round_titles import PASSES
from model_routing.ladder import REVIEWERS
from model_routing.ladder import PASS_AGENTS, PASSES, REVIEWERS
from repo_checks.test_python_floor import ROOT
from rule_hook.reviewer_rung import SEAT, SECURITY_OPENER
OPENING = re.compile(r"^## Opening\n+```\n([^\n]+?\.)(?: |\n)", re.MULTILINE)
# A row of the pass table: its pass.
PASS_ROW = re.compile(r"^\| (?!Pass \|)([A-Z][a-z-]+(?: [a-z]+)?) \|", re.MULTILINE)
# A row of the pass table whose reviewer is an agent: its pass and that agent.
REVIEWED_ROW = re.compile(r"^\| ([A-Z][a-z-]+) \| ([a-z]+(?:-[a-z]+)*-(?:reviewer|architect|auditor)) \|", re.MULTILINE)
LARV_REVIEW = (ROOT / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8")
PASS_TABLE = LARV_REVIEW.split("## 3. Passes", 1)[1].split("A comment is prose", 1)[0]
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."""
def test_the_reviewers_are_the_passes_and_agents_larv_review_s_pass_table_names_in_its_order(self):
passes = LARV_REVIEW.split("## 3. Passes", 1)[1].split("A comment is prose", 1)[0]
self.assertEqual({name.lower(): agent for name, agent in REVIEWED_ROW.findall(passes)}, REVIEWERS)
self.assertEqual([name.lower() for name, _ in REVIEWED_ROW.findall(passes)], list(REVIEWERS))
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))
def test_each_reviewed_pass_is_a_pass_the_round_titles_count(self):
self.assertEqual([name for name in PASSES if name in REVIEWERS], list(REVIEWERS))
def test_the_reviewers_are_the_passes_and_agents_larv_review_s_pass_table_names_in_its_order(self):
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"))
+2 -1
View File
@@ -1,8 +1,9 @@
"""The titles of larv-review's round commits, `Answer <pass> round <n>: <k> 🔴, <m> 🟡; <summary>`: each pass's round count, and the findings the rounds reported."""
import re
from model_routing.ladder import PASSES
CAP = 3
PASSES = ("architecture", "principles", "full scan", "security", "overrides", "stability", "product-owner", "prose")
ROUND = re.compile(r"^Answer (.+?) round ([0-9]+):", re.IGNORECASE)
# What follows a round title's colon: the round's 🔴 and 🟡 counts, then `;` and its summary, if any.
FINDINGS = re.compile(r" ([0-9]+) 🔴, ([0-9]+) 🟡(?:;|$)")