41 lines
2.1 KiB
Python
41 lines
2.1 KiB
Python
import pathlib
|
|
import re
|
|
import sys
|
|
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 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 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")
|
|
|
|
|
|
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_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_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_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)
|
|
|
|
def test_larv_review_has_the_tool_make_the_reports_folder_rule_hook_lets_a_reviewer_write_into(self):
|
|
self.assertIn("`~/.claude/bin/larv-review review-folder`", LARV_REVIEW)
|