From af2593370a17f8fca5a7b405915b4853b29ae0e2 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 09:13:36 +0100 Subject: [PATCH] Log a label among the writes a dry run prints --- bin/do_epic/backend/fake.py | 1 + bin/do_epic/test_dry_run.py | 17 +++++++++++++++++ bin/do_epic/test_main.py | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/bin/do_epic/backend/fake.py b/bin/do_epic/backend/fake.py index 61cd83df..6f2defcb 100644 --- a/bin/do_epic/backend/fake.py +++ b/bin/do_epic/backend/fake.py @@ -48,6 +48,7 @@ class MemoryEpic: if child is None: return no_child(self.epic_key, key, "labelled") self.change(key, labels=tuple(sorted({*child.labels, label}))) + self.writes.append(f"label {key} with {label}") return None def rank(self, key: str, before: str) -> None | Failure: diff --git a/bin/do_epic/test_dry_run.py b/bin/do_epic/test_dry_run.py index e18a26da..e641cf11 100644 --- a/bin/do_epic/test_dry_run.py +++ b/bin/do_epic/test_dry_run.py @@ -70,6 +70,23 @@ class TheEpicItCopies(unittest.TestCase): self.assertEqual((real.writes, [each.key for each in real.issues]), ([], ["ABC-20", "ABC-21"])) self.assertEqual(copy.writes, ["file ABC-new1 under ABC-20: A", "file ABC-new2 under ABC-20: B"]) + def test_notes_each_kind_of_write_in_order(self) -> None: + epic = MemoryEpic("ABC-12", [issue("ABC-20"), issue("ABC-21")]) + epic.file("ABC-20", "Sub", "d", ("repo:api",), "ABC-21") + epic.add_label("ABC-21", "do-epic-claude") + epic.rank("ABC-21", "ABC-20") + epic.comment("ABC-20", " Why. ") + epic.finish_issue("ABC-21") + epic.close("All done") + self.assertEqual(epic.writes, ["file ABC-102 under ABC-20: Sub, labelled repo:api, blocked by ABC-21", "label ABC-21 with do-epic-claude", "rank ABC-21 before ABC-20", "comment on ABC-20: Why.", "finish ABC-21", "close the epic: All done"]) + + def test_notes_no_write_that_fails(self) -> None: + epic = MemoryEpic("ABC-12", [issue("ABC-20")]) + epic.add_label("ABC-99", "x") + epic.comment("ABC-20", " ") + epic.finish_issue("ABC-99") + self.assertEqual(epic.writes, []) + def test_fails_where_the_real_epic_cannot_be_read(self) -> None: self.assertEqual(dry_run.seeded(MemoryEpic("ABC-12", [], fails="Jira answered 503")), Failure("Jira answered 503")) diff --git a/bin/do_epic/test_main.py b/bin/do_epic/test_main.py index ba50a967..6e6dd988 100644 --- a/bin/do_epic/test_main.py +++ b/bin/do_epic/test_main.py @@ -992,6 +992,12 @@ class TheDryRun(DoEpicTest): changing = {"new-session", "new-window", "kill-window", "set-option", "rename-window"} self.assertEqual([args for args in fake.tmux_calls if args[0] in changing], []) + def test_prints_the_label_a_pick_would_give_an_issue(self) -> None: + self.issues = [issue("ABC-20")] + code, out, _ = self.run_main(["ABC-12", "--dry-run"], FakeEffects(claude=[structured({"parts": []}), structured({"pick": "claude"})])) + self.assertEqual(code, 0) + self.assertIn("planning would write to Jira:\n- label ABC-20 with do-epic-claude\nwould start ABC-20\n", out.replace("<1790000000> ", "")) + def test_counts_the_chunks_it_would_start_against_the_epics_cap_and_a_repos_limit(self) -> None: self.issues = [issue("ABC-21", "do-epic-claude"), issue("ABC-22", "do-epic-claude"), issue("ABC-23", "do-epic-claude")] self.description = DESCRIPTION.replace("2", "1")