diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index bb7c017e..396bd866 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -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 diff --git a/bin/model_routing/ladder.py b/bin/model_routing/ladder.py index f3cf683a..215cb277 100644 --- a/bin/model_routing/ladder.py +++ b/bin/model_routing/ladder.py @@ -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] = {} diff --git a/bin/repo_checks/test_reviewer_launches.py b/bin/repo_checks/test_reviewer_launches.py index 76e5c60b..43457318 100644 --- a/bin/repo_checks/test_reviewer_launches.py +++ b/bin/repo_checks/test_reviewer_launches.py @@ -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")) diff --git a/bin/round_titles.py b/bin/round_titles.py index d4d436bd..027196fa 100644 --- a/bin/round_titles.py +++ b/bin/round_titles.py @@ -1,8 +1,9 @@ """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 + 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]+) ๐ŸŸก(?:;|$)") diff --git a/todo.md b/todo.md index a3e7a81b..5c851038 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 121 | 0.4.0 | | | **List larv-review's passes in one place that `round_titles.PASSES`, `ladder.ReviewedPass` and `ladder.REVIEWERS` derive from, and check larv-review ยง3's table against it.** | 2 | 1 | 3 | 4 | 3 | code health by 9 | 40.4 | | 213 | 0.4.0 | | | **Compute the next release, and whether work has landed towards it, in one function that both `chunk_pick.standing` and `larv_review/plan.py`'s `scoring_run_due` call.** | 3 | 2 | 3 | 6 | 3 | code health by 9 | 40.4 | | 137 | 0.4.0 | | | **Archive a chunk's route as a record loop-claude reads back field by field, in place of the `Worker:` prose `ROUTED` parses, and name `stepped` and the judge's `bundled` by what they do.** | 4 | 2 | 3 | 7 | 4 | code health by 9, 1.4 by 9 | 32.9 | | 211 | 0.4.0 | | | **State each routing rule once, in the docstring of the code that enforces it, and cut `loop-claude --help`'s routing paragraph to what the human running the loop needs.** | 2 | 2 | 1 | 3 | 4 | code health by 9, 1.4 by 9 | 32.9 | @@ -77,10 +76,6 @@ ## Details -### 121. List larv-review's passes in one place that `round_titles.PASSES`, `ladder.ReviewedPass` and `ladder.REVIEWERS` derive from, and check larv-review ยง3's table against it. - -Release 0.3.0's inherited architect (PR #324 rerun at c713910) named `bin/round_titles.py:5` `PASSES`: "the pass list lives in four places, PASSES, ladder.ReviewedPass, REVIEWERS and SKILL.md's table, kept in sync by hand". That lowers Locality: adding a pass means editing four places. PR #257's run found that `PASSES` repeats the pass list in `skills/larv-review/SKILL.md:33`, with no check tying the two. It leaves out the auto-reviewer, whose rounds `SKILL.md:68` counts by hand. A test under `bin/repo_checks/` can hold the table to the list. Make `PASSES` easier to read. - ### 213. Compute the next release, and whether work has landed towards it, in one function that both `chunk_pick.standing` and `larv_review/plan.py`'s `scoring_run_due` call. Release 0.3.0's scoring runs named `bin/chunk_pick.py:97` `standing` at three seats (first run: PR #324 at c713910; rerun: PR #324 rerun at c713910). Inherited architect, first run: "'next release' is computed two ways, here and in larv_review/plan.py's scoring_run_due, which may diverge after a rename". Junior A, rerun: "two separate notions of the next release and of work having landed". This lowers Locality: changing what the next release is means changing both places, which may diverge. The seats also found `standing` itself hard: "five inputs, three of which may be Failure, produce five outcomes, the order of the Failure checks carrying meaning" (Maintainability senior, rerun), and `chunk_pick.Finished` "shares its name with judge.Finished" (Junior A, first run). Rename `chunk_pick.Finished`. Make `standing` and `scoring_run_due` easier to read.