From 44d882f9e2ba9161de143fd4e0bc5109f4db337e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 15 Oct 2026 20:59:43 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20architecture=20round=203:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1;=20give=20each=20left-out=20ca?= =?UTF-8?q?se=20its=20own=20test,=20and=20read=20the=20log=20from=20the=20?= =?UTF-8?q?default=20branch=20the=20checkout=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/stability_replay/main.py | 4 ++-- bin/stability_replay/test_stability_replay.py | 23 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/bin/stability_replay/main.py b/bin/stability_replay/main.py index 3ee06c9b..f2671a0c 100644 --- a/bin/stability_replay/main.py +++ b/bin/stability_replay/main.py @@ -123,8 +123,8 @@ def code_of(found: Round, effects: Effects) -> Code | Failure: if isinstance(default, Failure): return default default = default.strip().removeprefix("origin/") - log = git(effects, found.root, "log", "--format=%H %at", "refs/remotes/origin/HEAD") - main_line = git(effects, found.root, "log", "--first-parent", "--format=%H %at", "refs/remotes/origin/HEAD") + log = git(effects, found.root, "log", "--format=%H %at", f"refs/remotes/origin/{default}") + main_line = git(effects, found.root, "log", "--first-parent", "--format=%H %at", f"refs/remotes/origin/{default}") if isinstance(log, Failure): return log if isinstance(main_line, Failure): diff --git a/bin/stability_replay/test_stability_replay.py b/bin/stability_replay/test_stability_replay.py index 23a0aa38..d6936e8c 100644 --- a/bin/stability_replay/test_stability_replay.py +++ b/bin/stability_replay/test_stability_replay.py @@ -211,13 +211,22 @@ class Main(unittest.TestCase): self.assertEqual(self.run_main(["claude-opus-5-5"], lambda rung: {"found": [0]})[0], 0) self.assertEqual(self.reviews[0][1:3], ("1\n", "")) - def test_leaves_out_a_round_whose_code_it_cannot_find(self): - for gone in (lambda: self.set_prompt("Review the branch."), lambda: subprocess.run(["git", "remote", "set-head", "origin", "-d"], cwd=self.checkout, check=True), lambda: shutil.rmtree(self.checkout)): - with self.subTest(gone): - gone() - code, _, err = self.run_main(["claude-opus-5-5"], unused) - self.assertEqual(code, 1) - self.assertIn("1 of 1 rounds holding a 🔴 or 🟡 are left out", err) + def assert_left_out(self): + code, _, err = self.run_main(["claude-opus-5-5"], unused) + self.assertEqual(code, 1) + self.assertIn("1 of 1 rounds holding a 🔴 or 🟡 are left out", err) + + def test_leaves_out_a_round_whose_prompt_names_no_worktree(self): + self.set_prompt("Review the branch.") + self.assert_left_out() + + def test_leaves_out_a_round_whose_checkout_names_no_default_branch(self): + run_git(self.checkout, "remote", "set-head", "origin", "-d") + self.assert_left_out() + + def test_leaves_out_a_round_whose_checkout_is_gone(self): + shutil.rmtree(self.checkout) + self.assert_left_out() def test_exits_1_on_a_usage_limit_bad_arguments_or_no_round_to_replay(self): code, _, err = self.run_main(["claude-opus-5-5"], lambda rung: {"type": "result", "api_error_status": 429, "result": "You've hit your limit"})