Bring nine lessons from a client setup into the principles, the reviewers, larv-review and the project config
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-18 20:17:31 +01:00
parent 777dcf38e2
commit 254fd20368
13 changed files with 184 additions and 23 deletions
+3 -2
View File
@@ -130,7 +130,7 @@ prints it, such as stability. It prints the header of the prompt that launches t
in its next round: the pass and round, the branch's open pull request at its pushed head, the
worktree and branch, the merge base of HEAD and the default branch, and the paths of the reviewer's
report, the branch diff, the folders of technical principles and review standards the project's
config sets, the goals and the plan and, for architecture and stability, the places. For a reviewer whose
config sets, the files of coding conventions where it lists any, the goals and the plan and, for architecture and stability, the places. For a reviewer whose
definition under ~/.claude/agents/ has `omitClaudeMd: true`, it then names the file that holds the
project principles and decision titles, where the project keeps one. It writes the diff, from
that base to HEAD, into the chunk's review folder as branch-<short HEAD>.diff, writes what
@@ -138,7 +138,8 @@ places prints into places.md, and lists the plan's items into
plan.md, whatever store holds the plan; a file whose text is unchanged is left as it is. With --rerun, the
header names the report of a relaunch one rung up, in the same round, and the report that asked for
it. It exits 1 when the pass takes no more rounds, when `project-config` fails in the checkout, when
the principles or standards folder is not a folder with a file in it, or, with --rerun, when the
the principles or standards folder is not a folder with a file in it, when a file the config lists
in `coding-conventions` is missing, or, with --rerun, when the
report that asked is missing.
round-title takes a pass as reviewer-header does. It prints how the commit that answers the pass's
+8 -1
View File
@@ -44,6 +44,8 @@ class Launch:
decisions: pathlib.Path
# The language the project's config names for its prose.
language: str
# The files of the team's coding conventions, where the project's config names any.
conventions: tuple[pathlib.Path, ...] = ()
def asked(self) -> pathlib.Path:
"""The round's report, which asks for the rerun where there is one."""
@@ -61,6 +63,7 @@ class Launch:
f"Diff: {self.diff}",
f"Technical principles: {self.principles}",
f"Review standards: {self.standards}",
*([f"Coding conventions: {', '.join(str(file) for file in self.conventions)}"] if self.conventions else []),
f"Goals and audience: {self.goals}",
f"Plan: {self.plan}",
f"Prose language: {self.language}.",
@@ -104,6 +107,10 @@ def reviewer_header(default: str, pass_: str, rerun: bool, home: pathlib.Path) -
empty = next((setting for setting in ("principles", "standards") if not config.paths[setting].is_dir() or not any(config.paths[setting].iterdir())), None)
if empty is not None:
return Failure(f"{config.paths[empty]} is not a folder with a file in it; {config.folder / 'config.toml'} sets it as `{empty}`")
# A reviewer told to read a file that isn't there would review without the team's rules, as with an empty principles folder.
absent = next((file for file in config.coding_conventions if not file.is_file()), None)
if absent is not None:
return Failure(f"{absent} is not a file; {config.folder / 'config.toml'} sets it in `coding-conventions`")
decisions = local_file(store(config, "decisions"), folder / "decisions.md")
if isinstance(decisions, Failure):
return decisions
@@ -111,7 +118,7 @@ def reviewer_header(default: str, pass_: str, rerun: bool, home: pathlib.Path) -
goals = local_file(goals_store(config), folder / "goals.md")
if isinstance(goals, Failure):
return goals
launch = Launch(pass_, round_, rerun, pull_named(worktree, branch), worktree, branch, base, default, folder, folder / f"branch-{head}.diff", principles, standards, goals, folder / "plan.md", starts_bare(next((agent for name, agent in REVIEWERS.items() if name == pass_), ""), home), config.paths["working-rules"], decisions, config.language)
launch = Launch(pass_, round_, rerun, pull_named(worktree, branch), worktree, branch, base, default, folder, folder / f"branch-{head}.diff", principles, standards, goals, folder / "plan.md", starts_bare(next((agent for name, agent in REVIEWERS.items() if name == pass_), ""), home), config.paths["working-rules"], decisions, config.language, config.coding_conventions)
if rerun and not launch.asked().exists():
return Failure(f"no report asked for a rerun of {pass_}'s round {round_}: {launch.asked()} is missing; relaunch before you commit the round's answers")
written = write_inputs(launch, base, home, plan_listing(plan_store(config)))
+13
View File
@@ -1304,6 +1304,19 @@ class LarvReviewTool(unittest.TestCase):
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
self.assertIn(f"{folder} is not a folder with a file in it; {self.config} sets it as `{setting}`", ran.stderr)
def test_reviewer_header_names_the_coding_conventions_only_where_the_projects_config_sets_them(self):
self.assertIsNone(self.header_line("Coding conventions:", "prose"))
(self.checkout / "CONVENTIONS.md").write_text("# Conventions\n")
(self.config.parent / "style.md").write_text("# Style\n")
self.config.write_text(PROJECT_CONFIG + 'coding-conventions = ["checkout:CONVENTIONS.md", "folder:style.md"]\n')
self.assertEqual(self.header_line("Coding conventions:", "prose"), f"Coding conventions: {self.checkout}/CONVENTIONS.md, {self.config.parent}/style.md")
def test_reviewer_header_fails_where_a_coding_conventions_file_is_missing(self):
self.config.write_text(PROJECT_CONFIG + 'coding-conventions = ["checkout:CONVENTIONS.md"]\n')
ran = self.run_tool("reviewer-header", "prose")
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
self.assertIn(f"{self.checkout}/CONVENTIONS.md is not a file; {self.config} sets it in `coding-conventions`", ran.stderr)
def test_reviewer_header_gives_the_architect_the_places(self):
folder = self.checkout.parent / ".local" / "state" / "larv-review" / "proj"
self.assertEqual(self.header_line("Places:", "architecture"), f"Places: {folder}/places.md")