Run every claude the loop starts in a Claude home generated outside the clone
CI / tests (pull_request) Successful in 4m45s

This commit is contained in:
2026-12-04 01:07:03 +01:00
parent 2460b9e132
commit 0203a8e0b3
48 changed files with 703 additions and 369 deletions
+2 -1
View File
@@ -176,6 +176,7 @@ import typing
from larv_review.reviewer_header import branch_summaries, reviewer_header
from review_rules.round_titles import cap, CAP, RELEASE_REVIEW_CAP, round_counts
from loop_state.paths import claude_home
from git_cli.git_repo import default_branch, git, top
from project_config.settings import DEFAULT_FLOOR
from failure import Failure
@@ -241,7 +242,7 @@ COMMANDS = {
"agreement": Command("agreement", no_arguments, lambda given: printed(read_agreement(pathlib.Path.home(), os.environ))),
"reviewer-header": Command("reviewer-header <pass> [--rerun]", fits_reviewer_header, run_reviewer_header),
"round-title": Command("round-title <pass>", lambda given: len(given) == 1 and given[0] in REVIEWERS, lambda given: with_default_branch(lambda default: printed(round_title(default, given[0], pathlib.Path.home(), os.environ)), stale_ok=True)),
"reviewer-context": Command("reviewer-context", no_arguments, lambda given: printed(hook_reply(sys.stdin.read(), pathlib.Path.home()))),
"reviewer-context": Command("reviewer-context", no_arguments, lambda given: printed(hook_reply(sys.stdin.read(), claude_home(os.environ, pathlib.Path.home())))),
}
SHAPES = " | ".join(command.shape for command in COMMANDS.values())
USAGE = f"usage: larv-review {SHAPES}"
+2 -1
View File
@@ -5,6 +5,7 @@ import pathlib
from git_cli.git_repo import branch_titles, git, top
from review_rules.round_titles import cap, round_counts
from loop_state.paths import claude_home
from failure import Failure
from forge.commands import forge_of, runner
from record_store.stores import goals_store, local_file, store
@@ -123,7 +124,7 @@ def reviewer_header(default: str, pass_: str, rerun: bool, home: pathlib.Path, e
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, config.coding_conventions)
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_), ""), claude_home(env, 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, env, plan_listing(plan_store(config)))
+3 -4
View File
@@ -1337,8 +1337,8 @@ class LarvReviewTool(unittest.TestCase):
self.assertEqual(ran.stdout.splitlines()[-1], f"Principles: read {self.checkout}/docs/decisions.md first, up to `# Decisions`, for the project principles and the decision titles.")
def bare(self, agent):
(self.checkout.parent / ".claude" / "agents").mkdir(parents=True, exist_ok=True)
(self.checkout.parent / ".claude" / "agents" / f"{agent}.md").write_text("---\nomitClaudeMd: true\n---\n")
(self.checkout.parent / ".local" / "share" / "build-release" / "claude-home" / "agents").mkdir(parents=True, exist_ok=True)
(self.checkout.parent / ".local" / "share" / "build-release" / "claude-home" / "agents" / f"{agent}.md").write_text("---\nomitClaudeMd: true\n---\n")
def test_reviewer_context_hands_a_reviewer_the_sections_or_what_kept_it_from_them(self):
def hook(agent):
@@ -1348,8 +1348,7 @@ class LarvReviewTool(unittest.TestCase):
missing = hook("prose-reviewer")
self.assertEqual((missing.returncode, missing.stderr), (0, ""))
self.assertIn("failed: could not read", json.loads(missing.stdout)["hookSpecificOutput"]["additionalContext"])
(self.checkout.parent / ".claude").mkdir(exist_ok=True)
(self.checkout.parent / ".claude" / "CLAUDE.md").write_text("## Shared goal\n\nHealth.\n\n## Prose\n\nShort.\n\n## Vocabulary\n\nWords.\n")
(self.checkout.parent / ".local" / "share" / "build-release" / "claude-home" / "CLAUDE.md").write_text("## Shared goal\n\nHealth.\n\n## 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"])