Start each reviewer without CLAUDE.md, hand it the prose rules, vocabulary and principles file, and replay a pass without it

This commit is contained in:
2026-11-12 05:48:19 +01:00
parent 348abfec59
commit 4c971a7cc4
15 changed files with 315 additions and 21 deletions
+21
View File
@@ -1,5 +1,6 @@
import decimal
import itertools
import json
import os
import pathlib
import subprocess
@@ -990,5 +991,25 @@ class LarvReviewTool(unittest.TestCase):
folder = self.checkout.parent / ".local" / "state" / "larv-review" / "proj"
self.assertEqual(self.header_line("Places:", "architecture"), f"Places: {folder}/places.md")
def test_reviewer_header_names_the_file_that_holds_the_principles_last_where_the_project_keeps_one(self):
self.assertIsNone(self.header_line("Principles:", "prose"))
(self.checkout / "AGENTS.md").write_text("")
ran = self.run_tool("reviewer-header", "prose")
self.assertEqual(ran.stdout.splitlines()[-1], f"Principles: read {self.checkout}/AGENTS.md first, for the project principles and the decision titles.")
def test_reviewer_context_hands_a_reviewer_the_sections_and_fails_without_them(self):
def hook(agent):
return subprocess.run([sys.executable, str(TOOL), "reviewer-context"], capture_output=True, env=self.env, input=json.dumps({"agent_type": agent}), text=True)
missing = hook("prose-reviewer")
self.assertEqual((missing.returncode, missing.stdout), (1, ""))
self.assertIn("CLAUDE.md", missing.stderr)
(self.checkout.parent / ".claude").mkdir(exist_ok=True)
(self.checkout.parent / ".claude" / "CLAUDE.md").write_text("## Prose\n\nShort.\n\n## Vocabulary\n\nWords.\n")
ran = hook("prose-reviewer")
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("## Prose\n\nShort.\n\n## Vocabulary\n\nWords.", json.loads(ran.stdout)["hookSpecificOutput"]["additionalContext"])
self.assertEqual((hook("Explore").returncode, hook("Explore").stdout), (0, ""))
if __name__ == "__main__":
unittest.main()