DM the human when a human-task issue blocks the epic's next item, and poll until it closes
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""A human's task that holds up other issues of an epic (docs/decisions.md → `do-epic: drives one Jira epic …`, "Human tasks").
|
||||
|
||||
do-epic leaves the issue as the team filed it. While it is open and blocks an open issue, its window DMs the human once, shows itself as parked so that it takes no running slot, and reads the epic every `poll` seconds. Once the issue is closed, or blocks nothing any more, the window ends, and the chunks it held up may start. A window that starts again, as after a reboot, DMs again."""
|
||||
from agent_cycle import tmux
|
||||
from agent_cycle.direct_message import tell
|
||||
from do_epic import scheduler
|
||||
from do_epic.backend.protocol import EpicIssue, EpicStore
|
||||
from failure import Failure
|
||||
from loop_effects.effects import Effects, say
|
||||
|
||||
# What the window of a human's task awaits, in its name.
|
||||
AWAITS = "a human's task"
|
||||
|
||||
|
||||
def holds_up(key: str, issues: list[EpicIssue]) -> list[str]:
|
||||
"""The keys of the open issues that the human's task called key holds up; none where it is no such task, or is closed."""
|
||||
if not any(chunk.human and chunk.issue == key for chunk in scheduler.chunks(issues)[0]):
|
||||
return []
|
||||
return scheduler.held_up(issues)[key]
|
||||
|
||||
|
||||
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)}. It goes on once you close {task.key} in Jira."
|
||||
|
||||
|
||||
def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, poll: int, effects: Effects) -> None:
|
||||
"""Waits in window for the human to close the human's task `task` of the epic called epic, and returns once it holds up no issue. A read of the epic that fails is said once and tried again."""
|
||||
told, said = False, None
|
||||
while True:
|
||||
issues = store.read()
|
||||
if isinstance(issues, Failure):
|
||||
if issues.reason != said:
|
||||
say(f"cannot read the epic, so cannot tell whether {task.key} is closed; trying again every {poll} seconds: {issues.reason}", effects, stdout=True)
|
||||
said = issues.reason
|
||||
elif not (held := holds_up(task.key, issues)):
|
||||
return
|
||||
elif not told:
|
||||
tell(message(task, epic, held), effects)
|
||||
tmux.park(window, AWAITS, effects.tmux)
|
||||
told = True
|
||||
effects.sleep(poll)
|
||||
+13
-8
@@ -9,7 +9,7 @@ import sys
|
||||
import typing
|
||||
|
||||
from loop_claude.loop.chunk_start import archived_route, routed
|
||||
from do_epic import chunk_prompt, findings, finish, gates, parked, scheduler
|
||||
from do_epic import chunk_prompt, findings, finish, gates, human_tasks, parked, scheduler
|
||||
from do_epic.repo_pick import ClaudeWork, HumanTask, recorded, Repo
|
||||
from loop_claude.loop.close import closed_cycle
|
||||
from loop_claude.project.records import CONSEQUENCE, read_records
|
||||
@@ -46,6 +46,7 @@ HELP = f"""usage: do-epic <EPIC-KEY> [--status]
|
||||
|
||||
Runs the chunks of one Jira epic, such as ABC-12, each in its own window of the tmux session epic-<EPIC-KEY>.
|
||||
An open issue of the epic runs as a chunk once it has a label and no issue blocks it.
|
||||
A `do-epic-human` issue that blocks another gets a window too: it DMs you once and waits, with no running slot, until you close the issue in Jira.
|
||||
The label names the issue's repo, or says the work changes no repo.
|
||||
As many run at once as the epic's description allows with a line such as `**Max parallel chunks:** 2`, one where it has none.
|
||||
A repo takes as many chunks as its `parallel-chunks`, and none while loop-claude runs chunks in it.
|
||||
@@ -230,7 +231,14 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
pane = epic.env.get("TMUX_PANE")
|
||||
if not pane:
|
||||
return Stop(1, f"{scheduler.CHUNK_FLAG} is how do-epic starts itself in a tmux window; run do-epic <EPIC-KEY>")
|
||||
place = chunk_root(key, epic)
|
||||
# None for the epic's finishing, which is no issue.
|
||||
issue = None if key == epic.key else issue_read(key, epic)
|
||||
if isinstance(issue, Stop):
|
||||
return issue
|
||||
if issue and isinstance(recorded(issue), HumanTask):
|
||||
human_tasks.awaited(issue, epic.key, epic.store, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.effects)
|
||||
return handed_on(key, epic)
|
||||
place = chunk_root(key, issue, epic)
|
||||
if isinstance(place, Stop):
|
||||
return place
|
||||
root, repo = place
|
||||
@@ -331,11 +339,8 @@ def issue_read(key: str, epic: EpicRun) -> EpicIssue | Stop:
|
||||
return found[0] if found else Stop(1, f"{key} is no issue of the epic {epic.key}")
|
||||
|
||||
|
||||
def chunk_root(key: str, epic: EpicRun) -> tuple[str, str | None] | Stop:
|
||||
"""The folder the chunk called key works in, and the name of the repo whose checkout it is: None for the epic's folder, which holds work without a repo, as the epic's finishing is. The chunk keeps both to its end, whatever its issue's labels become. The stop where the labels make the issue no chunk."""
|
||||
issue = None if key == epic.key else issue_read(key, epic)
|
||||
if isinstance(issue, Stop):
|
||||
return issue
|
||||
def chunk_root(key: str, issue: EpicIssue | None, epic: EpicRun) -> tuple[str, str | None] | Stop:
|
||||
"""The folder the chunk called key works in, and the name of the repo whose checkout it is: None for the epic's folder, which holds work without a repo, as the epic's finishing is, and its issue is None. The chunk keeps both to its end, whatever its issue's labels become. The stop where the labels make the issue no chunk."""
|
||||
pick = recorded(issue) if issue else ClaudeWork()
|
||||
if isinstance(pick, Failure):
|
||||
return Stop(1, pick.reason)
|
||||
@@ -344,7 +349,7 @@ def chunk_root(key: str, epic: EpicRun) -> tuple[str, str | None] | Stop:
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
return str(folder), None
|
||||
if not isinstance(pick, Repo):
|
||||
return Stop(1, f"{key} is no chunk: {'it is a human\'s task' if isinstance(pick, HumanTask) else 'no label names its repo'}")
|
||||
return Stop(1, f"{key} is no chunk: no label names its repo")
|
||||
found = locate(pick.name, [], epic.config, epic.paths.home, epic.effects.git)
|
||||
return Stop(1, found.reason) if isinstance(found, Failure) else (str(real(found.checkout)), pick.name)
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ from agent_cycle import tmux
|
||||
|
||||
# Under the home folder, a folder per epic key holds the epic's LOCK. A chunk without a repo works there.
|
||||
STATE = ".local/state/do-epic"
|
||||
# Why a human's task with a live window waits, as the epic's status says.
|
||||
HUMAN_WAIT = "it is a human's task; do-epic polls until its issue closes"
|
||||
# The flag that tells the do-epic in a window its chunk, as `--chunk ABC-34 ABC-12`. Nobody types it, so no panel picked it.
|
||||
CHUNK_FLAG = "--chunk"
|
||||
|
||||
@@ -29,6 +31,8 @@ class Chunk:
|
||||
issue: str
|
||||
# The name of the repo it changes; None for work without a repo.
|
||||
repo: str | None
|
||||
# Whether it is a human's task that holds up another open issue: its window only waits for the human to close the issue (`human_tasks`), and takes no running slot.
|
||||
human: bool = False
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -76,22 +80,41 @@ class Epic:
|
||||
return self.home / STATE / self.key
|
||||
|
||||
|
||||
def chunks(issues: list[EpicIssue]) -> tuple[list[Chunk], list[Waits]]:
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. An item split by repo is worked through its sub-tasks, and what blocks it blocks them. A blocker outside the epic blocks until the human removes the link, since its state is unknown."""
|
||||
def open_blockers(issue: EpicIssue, by_key: dict[str, EpicIssue]) -> list[str]:
|
||||
"""The keys of the issues that block issue, or its parent, that are not done. A blocker outside the epic counts, since its state is unknown."""
|
||||
parent = by_key.get(issue.parent)
|
||||
return [key for key in (*issue.blockers, *(parent.blockers if parent else ())) if key not in by_key or not by_key[key].done]
|
||||
|
||||
|
||||
def held_up(issues: list[EpicIssue]) -> dict[str, list[str]]:
|
||||
"""For each issue that blocks an open issue to work as a chunk, the keys of the open issues it blocks, in the tracker's rank order."""
|
||||
by_key = {issue.key: issue for issue in issues}
|
||||
held: dict[str, list[str]] = {}
|
||||
for issue in issues:
|
||||
if not issue.done and SPLIT_LABEL not in issue.labels:
|
||||
for key in open_blockers(issue, by_key):
|
||||
held.setdefault(key, []).append(issue.key)
|
||||
return held
|
||||
|
||||
|
||||
def chunks(issues: list[EpicIssue]) -> tuple[list[Chunk], list[Waits]]:
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. An item split by repo is worked through its sub-tasks, and what blocks it blocks them. A blocker outside the epic blocks until the human removes the link, since its state is unknown. A human's task is a chunk only while it holds up another issue and nothing holds it up: its window waits for the human."""
|
||||
by_key = {issue.key: issue for issue in issues}
|
||||
holding = held_up(issues)
|
||||
found: list[Chunk] = []
|
||||
waits: list[Waits] = []
|
||||
for issue in issues:
|
||||
if issue.done or SPLIT_LABEL in issue.labels:
|
||||
continue
|
||||
pick = recorded(issue)
|
||||
parent = by_key.get(issue.parent)
|
||||
blocking = [key for key in (*issue.blockers, *(parent.blockers if parent else ())) if key not in by_key or not by_key[key].done]
|
||||
blocking = open_blockers(issue, by_key)
|
||||
outside = [key for key in blocking if key not in by_key]
|
||||
if isinstance(pick, Failure):
|
||||
waits.append(Waits(issue.key, pick.reason))
|
||||
elif pick is None:
|
||||
waits.append(Waits(issue.key, "no label names its repo"))
|
||||
elif isinstance(pick, HumanTask) and not blocking and issue.key in holding:
|
||||
found.append(Chunk(issue.key, None, human=True))
|
||||
elif isinstance(pick, HumanTask):
|
||||
waits.append(Waits(issue.key, "it is a human's task"))
|
||||
elif blocking:
|
||||
@@ -131,11 +154,14 @@ def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str
|
||||
for chunk in found:
|
||||
if chunk.issue in running or chunk.issue == own:
|
||||
continue
|
||||
if chunk.issue in parked and chunk.issue in live:
|
||||
slot = chunk.issue not in parked and not chunk.human
|
||||
if chunk.human and chunk.issue in live:
|
||||
waits.append(Waits(chunk.issue, HUMAN_WAIT))
|
||||
elif chunk.issue in parked and chunk.issue in live:
|
||||
waits.append(Waits(chunk.issue, parked[chunk.issue].waits(live[chunk.issue].awaits)))
|
||||
elif own and (chunk.issue in stopped or chunk.issue in parked):
|
||||
waits.append(Waits(chunk.issue, f"its window stopped; run `do-epic {epic.key}` to start it again"))
|
||||
elif chunk.issue not in parked and len(running) + taken >= epic.cap:
|
||||
elif slot and len(running) + taken >= epic.cap:
|
||||
waits.append(Waits(chunk.issue, f"the epic runs as many chunks as its `{CAP}` line allows: {epic.cap}"))
|
||||
else:
|
||||
now = start_chunk(epic, chunk if chunk.issue not in parked else Chunk(chunk.issue, None), own, windows, run)
|
||||
@@ -146,7 +172,7 @@ def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str
|
||||
else:
|
||||
windows = now
|
||||
started.append(chunk.issue)
|
||||
taken += chunk.issue not in parked
|
||||
taken += slot
|
||||
except OSError as failure:
|
||||
return Failure(f"cannot lock {failure.filename or epic.folder / LOCK}: {failure.strerror}")
|
||||
# The epic's finishing is no issue: its wait is listed after every issue's.
|
||||
@@ -212,6 +238,8 @@ def status(key: str, home: pathlib.Path, issues: list[EpicIssue], run: tmux.Tmux
|
||||
for chunk in found:
|
||||
if chunk.issue in parked:
|
||||
reasons[chunk.issue] = parked[chunk.issue].waits(live[chunk.issue].awaits) if chunk.issue in live else f"{parked[chunk.issue].waits('')}, and its window stopped; {again}"
|
||||
elif chunk.human and chunk.issue in live:
|
||||
reasons[chunk.issue] = HUMAN_WAIT
|
||||
elif chunk.issue not in live:
|
||||
reasons[chunk.issue] = f"its window stopped; {again}" if chunk.issue in {window.name for window in windows} else f"it has not started; `do-epic {key}` starts it once the epic and its repo have room"
|
||||
return [f"{issue.key} waits: {reasons[issue.key]}" if issue.key in reasons else f"{issue.key} runs" for issue in issues if issue.key in reasons or issue.key in live]
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
import dataclasses
|
||||
import pathlib
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from do_epic.backend.fake import MemoryEpic
|
||||
from do_epic.epic_record import EpicRecord
|
||||
from do_epic.test_main import Description, DoEpicTest, MODELS, UNREAD
|
||||
from do_epic.test_scheduler import issue
|
||||
from failure import Failure
|
||||
from loop_claude.test_loop_claude import FakeEffects
|
||||
|
||||
# The window of ABC-19, a human's task that blocks ABC-21.
|
||||
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[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]
|
||||
|
||||
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."""
|
||||
slept: list[int] = []
|
||||
|
||||
def sleep(seconds: int) -> None:
|
||||
slept.append(seconds)
|
||||
if len(slept) == closes_after:
|
||||
self.epic.change("ABC-19", done=True, status="Done")
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign]
|
||||
self.slept = slept
|
||||
return self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
|
||||
def test_dms_the_human_once_parks_its_window_and_polls_until_the_issue_closes_then_starts_the_next(self) -> None:
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
code, out, err = self.awaited(fake, closes_after=3)
|
||||
self.assertEqual((code, err), (0, ""))
|
||||
self.assertEqual(self.slept, [60, 60, 60])
|
||||
self.assertEqual(fake.dms, ["do-epic ABC-12 awaits you: ABC-19, \"Order the test certificate\", blocks ABC-21. It goes on once you close ABC-19 in Jira."])
|
||||
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"], [])
|
||||
|
||||
def test_a_task_that_blocks_two_issues_names_both(self) -> None:
|
||||
self.epic.issues.append(issue("ABC-22", "do-epic-claude", blockers=("ABC-19",)))
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
self.awaited(fake, closes_after=1)
|
||||
self.assertIn("blocks ABC-21 and ABC-22. ", fake.dms[0])
|
||||
|
||||
def test_goes_on_where_the_task_blocks_nothing_any_more(self) -> None:
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=lambda seconds: self.epic.change("ABC-21", blockers=())) # type: ignore[method-assign]
|
||||
code, out, err = self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual((code, err), (0, ""))
|
||||
self.assertIn("the chunk finished; started ABC-21\n", out)
|
||||
|
||||
def test_says_once_why_a_read_failed_and_keeps_polling(self) -> None:
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
slept: list[int] = []
|
||||
|
||||
def sleep(seconds: int) -> None:
|
||||
slept.append(seconds)
|
||||
self.epic.fails = "Jira answered 503" if len(slept) < 3 else None
|
||||
if len(slept) == 4:
|
||||
self.epic.change("ABC-19", done=True)
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign]
|
||||
code, out, err = self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual((code, err), (0, ""))
|
||||
self.assertEqual(out.count("Jira answered 503"), 1, out)
|
||||
self.assertEqual(len(fake.dms), 1)
|
||||
|
||||
def test_a_task_that_holds_nothing_up_at_its_start_hands_on_without_a_dm(self) -> None:
|
||||
self.epic.change("ABC-21", blockers=())
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
code, out, err = self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual((code, err, fake.dms), (0, "", []))
|
||||
self.assertIn("the chunk finished; started ABC-21\n", out)
|
||||
|
||||
def test_the_status_says_that_the_task_is_awaited(self) -> None:
|
||||
fake = FakeEffects(windows="ABC-19 awaits a human's task\t0\t@9\n")
|
||||
code, out, err = self.run_main(["ABC-12", "--status"], fake)
|
||||
self.assertEqual((code, err), (0, ""))
|
||||
self.assertEqual(out.replace("<1790000000> ", "").splitlines(), ["ABC-19 waits: it is a human's task; do-epic polls until its issue closes", "ABC-21 waits: ABC-19 blocks it"])
|
||||
|
||||
def test_the_epic_starts_a_window_for_the_task_and_none_for_the_issue_it_blocks(self) -> None:
|
||||
fake = FakeEffects(windows="")
|
||||
code, out, err = self.run_main(["ABC-12"], fake, {"TMUX_PANE": "%1"})
|
||||
self.assertEqual((code, err), (0, ""))
|
||||
self.assertIn("started ABC-19 in the tmux session epic-ABC-12\n", out)
|
||||
self.assertIn("ABC-21 waits: ABC-19 blocks it\n", out)
|
||||
self.assertEqual(fake.dms, [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -143,7 +143,7 @@ class ACycleOfAChunkWithoutARepo(DoEpicTest):
|
||||
assert not isinstance(config, Failure)
|
||||
store, record = self.backend(config, "ABC-12")
|
||||
epic = main.EpicRun("ABC-12", config, store, record, paths, env or {}, pathlib.Path("/b/do-epic"), fake.effects())
|
||||
place = main.chunk_root("ABC-21", epic)
|
||||
place = main.chunk_root("ABC-21", self.issues[1], epic)
|
||||
assert isinstance(place, tuple)
|
||||
root, repo = place
|
||||
loop = Loop(root=root, session=main.session_named("A ABC-12 do-epic ABC-21", paths.claude_code_transcripts), window=tmux.Window("epic-ABC-12", "ABC-21", "%1"), paths=paths, env=env or {}, launcher=pathlib.Path("/b/do-epic"), effects=fake.effects())
|
||||
@@ -380,15 +380,13 @@ class AChunksRun(DoEpicTest):
|
||||
self.assertIn("decisions.md", err.strip().splitlines()[-1])
|
||||
self.assertIn("decisions.md", fake.dms[0])
|
||||
|
||||
def test_an_issue_that_is_a_humans_or_names_no_repo_is_no_chunk(self) -> None:
|
||||
for labels, why in ((("do-epic-human",), "it is a human's task"), ((), "no label names its repo")):
|
||||
with self.subTest(labels):
|
||||
self.issues = [issue("ABC-20", *labels)]
|
||||
fake = FakeEffects(git=UNREAD)
|
||||
code, _, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn(f"ABC-20 is no chunk: {why}\n", err)
|
||||
self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], [])
|
||||
def test_an_issue_that_names_no_repo_is_no_chunk(self) -> None:
|
||||
self.issues = [issue("ABC-20")]
|
||||
fake = FakeEffects(git=UNREAD)
|
||||
code, _, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("ABC-20 is no chunk: no label names its repo\n", err)
|
||||
self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], [])
|
||||
|
||||
def test_a_chunk_stays_in_its_repo_when_its_labels_change_under_it(self) -> None:
|
||||
self.repo_chunk()
|
||||
|
||||
@@ -68,6 +68,18 @@ class WhichIssuesAreChunks(unittest.TestCase):
|
||||
Waits("ABC-23", "ABC-20 and XYZ-1 block it; do-epic cannot see XYZ-1, outside the epic, finish: remove such a link in Jira once its issue is done"),
|
||||
]))
|
||||
|
||||
def test_a_human_task_that_blocks_an_open_issue_is_a_chunk_to_await_and_one_that_blocks_none_waits(self) -> None:
|
||||
found = chunks([issue("ABC-20", "do-epic-human"), issue("ABC-21", "repo:api", blockers=("ABC-20",)), issue("ABC-22", "do-epic-human")])
|
||||
self.assertEqual(found, ([Chunk("ABC-20", None, human=True)], [Waits("ABC-21", "ABC-20 blocks it"), Waits("ABC-22", "it is a human's task")]))
|
||||
|
||||
def test_a_human_task_is_awaited_while_it_blocks_a_sub_task_through_its_split_parent(self) -> None:
|
||||
found = chunks([issue("ABC-19", "do-epic-human"), issue("ABC-20", "split-by-repo", blockers=("ABC-19",)), issue("ABC-23", "repo:api", parent="ABC-20")])
|
||||
self.assertEqual(found, ([Chunk("ABC-19", None, human=True)], [Waits("ABC-23", "ABC-19 blocks it")]))
|
||||
|
||||
def test_a_human_task_that_is_blocked_itself_or_blocks_only_done_issues_waits(self) -> None:
|
||||
found = chunks([issue("ABC-19", "repo:api"), issue("ABC-20", "do-epic-human", blockers=("ABC-19",)), issue("ABC-21", "repo:api", blockers=("ABC-20",)), issue("ABC-22", "do-epic-human"), issue("ABC-23", "repo:api", done=True, blockers=("ABC-22",))])
|
||||
self.assertEqual(found, ([Chunk("ABC-19", "api")], [Waits("ABC-20", "it is a human's task"), Waits("ABC-21", "ABC-20 blocks it"), Waits("ABC-22", "it is a human's task")]))
|
||||
|
||||
def test_what_blocks_a_split_item_blocks_its_sub_tasks(self) -> None:
|
||||
found = chunks([issue("ABC-19", "repo:api"), issue("ABC-20", "split-by-repo", blockers=("ABC-19",)), issue("ABC-23", "repo:api", parent="ABC-20")])
|
||||
self.assertEqual(found, ([Chunk("ABC-19", "api")], [Waits("ABC-23", "ABC-19 blocks it")]))
|
||||
@@ -169,6 +181,17 @@ class StartingAnEpicsChunks(unittest.TestCase):
|
||||
self.assertEqual(run.windows[-1], ("epic-ABC-12", "ABC-20", False, str(self.home / ".local/state/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:
|
||||
run = Tmux()
|
||||
found = self.start(self.epic(1, api=1), [issue("ABC-19", "do-epic-human"), issue("ABC-20", "do-epic-claude"), issue("ABC-21", "repo:api", blockers=("ABC-19",))], run)
|
||||
self.assertEqual(found, Started(["ABC-19", "ABC-20"], [Waits("ABC-21", "ABC-19 blocks it")]))
|
||||
|
||||
def test_a_human_task_with_a_window_that_awaits_it_starts_no_second_window(self) -> None:
|
||||
run = Tmux(("epic-ABC-12", "ABC-19 awaits a human's task", False, ""))
|
||||
found = self.start(self.epic(1, api=1), [issue("ABC-19", "do-epic-human"), issue("ABC-21", "repo:api", blockers=("ABC-19",))], run)
|
||||
self.assertEqual(found, Started([], [Waits("ABC-19", "it is a human's task; do-epic polls until its issue closes"), Waits("ABC-21", "ABC-19 blocks it")]))
|
||||
self.assertEqual(run.started(), [])
|
||||
|
||||
def test_a_parked_chunk_that_starts_again_leaves_the_epics_cap_to_the_others(self) -> None:
|
||||
self.parked("ABC-20")
|
||||
found = self.start(self.epic(1, api=2), [issue("ABC-20", "repo:api"), issue("ABC-21", "repo:api")], Tmux())
|
||||
|
||||
Reference in New Issue
Block a user