Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s
CI / tests (pull_request) Successful in 6m34s
This commit is contained in:
@@ -5,7 +5,7 @@ usage: review-replay <pass> <model> [--omit-claude-md | --bash-ceiling | --read-
|
||||
<pass> is one of architecture, principles, overrides, stability, product-owner or prose.
|
||||
<model> is a project model on the routing ladder this setup ships, such as claude-opus-5-5. The tool replays the
|
||||
latest 10 archived rounds of the pass whose report holds a 🔴 or 🟡 finding, from the projects
|
||||
that ~/.claude/loop-claude-models.json runs on the model. It replays each round on the code it
|
||||
that ~/.config/build-release/models.json runs on the model. It replays each round on the code it
|
||||
reviewed: in a throwaway clone of the project's checkout, at the newest commit of origin/HEAD
|
||||
authored by the time the round began, on the branch the reviewer started on. The clone's default
|
||||
branch stands at the newest commit authored before the round's chunk began, so a diff against it
|
||||
@@ -57,7 +57,7 @@ result, is in the archive. It refuses to run where its own environment already h
|
||||
replays as archived would inherit it.
|
||||
|
||||
It keeps each run, a reviewer's tool calls included, and the report it prints in build-release's archive, in
|
||||
replays/review-replay-<pass>-<model>[-<flag without its leading dashes>]-<UTC stamp>/ under ~/.claude/loop-claude-transcripts
|
||||
replays/review-replay-<pass>-<model>[-<flag without its leading dashes>]-<UTC stamp>/ under ~/.local/state/build-release/transcripts
|
||||
or $BUILD_RELEASE_TRANSCRIPTS. A run's .jsonl file starts with a line holding claude's arguments, working
|
||||
directory, prompt, exit code and stderr, then holds claude's stream-json output; result.md holds the report.
|
||||
|
||||
@@ -103,7 +103,7 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
|
||||
# The replays as archived start under this environment too, so a change it already holds would reach all four.
|
||||
if change and (inherited := [name for name in change.env if name in env]):
|
||||
return failed(TOOL, f"the replays as archived would inherit {', '.join(inherited)} from this environment, and the comparison needs them without it: unset it and run again")
|
||||
rounds = archived_rounds(REVIEWERS[reviewed], project.model, archive_root(home, env), home)
|
||||
rounds = archived_rounds(REVIEWERS[reviewed], project.model, archive_root(home, env), home, env)
|
||||
if isinstance(rounds, Failure):
|
||||
return failed(TOOL, rounds.reason)
|
||||
codes = codes_found(rounds, effects, say)
|
||||
@@ -113,14 +113,14 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
|
||||
folder = replay_folder(archive_root(home, env), TOOL, argv, effects.now())
|
||||
effects = archiving(effects, folder, say)
|
||||
if change:
|
||||
report = compared(reviewed, project, chosen, change, lambda found, applied: findings_replayed(found, codes[found], project, project, home, effects, applied, scratch), say, at_once)
|
||||
report = compared(reviewed, project, chosen, change, lambda found, applied: findings_replayed(found, codes[found], project, project, home, env, effects, applied, scratch), say, at_once)
|
||||
if isinstance(report, Limited):
|
||||
return limited_exit(TOOL, report)
|
||||
print_report(folder, report)
|
||||
return 0
|
||||
|
||||
def replay_one(found: Round, rung: Rung) -> set[int] | Failure | Limited:
|
||||
matched = findings_replayed(found, codes[found], rung, project, home, effects, None, scratch)
|
||||
matched = findings_replayed(found, codes[found], rung, project, home, env, effects, None, scratch)
|
||||
if isinstance(matched, Failure):
|
||||
say(f" {found.root} {found.at} on {rung} failed: {matched.reason}")
|
||||
return matched
|
||||
|
||||
+27
-17
@@ -1,6 +1,7 @@
|
||||
"""Replay one archived review round on one rung: the code the round reviewed, found again in a throwaway clone, the reviewer's report on it, and the match of that report to the round's archived findings: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their 🔴 and 🟡 findings no more than a margin below the project's rung's own replay`."""
|
||||
import dataclasses
|
||||
import json
|
||||
from collections.abc import Mapping
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
@@ -18,10 +19,13 @@ from record_store.stores import local_file, store
|
||||
from project_config.main import located
|
||||
from review_rules.reviewer_context import principles_line, reviewer_context
|
||||
from text_files.compressed import read_stored, SUFFIX
|
||||
from review_rules.review_folder import REPORTS, review_folder
|
||||
from review_rules.review_folder import reports_folder, review_folder
|
||||
from model_routing.ladder import Rung
|
||||
from loop_state.paths import STATE_HOME
|
||||
from claude_code.entries import structured_output
|
||||
|
||||
# Where, under the home folder, the review folders were until 0.18.0: the prompt of a round archived before then names its review folder there.
|
||||
REPORTS_BEFORE_0_18 = f"{STATE_HOME}/larv-review"
|
||||
MATCH_SCHEMA = {"type": "object", "properties": {"found": {"type": "array", "items": {"type": "integer"}}}, "required": ["found"], "additionalProperties": False}
|
||||
|
||||
|
||||
@@ -75,9 +79,9 @@ def commit_log(listed: str) -> list[tuple[str, float]]:
|
||||
return [(commit, float(authored)) for commit, authored in (line.split() for line in listed.splitlines())]
|
||||
|
||||
|
||||
def findings_replayed(found: Round, code: Code, rung: Rung, project: Rung, home: pathlib.Path, effects: Effects, change: Change | None, scratch: pathlib.Path | None) -> set[int] | Failure | Limited:
|
||||
def findings_replayed(found: Round, code: Code, rung: Rung, project: Rung, home: pathlib.Path, env: Mapping[str, str], effects: Effects, change: Change | None, scratch: pathlib.Path | None) -> set[int] | Failure | Limited:
|
||||
"""The indexes of the round's findings that its replay on rung reports, as claude on the project's rung matches them, or the Failure of the review or the match; where change is given, the replay runs with it, as `launch` says. The clone is made under scratch, or under the system's temporary folder where it is None."""
|
||||
reviewed: str | Failure | Limited = first_reply(lambda: review(found, code, rung, home, effects, change, scratch))
|
||||
reviewed: str | Failure | Limited = first_reply(lambda: review(found, code, rung, home, env, effects, change, scratch))
|
||||
if isinstance(reviewed, (Failure, Limited)):
|
||||
return reviewed
|
||||
return first_reply(lambda: match(found.findings, reviewed, found.root, project, effects))
|
||||
@@ -91,27 +95,27 @@ class Copies:
|
||||
|
||||
|
||||
# The shell makes and removes the clone itself, and is tested on a temporary home as judge-replay's is.
|
||||
def review(found: Round, code: Code, rung: Rung, home: pathlib.Path, effects: Effects, change: Change | None, scratch: pathlib.Path | None) -> str | Failure | Limited:
|
||||
def review(found: Round, code: Code, rung: Rung, home: pathlib.Path, env: Mapping[str, str], effects: Effects, change: Change | None, scratch: pathlib.Path | None) -> str | Failure | Limited:
|
||||
try:
|
||||
(home / REPORTS).mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix="review-replay-", dir=scratch, ignore_cleanup_errors=True) as clone, tempfile.TemporaryDirectory(prefix="review-replay-", dir=home / REPORTS, ignore_cleanup_errors=True) as reports:
|
||||
return reviewed_in(found, code, rung, Copies(clone, reports), home, effects, change)
|
||||
reports_folder(home, env).mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix="review-replay-", dir=scratch, ignore_cleanup_errors=True) as clone, tempfile.TemporaryDirectory(prefix="review-replay-", dir=reports_folder(home, env), ignore_cleanup_errors=True) as reports:
|
||||
return reviewed_in(found, code, rung, Copies(clone, reports), home, env, effects, change)
|
||||
except OSError as failure:
|
||||
return Failure(f"could not prepare the replay: {failure}")
|
||||
|
||||
|
||||
def reviewed_in(found: Round, code: Code, rung: Rung, copies: Copies, home: pathlib.Path, effects: Effects, change: Change | None) -> str | Failure | Limited:
|
||||
def reviewed_in(found: Round, code: Code, rung: Rung, copies: Copies, home: pathlib.Path, env: Mapping[str, str], effects: Effects, change: Change | None) -> str | Failure | Limited:
|
||||
"""The report of found's reviewer on rung, replayed on code cloned into copies.clone, with its review folder copied into copies.reports; with change where given."""
|
||||
folder = pathlib.Path(review_folder(str(home), code.path))
|
||||
folder = pathlib.Path(review_folder(str(home), env, code.path))
|
||||
copy_reports(found, folder, copies.reports)
|
||||
prompt = redirected(found.prompt, home, folder, code.path, copies)
|
||||
prompt = redirected(found.prompt, home, folder, reports_folder(home, env), code.path, copies)
|
||||
if isinstance(prompt, Failure):
|
||||
return prompt
|
||||
if lost := lost_inputs(prompt, copies.reports, lambda name: (pathlib.Path(copies.reports) / name).exists()):
|
||||
return Failure(f"the prompt names {', '.join(lost)}, which the review folder did not hold from the chunk's start until the round's")
|
||||
if isinstance(cloned := clone_reviewed(found, code, copies.clone, effects), Failure):
|
||||
return cloned
|
||||
launched = launch(found.reviewer, rung, prompt, found.root, copies, home, change)
|
||||
launched = launch(found.reviewer, rung, prompt, found.root, copies, home, env, change)
|
||||
if isinstance(launched, Failure):
|
||||
return launched
|
||||
reply = claude_reply(effects.claude, launched[0], copies.clone, launched[1], "claude")
|
||||
@@ -120,7 +124,7 @@ def reviewed_in(found: Round, code: Code, rung: Rung, copies: Copies, home: path
|
||||
return reply["result"] if isinstance(reply.get("result"), str) else Failure("the reviewer replied with no report")
|
||||
|
||||
|
||||
def launch(reviewer: str, rung: Rung, prompt: str, checkout: str, copies: Copies, home: pathlib.Path, change: Change | None) -> tuple[list[str], str] | Failure:
|
||||
def launch(reviewer: str, rung: Rung, prompt: str, checkout: str, copies: Copies, home: pathlib.Path, env: Mapping[str, str], change: Change | None) -> tuple[list[str], str] | Failure:
|
||||
"""claude's arguments and prompt for reviewer on rung, in copies.clone, a copy of the project whose checkout is checkout. Where change is given, claude starts under the environment change holds, which claude's settings set; where change turns the instruction files off, the prompt holds what the SubagentStart hook and the header's last line hand such a reviewer."""
|
||||
args = ["--agent", reviewer, *rung.flags()]
|
||||
if change is None:
|
||||
@@ -132,7 +136,7 @@ def launch(reviewer: str, rung: Rung, prompt: str, checkout: str, copies: Copies
|
||||
context = reviewer_context(home)
|
||||
if isinstance(context, Failure):
|
||||
return context
|
||||
config = located(checkout, home)
|
||||
config = located(checkout, home, env)
|
||||
if isinstance(config, Failure):
|
||||
return config
|
||||
record = store(config, "decisions")
|
||||
@@ -160,12 +164,18 @@ def copy_reports(found: Round, folder: pathlib.Path, reports: str) -> None:
|
||||
(pathlib.Path(reports) / name).write_bytes(read_stored(folder / name))
|
||||
|
||||
|
||||
def redirected(prompt: str, home: pathlib.Path, folder: pathlib.Path, worktree: str, copies: Copies) -> str | Failure:
|
||||
"""prompt naming copies.reports in place of the review folder, in either spelling, and copies.clone in place of the worktree; a Failure where it still names the review folder."""
|
||||
def redirected(prompt: str, home: pathlib.Path, folder: pathlib.Path, reports: pathlib.Path, worktree: str, copies: Copies) -> str | Failure:
|
||||
"""prompt naming copies.reports in place of the review folder, in each spelling, and copies.clone in place of the worktree; a Failure where it still names a review folder. folder is the chunk's review folder, in the reports folder reports."""
|
||||
# Replace the folder's path first: outside home it contains the worktree's path, which replacing the worktree's would otherwise turn into the clone's.
|
||||
prompt = prompt.replace(str(folder), copies.reports).replace(f"~/{folder.relative_to(home)}", copies.reports).replace(worktree, copies.clone)
|
||||
for root in (reports, home / REPORTS_BEFORE_0_18):
|
||||
named = root / folder.relative_to(reports)
|
||||
prompt = prompt.replace(str(named), copies.reports)
|
||||
if named.is_relative_to(home):
|
||||
prompt = prompt.replace(f"~/{named.relative_to(home)}", copies.reports)
|
||||
prompt = prompt.replace(worktree, copies.clone)
|
||||
# A spelling the rewrite misses, such as $HOME/, would leave the reviewer the live folder and the findings in it.
|
||||
if REPORTS in prompt.replace(copies.reports, ""):
|
||||
rest = prompt.replace(copies.reports, "")
|
||||
if any(spelling in rest for spelling in (REPORTS_BEFORE_0_18, f"{reports.parent.name}/{reports.name}")):
|
||||
return Failure("the prompt names the review folder in a spelling the replay does not redirect")
|
||||
return prompt
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ def sample(rounds: list[Round], latest: int) -> list[Round]:
|
||||
return sorted(rounds, key=lambda found: (found.seconds, found.root))[-latest:]
|
||||
|
||||
|
||||
def archived_rounds(reviewer: str, model: str, root: pathlib.Path, home: pathlib.Path) -> list[Round] | Failure:
|
||||
projects = projects_on(model, home)
|
||||
def archived_rounds(reviewer: str, model: str, root: pathlib.Path, home: pathlib.Path, env: typing.Mapping[str, str]) -> list[Round] | Failure:
|
||||
projects = projects_on(model, home, env)
|
||||
if isinstance(projects, Failure):
|
||||
return projects
|
||||
found = []
|
||||
|
||||
@@ -129,11 +129,11 @@ class Launch(unittest.TestCase):
|
||||
self.config = configured(self, self.checkout, home=self.home) / "config.toml"
|
||||
|
||||
def test_runs_the_reviewer_as_archived_with_claude_md(self):
|
||||
self.assertEqual(replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, None), (["--agent", "prose-reviewer", *REFERENCE.flags()], "Review it."))
|
||||
self.assertEqual(replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, {}, None), (["--agent", "prose-reviewer", *REFERENCE.flags()], "Review it."))
|
||||
|
||||
def test_drops_claude_md_and_hands_the_reviewer_what_the_hook_and_the_header_would(self):
|
||||
(self.clone / "AGENTS.md").write_text("")
|
||||
args, prompt = replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, changes.OMIT)
|
||||
args, prompt = replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, {}, changes.OMIT)
|
||||
self.assertEqual(args, ["--agent", "prose-reviewer", *REFERENCE.flags(), "--settings", json.dumps({"env": {"CLAUDE_CODE_DISABLE_CLAUDE_MDS": "1"}})])
|
||||
self.assertEqual(prompt, f"{reviewer_context(self.home)}\n\nReview it.\nPrinciples: read {self.clone}/AGENTS.md first, for the project principles and the decision titles.")
|
||||
|
||||
@@ -141,7 +141,7 @@ class Launch(unittest.TestCase):
|
||||
self.config.write_text(self.config.read_text().replace('"checkout:AGENTS.md"', '"folder:AGENTS.md"'))
|
||||
(self.clone / "AGENTS.md").write_text("")
|
||||
(self.config.parent / "AGENTS.md").write_text("")
|
||||
prompt = replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, changes.OMIT)[1]
|
||||
prompt = replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, {}, changes.OMIT)[1]
|
||||
self.assertTrue(prompt.endswith(f"Principles: read {self.config.parent}/AGENTS.md first, for the project principles and the decision titles."), prompt)
|
||||
|
||||
def test_names_the_decision_log_in_the_clone_or_where_it_stands_outside_the_checkout_without_agents_md(self):
|
||||
@@ -151,16 +151,16 @@ class Launch(unittest.TestCase):
|
||||
self.config.write_text(self.config.read_text().replace('"checkout:docs/decisions.md"', f'"{setting}"'))
|
||||
decisions.parent.mkdir(exist_ok=True)
|
||||
decisions.write_text("1. A principle.\n\n# Decisions\n")
|
||||
prompt = replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, changes.OMIT)[1]
|
||||
prompt = replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, {}, changes.OMIT)[1]
|
||||
self.assertTrue(prompt.endswith(f"Principles: read {decisions} first, up to `# Decisions`, for the project principles and the decision titles."), prompt)
|
||||
|
||||
def test_fails_without_a_config_for_the_checkout(self):
|
||||
self.config.unlink()
|
||||
self.assertIn("no config names the checkout", replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, changes.OMIT).reason)
|
||||
self.assertIn("no config names the checkout", replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, {}, changes.OMIT).reason)
|
||||
|
||||
def test_fails_without_the_sections_to_hand_over(self):
|
||||
(self.home / ".claude" / "CLAUDE.md").write_text("")
|
||||
self.assertIsInstance(replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, changes.OMIT), Failure)
|
||||
self.assertIsInstance(replay.launch("prose-reviewer", REFERENCE, "Review it.", str(self.checkout), replay.Copies(str(self.clone), str(self.reports)), self.home, {}, changes.OMIT), Failure)
|
||||
|
||||
|
||||
class Match(unittest.TestCase):
|
||||
@@ -204,9 +204,10 @@ class Main(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.home = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
|
||||
self.archive = self.home / ".claude" / "loop-claude-transcripts"
|
||||
self.archive = self.home / ".local/state/build-release" / "transcripts"
|
||||
(self.home / ".claude").mkdir()
|
||||
(self.home / ".claude" / "loop-claude-models.json").write_text(json.dumps({"proj": "claude-opus-5-5", "other": "claude-sonnet-5-5"}))
|
||||
(self.home / ".config/build-release").mkdir(parents=True)
|
||||
(self.home / ".config/build-release" / "models.json").write_text(json.dumps({"proj": "claude-opus-5-5", "other": "claude-sonnet-5-5"}))
|
||||
origin, self.checkout = self.home / "origin.git", self.home / "code" / "proj"
|
||||
run_git(self.home, "init", "-q", "--bare", "-b", "main", str(origin))
|
||||
run_git(self.home, "clone", "-q", str(origin), str(self.checkout))
|
||||
@@ -278,7 +279,7 @@ class Main(unittest.TestCase):
|
||||
def test_keeps_each_reviewer_and_match_run_and_the_printed_report_in_one_folder_of_the_archive(self):
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [0, 1]})
|
||||
self.assertEqual(code, 0, err)
|
||||
folder = self.home / ".claude" / "loop-claude-transcripts" / "replays" / "review-replay-stability-claude-opus-5-5-20260921T141320Z"
|
||||
folder = self.home / ".local/state/build-release" / "transcripts" / "replays" / "review-replay-stability-claude-opus-5-5-20260921T141320Z"
|
||||
self.assertEqual((folder / "result.md").read_text(encoding="utf-8"), out)
|
||||
runs = [json.loads(path.read_text(encoding="utf-8").splitlines()[0]) for path in folder.glob("*.jsonl")]
|
||||
# A run that repeats another word for word, as the fakes' do, is kept once.
|
||||
@@ -445,7 +446,7 @@ class Main(unittest.TestCase):
|
||||
|
||||
def review_folder_with_round_1(self):
|
||||
"""The chunk's review folder. The chunk began at 09:15 and the replayed round 2 at 10:00. It holds round 1's report, written at 09:15:00; round 2's report, written after 10:00; the prose pass's report, written at 10:00:00; and an earlier attempt's report, from before 09:15."""
|
||||
folder = self.home / ".local" / "state" / "larv-review" / "code" / "proj-x"
|
||||
folder = self.home / ".local" / "state" / "build-release" / "larv-review" / "code" / "proj-x"
|
||||
folder.mkdir(parents=True)
|
||||
(folder / "stability-round-1.md").write_text("round 1\n")
|
||||
began = stamp_seconds("2026-10-14T09:15:00Z")
|
||||
@@ -469,7 +470,7 @@ class Main(unittest.TestCase):
|
||||
def test_copies_a_compressed_report_from_before_the_round_under_its_plain_name(self):
|
||||
folder = self.review_folder_with_round_1()
|
||||
self.assertIsNone(compress(folder / "stability-round-1.md"))
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to ~/.local/state/larv-review/code/proj-x/stability-round-2.md; the last round's is ~/.local/state/larv-review/code/proj-x/stability-round-1.md.")
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to ~/.local/state/build-release/larv-review/code/proj-x/stability-round-2.md; the last round's is ~/.local/state/build-release/larv-review/code/proj-x/stability-round-1.md.")
|
||||
seen = []
|
||||
|
||||
def review(rung):
|
||||
@@ -483,7 +484,7 @@ class Main(unittest.TestCase):
|
||||
|
||||
def test_points_the_prompts_review_folder_at_a_copy_of_the_reports_from_before_the_round_that_it_removes(self):
|
||||
folder = self.review_folder_with_round_1()
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to ~/.local/state/larv-review/code/proj-x/stability-round-2.md; the last round's is ~/.local/state/larv-review/code/proj-x/stability-round-1.md.")
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to ~/.local/state/build-release/larv-review/code/proj-x/stability-round-2.md; the last round's is ~/.local/state/build-release/larv-review/code/proj-x/stability-round-1.md.")
|
||||
seen = []
|
||||
|
||||
def review(rung):
|
||||
@@ -512,9 +513,19 @@ class Main(unittest.TestCase):
|
||||
self.assertNotIn(str(folder), prompt)
|
||||
self.assertRegex(prompt, rf"report to {folder.parents[1]}/review-replay-\w+/stability-round-2\.md\.$")
|
||||
|
||||
def test_points_a_review_folder_named_where_it_was_before_0_18_at_the_copy(self):
|
||||
folder = self.review_folder_with_round_1()
|
||||
for spelling in (f"{self.home}/.local/state/larv-review", "~/.local/state/larv-review"):
|
||||
with self.subTest(spelling=spelling):
|
||||
self.reviews.clear()
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to {spelling}/{folder.relative_to(folder.parents[1])}/stability-round-2.md.")
|
||||
code, _, err = self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [0, 1]})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertRegex(self.reviews[0][4], rf"report to {folder.parents[1]}/review-replay-\w+/stability-round-2\.md\.$")
|
||||
|
||||
def test_replays_no_round_whose_prompt_still_names_the_review_folder_after_the_rewrite(self):
|
||||
self.review_folder_with_round_1()
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to $HOME/.local/state/larv-review/code/proj-x/stability-round-2.md.")
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to $HOME/.local/state/build-release/larv-review/code/proj-x/stability-round-2.md.")
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], unused)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual(self.reviews, [])
|
||||
@@ -527,7 +538,7 @@ class Main(unittest.TestCase):
|
||||
(folder / "branch.diff").write_text("the diff\n")
|
||||
before = stamp_seconds("2026-10-14T09:50:00Z")
|
||||
os.utime(folder / "branch.diff", (before, before))
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. The diff is ~/.local/state/larv-review/code/proj-x/branch.diff. Write your report to ~/.local/state/larv-review/code/proj-x/stability-round-2.md.")
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. The diff is ~/.local/state/build-release/larv-review/code/proj-x/branch.diff. Write your report to ~/.local/state/build-release/larv-review/code/proj-x/stability-round-2.md.")
|
||||
code, _, err = self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [0, 1]})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertRegex(self.reviews[0][4], rf"The diff is {folder.parents[1]}/review-replay-\w+/branch\.diff\.")
|
||||
@@ -535,7 +546,7 @@ class Main(unittest.TestCase):
|
||||
def test_replays_no_round_whose_prompt_names_an_input_the_folder_holds_only_as_rewritten_after_the_round_began(self):
|
||||
folder = self.review_folder_with_round_1()
|
||||
(folder / "branch.diff").write_text("a later diff\n")
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. The diff is ~/.local/state/larv-review/code/proj-x/branch.diff. Write your report to ~/.local/state/larv-review/code/proj-x/stability-round-2.md.")
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. The diff is ~/.local/state/build-release/larv-review/code/proj-x/branch.diff. Write your report to ~/.local/state/build-release/larv-review/code/proj-x/stability-round-2.md.")
|
||||
code, out, err = self.run_main(["stability", "claude-opus-5-5"], unused)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual(self.reviews, [])
|
||||
@@ -544,7 +555,7 @@ class Main(unittest.TestCase):
|
||||
def test_fails_the_replay_and_leaves_no_folder_behind_when_it_cannot_copy_the_reports(self):
|
||||
folder = self.review_folder_with_round_1()
|
||||
(folder / "stability-round-1.md").chmod(0)
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to ~/.local/state/larv-review/code/proj-x/stability-round-2.md.")
|
||||
self.set_prompt(f"Review branch x in {self.home}/code/proj-x. Write your report to ~/.local/state/build-release/larv-review/code/proj-x/stability-round-2.md.")
|
||||
scratch = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
|
||||
self.limits["scratch"] = scratch
|
||||
code, _, err = self.run_main(["stability", "claude-opus-5-5"], unused)
|
||||
|
||||
Reference in New Issue
Block a user