Define contributor finalisation and integration lifecycle

This commit is contained in:
rob
2026-11-17 20:08:56 +00:00
parent 934e62ccd1
commit c2d456151d
14 changed files with 145 additions and 31 deletions
+48
View File
@@ -47,6 +47,54 @@ class ContributorWorkflowTests(unittest.TestCase):
self.assertIn(str(first), git(base, "worktree", "list"))
self.assertIn(str(second), git(base, "worktree", "list"))
def test_failed_push_preserves_committed_task_and_worktree(self):
with tempfile.TemporaryDirectory() as temp:
base = Path(temp) / "project with spaces"
base.mkdir()
git(base, "init", "-q", "-b", "codex")
git(base, "config", "user.name", "Fixture")
git(base, "config", "user.email", "fixture@example.org")
(base / "base.txt").write_text("base\n")
git(base, "add", "base.txt")
git(base, "commit", "-qm", "base")
task = Path(temp) / "task with spaces"
git(base, "worktree", "add", "-qb", "task-a", str(task), "codex")
(task / "feature.txt").write_text("ready\n")
git(task, "add", "feature.txt")
git(task, "commit", "-qm", "task implementation")
commit = git(task, "rev-parse", "HEAD")
git(task, "remote", "add", "origin", str(Path(temp) / "missing-remote"))
push = subprocess.run(["git", "-C", str(task), "push", "origin", "task-a"], capture_output=True, text=True)
self.assertNotEqual(push.returncode, 0)
self.assertEqual(git(task, "rev-parse", "HEAD"), commit)
self.assertTrue((task / "feature.txt").exists())
self.assertIn(str(task), git(base, "worktree", "list"))
def test_failed_combined_check_does_not_close_task(self):
with tempfile.TemporaryDirectory() as temp:
base = Path(temp) / "project"
base.mkdir()
git(base, "init", "-q", "-b", "codex")
git(base, "config", "user.name", "Fixture")
git(base, "config", "user.email", "fixture@example.org")
(base / "shared.txt").write_text("base\n")
(base / "TASKS.md").write_text("Task A: Ready for Review / Integration\n")
git(base, "add", "shared.txt", "TASKS.md")
git(base, "commit", "-qm", "base")
task = Path(temp) / "task-a"
git(base, "worktree", "add", "-qb", "task-a", str(task), "codex")
(task / "feature.txt").write_text("passes isolated check\n")
git(task, "add", "feature.txt")
git(task, "commit", "-qm", "task implementation")
self.assertTrue((task / "feature.txt").exists())
git(base, "merge", "--no-ff", "-qm", "approved candidate", "task-a")
combined = subprocess.run(["python3", "-c", "import sys; sys.exit(1)"], cwd=base)
self.assertNotEqual(combined.returncode, 0)
self.assertIn("Ready for Review / Integration", (base / "TASKS.md").read_text())
self.assertNotIn("Integrated\n", (base / "TASKS.md").read_text())
self.assertIn(str(task), git(base, "worktree", "list"))
self.assertEqual(git(task, "rev-parse", "HEAD"), git(base, "rev-parse", "task-a"))
if __name__ == "__main__":
unittest.main()