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

This commit is contained in:
2026-12-03 18:56:28 +01:00
parent 20c83f861f
commit 1ca2c8efe0
142 changed files with 1095 additions and 933 deletions
+15 -15
View File
@@ -222,12 +222,12 @@ class StartingAnEpicsChunks(unittest.TestCase):
found = self.start(self.epic(2, api=1, web=1), [issue("ABC-20", "repo:api"), issue("ABC-21", "do-epic-claude"), issue("ABC-22", "repo:web")], run)
self.assertEqual(found, Started(["ABC-20", "ABC-21"], [Waits("ABC-22", "the epic runs as many chunks as its `**Max parallel chunks:**` line allows: 2")]))
self.assertEqual(run.started(), [("epic-ABC-12", "ABC-20", f"{CHUNK_FLAG} ABC-20 ABC-12"), ("epic-ABC-12", "ABC-21", f"{CHUNK_FLAG} ABC-21 ABC-12")])
self.assertEqual([args[args.index("-c") + 1] for args in run.calls if args[0] in ("new-session", "new-window")], [str(self.home / "code/api"), str(self.home / ".local/state/do-epic/ABC-12")])
self.assertEqual([args[args.index("-c") + 1] for args in run.calls if args[0] in ("new-session", "new-window")], [str(self.home / "code/api"), str(self.home / ".local/state/build-release/do-epic/ABC-12")])
self.assertIn("BUILD_RELEASE_X=1", run.calls[[args[0] for args in run.calls].index("new-session")])
self.assertNotIn("OTHER=2", run.calls[[args[0] for args in run.calls].index("new-session")])
def parked(self, issue_key: str, on: str = "an approval") -> None:
self.assertIsNone(park(self.home / ".local/state/do-epic/ABC-12", Parked(issue_key, f"/code/api-{issue_key}", "7", "0c0f", on)))
self.assertIsNone(park(self.home / ".local/state/build-release/do-epic/ABC-12", Parked(issue_key, f"/code/api-{issue_key}", "7", "0c0f", on)))
def test_starts_the_chunks_in_the_epics_start_order_and_those_it_leaves_out_last_in_backlog_order(self) -> None:
self.order = ("ABC-23", "ABC-21")
@@ -260,7 +260,7 @@ class StartingAnEpicsChunks(unittest.TestCase):
run = Tmux(*windows, ("epic-ABC-12", "ABC-21", False, str(self.home / "code/api")))
found = self.start(self.epic(1, api=1), [issue("ABC-20", "repo:api"), issue("ABC-21", "repo:api")], run)
self.assertEqual(found, Started(["ABC-20"], []))
self.assertEqual(run.windows[-1], ("epic-ABC-12", "ABC-20", False, str(self.home / ".local/state/do-epic/ABC-12")))
self.assertEqual(run.windows[-1], ("epic-ABC-12", "ABC-20", False, str(self.home / ".local/state/build-release/do-epic/ABC-12")))
self.assertEqual([name for _, name, dead, _ in run.windows if dead], [""] * len(windows))
def test_a_human_task_that_blocks_an_issue_gets_a_window_that_takes_no_slot_of_the_epics_cap(self) -> None:
@@ -292,7 +292,7 @@ class StartingAnEpicsChunks(unittest.TestCase):
def test_stops_on_a_parked_chunk_it_cannot_read_and_starts_none(self) -> None:
self.parked("ABC-20")
file_of(self.home / ".local/state/do-epic/ABC-12", "ABC-20").write_text("{")
file_of(self.home / ".local/state/build-release/do-epic/ABC-12", "ABC-20").write_text("{")
run = Tmux()
found = start_chunks(self.epic(2, api=2), [issue("ABC-21", "repo:api")], False, None, run)
assert isinstance(found, Failure)
@@ -314,7 +314,7 @@ class StartingAnEpicsChunks(unittest.TestCase):
self.assertEqual(run.windows[0], ("epic-ABC-12", "ABC-20", False, str(self.home / "code/api")))
def test_a_parked_chunk_whose_window_started_again_doesnt_count_itself_as_running(self) -> None:
for root in (str(self.home / ".local/state/do-epic/ABC-12"), str(self.home / "code/api")):
for root in (str(self.home / ".local/state/build-release/do-epic/ABC-12"), str(self.home / "code/api")):
with self.subTest(root=root):
run = Tmux(("epic-ABC-12", "ABC-20", False, root))
self.assertIsNone(self.resumed(self.epic(1, api=1), run))
@@ -373,12 +373,12 @@ class StartingAnEpicsChunks(unittest.TestCase):
def test_holds_each_repos_starting_lock_that_build_release_holds(self) -> None:
self.start(self.epic(1, api=1), [issue("ABC-20", "repo:api")], Tmux())
self.assertTrue((self.home / ".local/state/loop-claude/api/starting").is_file())
self.assertTrue((self.home / ".local/state/do-epic/ABC-12/starting").is_file())
self.assertTrue((self.home / ".local/state/build-release/claims/api/starting").is_file())
self.assertTrue((self.home / ".local/state/build-release/do-epic/ABC-12/starting").is_file())
def test_a_parked_chunk_resumes_under_the_starting_lock_of_its_repos_checkout(self) -> None:
self.assertIsNone(self.resumed(self.epic(1, api=1), Tmux(("epic-ABC-12", "ABC-20 awaits an approval", False, ""))))
self.assertEqual([lock.parent.name for lock in (self.home / ".local/state/loop-claude").glob("*/starting")], ["api"])
self.assertEqual([lock.parent.name for lock in (self.home / ".local/state/build-release/claims").glob("*/starting")], ["api"])
def test_the_waits_keep_the_trackers_rank_order(self) -> None:
run = Tmux(("epic-ABC-12", "ABC-20", True, str(self.home / "code/api")), ("epic-ABC-12", "ABC-22", False, str(self.home / "code/api")))
@@ -393,19 +393,19 @@ class StartingAnEpicsChunks(unittest.TestCase):
self.assertNotIn(tmux.OWNER, options)
def test_says_which_lock_it_could_not_take(self) -> None:
(self.home / ".local/state/do-epic").mkdir(parents=True)
(self.home / ".local/state/do-epic/ABC-12").write_text("", encoding="utf-8")
(self.home / ".local/state/build-release/do-epic").mkdir(parents=True)
(self.home / ".local/state/build-release/do-epic/ABC-12").write_text("", encoding="utf-8")
found = start_chunks(self.epic(1, api=1), [issue("ABC-20", "repo:api")], False, None, Tmux())
assert isinstance(found, Failure)
self.assertRegex(found.reason, f"^cannot lock {self.home}/.local/state/do-epic/ABC-12: \\w")
self.assertRegex(found.reason, f"^cannot lock {self.home}/.local/state/build-release/do-epic/ABC-12: \\w")
def test_says_which_repos_lock_it_could_not_take(self) -> None:
(self.home / ".local/state").mkdir(parents=True)
(self.home / ".local/state/loop-claude").write_text("", encoding="utf-8")
(self.home / ".local/state/build-release").mkdir(parents=True)
(self.home / ".local/state/build-release/claims").write_text("", encoding="utf-8")
found = start_chunks(self.epic(1, api=1), [issue("ABC-20", "repo:api")], False, None, Tmux())
assert isinstance(found, Failure)
self.assertRegex(found.reason, f"^cannot lock {self.home}/.local/state/loop-claude/\\S+: \\w")
self.assertRegex(self.resumed(self.epic(1, api=1), Tmux()) or "", f"^cannot lock {self.home}/.local/state/loop-claude/\\S+: \\w")
self.assertRegex(found.reason, f"^cannot lock {self.home}/.local/state/build-release/claims/\\S+: \\w")
self.assertRegex(self.resumed(self.epic(1, api=1), Tmux()) or "", f"^cannot lock {self.home}/.local/state/build-release/claims/\\S+: \\w")
def test_an_error_raised_under_the_lock_is_not_reported_as_the_locks(self) -> None:
def failing(args: list[str]) -> subprocess.CompletedProcess[str]: