aboutsummaryrefslogtreecommitdiffziptar.gz
path: root/tests/test_split.py
diff options
context:
space:
mode:
authorgodosa <godosa@godosa.eu>2026-10-07 11:06:25 +0200
committergodosa <godosa@godosa.eu>2026-10-07 11:06:25 +0200
commitf23d7d865eb042512ebabad87e89b35b11cc1c64 (patch)
treeae575d025b2c0d0d86c72ec9e79f1d833a38371b /tests/test_split.py
parent959275f862e84ee20207f7eef3f1c0f999f6993d (diff)
downloadworkflow-f23d7d865eb042512ebabad87e89b35b11cc1c64.tar.gz
workflow-f23d7d865eb042512ebabad87e89b35b11cc1c64.zip
wf orch post: commit leftover books with code sha; reject private sha in split
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JEAjUkQRrCYX5MZhWxdtj2
Diffstat (limited to 'tests/test_split.py')
-rw-r--r--tests/test_split.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_split.py b/tests/test_split.py
index 9d19308..f8495eb 100644
--- a/tests/test_split.py
+++ b/tests/test_split.py
@@ -290,6 +290,43 @@ class OrchSplitTest(SplitCli):
self.assertIn(f" {self.sha(self.code)} ", (self.root / "out" / "wf-orch.log").read_text())
+ def _finish_then_dirty_books(self):
+ self.wf("orch", "pick", "fast", "--id", "t-three", project=False, env=IDENT)
+ wt = self.code / ".worktrees" / "fast"
+ self.wf("start", "t-three", "--worktree", str(wt), "--branch", "fast/t-three", project=False, env=IDENT)
+ (wt / "code.txt").write_text("x\n")
+ code, out, err = self.wf("finish", "t-three", "-m", "ok", "--commit", "impl", "code.txt",
+ project=False, cwd=wt, env=IDENT)
+ self.assertEqual(code, 0, out + err)
+ self.wf("note", "t-one", "later edit", project=False, env=IDENT) # books dirty in the private tree
+ self.assertTrue(subprocess.run(["git", "status", "--porcelain", "TASKS.md"], cwd=self.root,
+ capture_output=True, text=True).stdout.strip())
+
+ def test_post_done_commits_leftover_books_with_code_sha(self):
+ self._finish_then_dirty_books()
+ csha = self.sha(self.code)
+ code, out, err = self.wf("orch", "post", "t-three", "fast", "--result", "done", "--commit", csha,
+ "--no-pick", project=False, env=IDENT)
+ self.assertEqual(code, 0, out + err)
+ self.assertEqual(self.log(self.root).splitlines()[:2], [f"t-three done (code {csha})"] * 2)
+ self.assertFalse(subprocess.run(["git", "status", "--porcelain", "TASKS.md"], cwd=self.root,
+ capture_output=True, text=True).stdout.strip())
+ self.assertIn(f" t-three done {csha} ", (self.root / "out" / "wf-orch.log").read_text())
+
+ def test_post_stale_private_sha_replaced_by_code_sha(self):
+ self._finish_then_dirty_books()
+ stale = self.sha(self.root) # worker reported the private repo's HEAD
+ code, out, err = self.wf("orch", "post", "t-three", "fast", "--result", "done", "--commit", stale,
+ "--no-pick", project=False, env=IDENT)
+ self.assertEqual(code, 0, out + err)
+ csha = self.sha(self.code)
+ self.assertIn(f"commit {stale} not in code repo", out)
+ self.assertIn(f" t-three done {csha} ", (self.root / "out" / "wf-orch.log").read_text())
+ self.assertEqual(self.log(self.root).splitlines()[:2], [f"t-three done (code {csha})"] * 2)
+ self.assertFalse(subprocess.run(["git", "status", "--porcelain", "TASKS.md"], cwd=self.root,
+ capture_output=True, text=True).stdout.strip())
+
+
class CheckSplitTest(SplitCli):
def test_cloud_error_push_and_ignore_warnings(self):
(self.root / "workflow.toml").write_text(SplitCli.toml + "cloud = true\n")