Answer product-owner round 2: 1 🔴, 0 🟡 (0 misread); DM through the notifier of a repo of the epic, and say in the window where none names one

This commit is contained in:
2026-11-19 03:01:31 +01:00
parent d4acb4b039
commit 4fac73c890
3 changed files with 43 additions and 14 deletions
+9 -6
View File
@@ -27,12 +27,12 @@ def message(task: EpicIssue, epic: str, held: list[str]) -> str:
return f"do-epic {epic} awaits you: {task.key}, \"{task.summary}\", blocks {' and '.join(held)}. do-epic goes on once you close {task.key} in Jira."
def checkout_of(held: list[EpicIssue], home: pathlib.Path) -> str | None:
"""The checkout of the first issue of held whose repo a project config names: where the DM finds its notifier, since the window runs in no checkout. None where there is none, and the DM goes by the current directory."""
for issue in held:
def notifier_checkout(issues: list[EpicIssue], home: pathlib.Path) -> str | None:
"""The checkout of the first of issues whose repo has a git checkout and a project config that names a notifier: where the DM finds that notifier, since the window runs in no checkout. None where there is none."""
for issue in issues:
pick = recorded(issue)
found = by_name(pick.name, home) if isinstance(pick, Repo) else None
if isinstance(found, ProjectConfig):
if isinstance(found, ProjectConfig) and found.notifier and (found.top / ".git").exists():
return str(found.top)
return None
@@ -52,6 +52,9 @@ def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, p
elif not told:
text = message(task, epic, held)
say(text, effects, stdout=True)
by_key = {issue.key: issue for issue in issues}
told = tell(text, effects, checkout_of([by_key[key] for key in held], home))
# The issues it holds up come first; any other open issue of the epic may do where they have no repo with a notifier.
where = notifier_checkout([*(issue for issue in issues if issue.key in held), *(issue for issue in issues if issue.key not in held and not issue.done)], home)
if where is None:
say("no DM went out: no open issue of the epic has a repo whose project config names a notifier and whose checkout exists", effects, stdout=True)
told = where is None or tell(text, effects, where)
effects.sleep(poll)
+33 -7
View File
@@ -1,5 +1,6 @@
import dataclasses
import pathlib
import shutil
import sys
import unittest
@@ -21,10 +22,20 @@ WINDOW = "ABC-19\t0\t@9\n"
class AHumanTaskThatBlocksAnIssue(DoEpicTest):
def setUp(self) -> None:
super().setUp()
self.issues = [issue("ABC-19", "do-epic-human"), issue("ABC-21", "do-epic-claude", blockers=("ABC-19",))]
self.issues = [issue("ABC-19", "do-epic-human"), issue("ABC-21", "repo:api", blockers=("ABC-19",))]
self.issues[0] = dataclasses.replace(self.issues[0], summary="Order the test certificate")
self.epic = MemoryEpic("ABC-12", self.issues)
self.backend = lambda config, key: (self.epic, EpicRecord(Description(self.description))) # type: ignore[method-assign, arg-type]
self.api = self.repo("api", notifier=True)
def repo(self, name: str, notifier: bool) -> pathlib.Path:
"""Makes the checkout of the repo called name that a project config names, with a notifier where notifier."""
checkout = self.home / "code" / name
folder = configured(self, checkout, home=self.home)
if notifier:
with (folder / "config.toml").open("a") as config:
config.write('env-file = "~/.claude-projects/notifier.env"\nnotifier = "slack"\n')
return checkout
def awaited(self, fake: FakeEffects, closes_after: int) -> tuple[int, str, str]:
"""The window's run, where the human closes the task once the window has slept closes_after times."""
@@ -49,7 +60,7 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest):
self.assertEqual([args for args in fake.tmux_calls if args[0] == "rename-window"], [["rename-window", "-t", "%1", "ABC-19 awaits a human's task"]])
self.assertIn("the chunk finished; started ABC-21\n", out)
self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], [])
self.assertEqual(fake.dm_directories, [None])
self.assertEqual(fake.dm_directories, [str(self.api)])
self.assertIn(fake.dms[0], out)
def test_a_dm_that_failed_is_sent_again_on_the_next_read(self) -> None:
@@ -57,13 +68,28 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest):
self.awaited(fake, closes_after=2)
self.assertEqual(len(fake.dms), 2)
def test_the_dm_goes_through_the_notifier_of_the_repo_of_an_issue_it_holds_up(self) -> None:
checkout = self.home / "code" / "api"
configured(self, checkout, home=self.home)
self.epic.change("ABC-21", labels=("repo:api",))
def test_the_dm_goes_through_the_notifier_of_the_repo_of_an_issue_it_holds_up_before_any_other_repo(self) -> None:
self.repo("web", notifier=True)
self.epic.issues.append(issue("ABC-40", "repo:web"))
fake = FakeEffects(git=UNREAD, windows=WINDOW)
self.awaited(fake, closes_after=1)
self.assertEqual(fake.dm_directories, [str(checkout)])
self.assertEqual(fake.dm_directories, [str(self.api)])
def test_the_dm_goes_through_the_notifier_of_another_open_issues_repo_where_the_held_up_issue_has_none(self) -> None:
self.epic.change("ABC-21", labels=("do-epic-claude",))
self.epic.issues.append(issue("ABC-40", "repo:api"))
fake = FakeEffects(git=UNREAD, windows=WINDOW)
self.awaited(fake, closes_after=1)
self.assertEqual(fake.dm_directories, [str(self.api)])
def test_says_in_the_window_that_no_dm_went_out_where_no_repo_of_the_epic_names_a_notifier(self) -> None:
self.epic.change("ABC-21", labels=("repo:web",))
self.repo("web", notifier=False)
shutil.rmtree(self.api)
fake = FakeEffects(git=UNREAD, windows=WINDOW)
code, out, err = self.awaited(fake, closes_after=1)
self.assertEqual((code, err, fake.dms), (0, "", []))
self.assertEqual(out.count("no DM went out"), 1, out)
def test_the_window_of_a_closed_task_goes_on_while_another_human_task_still_holds_an_issue_up(self) -> None:
self.epic.issues.extend([issue("ABC-30", "do-epic-human"), issue("ABC-31", "do-epic-claude", blockers=("ABC-30",))])