Answer architecture round 1: 3 🔴, 4 🟡; hand interrupts the rungs, derive the rung rule once, and give each rung one spelling

This commit is contained in:
2026-10-16 06:46:38 +02:00
parent 5c65e725fc
commit e07c20bd60
18 changed files with 192 additions and 51 deletions
+38
View File
@@ -0,0 +1,38 @@
import pathlib
import re
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from rule_hook.reviewer_rung import REVIEWERS, SEAT, SECURITY
from repo_checks.test_python_floor import ROOT
OPENING = re.compile(r"^## Opening\n+```\n([^\n]+?\.)(?: |\n)", re.MULTILINE)
SPELLING = re.compile(r"(?<![\w/])/[a-z][a-z-]+")
def reviewer_column(row_name: str) -> str:
"""The Reviewer cell of the row of larv-review's §3 table that opens with row_name."""
rows = [line for line in (ROOT / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8").splitlines() if line.startswith(f"| {row_name} |")]
assert len(rows) == 1, f"larv-review's §3 table has {len(rows)} rows named {row_name}"
return rows[0].split("|")[2]
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_reviewer_types_are_the_agents_the_repo_defines(self):
self.assertEqual(REVIEWERS, {path.stem for path in (ROOT / "agents").glob("*.md")})
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")
self.assertEqual(SEAT, opening.group(1) if opening else "")
def test_the_security_pattern_matches_the_two_launches_larv_review_names(self):
launched = {spelling for row in ("Security", "Full scan") for spelling in SPELLING.findall(reviewer_column(row))}
self.assertEqual(launched, {"/security-review", "/claude-security"})
self.assertEqual({alternative.removesuffix(r"\b") for alternative in SECURITY.pattern.split("|")}, launched)
for spelling in launched:
self.assertTrue(SECURITY.search(f"Invoke {spelling} over the branch diff."), spelling)