Answer principles round 1: 0 🔴, 6 🟡; derive the reviewers from agents/, open the security pass's prompt with a sentence, and type the review kinds

This commit is contained in:
2026-10-16 06:53:03 +02:00
parent e07c20bd60
commit 56b5924902
5 changed files with 34 additions and 33 deletions
+9 -17
View File
@@ -5,34 +5,26 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from rule_hook.reviewer_rung import REVIEWERS, SEAT, SECURITY
from rule_hook.reviewer_rung import REVIEWERS, SEAT, SECURITY_OPENER
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]
REVIEWER_NAME = re.compile(r"\b[a-z]+(?:-[a-z]+)*-(?:reviewer|architect|auditor)\b")
LARV_REVIEW = (ROOT / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8")
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_reviewers_are_the_ones_larv_review_s_pass_table_names(self):
passes = LARV_REVIEW.split("## 3. Passes", 1)[1].split("A comment is prose", 1)[0]
self.assertEqual(set(REVIEWER_NAME.findall(passes)), REVIEWERS)
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)
def test_the_security_opening_is_the_sentence_larv_review_has_the_security_pass_open_with(self):
security = LARV_REVIEW.split("### Security", 1)[1].split("### Overrides", 1)[0]
self.assertIn(SECURITY_OPENER, security)