Answer prose round 1: 0 🔴, 12 🟡 (0 misread); keep a {} line as an entry, point handed_on and parked_through at the docstrings that hold their rules, split news_after's two kinds of news, say what each parameter is, reword item 517's way out, and report a .tar left behind as its own failure

This commit is contained in:
2026-11-23 02:30:59 +01:00
parent ba50eacafe
commit 83194a11a5
14 changed files with 36 additions and 30 deletions
+4 -4
View File
@@ -353,7 +353,7 @@ class Landed(enum.Enum):
class How(enum.Enum):
"""How a finished chunk's issue moves, where it moves to no status the config names."""
"""How a finished chunk's issue moves when it doesn't move to a status the config names."""
# do-epic neither moves nor awaits it.
LEFT = enum.auto()
# Nobody would move it, so the loop stops.
@@ -366,7 +366,7 @@ class How(enum.Enum):
@dataclasses.dataclass(frozen=True)
class ToStatus:
"""do-epic moves a finished chunk's issue to status, trying a failed move again by way of through, None where there is none."""
"""do-epic moves a finished chunk's issue to status. Where that move fails, it moves the issue to through first and tries again; through is None where the config names no open status."""
status: str
through: str | None
@@ -376,7 +376,7 @@ Move = How | ToStatus
def issue_move(landed: Landed, automated: bool, merged: str | None, opened: str | None, finishing: bool) -> Move:
"""The move of the issue of a finished chunk whose work landed as landed says. automated says the team's automation moves issues, merged and opened are the statuses `jira-pull-request-merged-status` and `jira-pull-request-open-status` name, each None where the config names none, and finishing says the chunk is the epic's finishing. The first row that fits:
"""The move of a finished chunk's issue. landed says where the chunk's work landed, automated says the team's automation moves issues, merged and opened are the statuses `jira-pull-request-merged-status` and `jira-pull-request-open-status` name, each None where the config names none, and finishing says the chunk is the epic's finishing. The first row that fits:
| The chunk | The automation moves issues | A merged status is named | Move |
|---|---|---|---|
@@ -400,7 +400,7 @@ def issue_move(landed: Landed, automated: bool, merged: str | None, opened: str
def handed_on(key: str, epic: EpicRun, landed: Landed = Landed.NOWHERE) -> Stop:
"""The stop of a do-epic whose chunk finished. It first moves the chunk's issue to done (the epic's finishing has none), and its parent too where the parent's sub-tasks now let it move (`parents_settled`), so that no finished chunk starts again and what they block may start, then starts each chunk that may start now. Where the team's automation moves issues, others move two kinds of issue. The automation moves the issue of a chunk whose work landed on the default branch, from its pull request: the stop waits for that move (`moved_by_automation`). The human moves their own task: the stop doesn't move or await anything. A chunk without a repo has no pull request, so its issue moves to done as ever, and so does a split item, once Jira counts each of its sub-tasks done. The automation doesn't see a pull request that merged into an epic's working branch: the stop moves that chunk's issue to the status `jira-pull-request-merged-status` names. Where none is named, it moves the issue to done, or stops where the automation moves issues, since then nobody would move it. do-epic's window closes as it exits."""
"""The stop of a do-epic whose chunk finished. It first moves the chunk's issue as `issue_move` says, and the issue's parent too where the parent's sub-tasks now let it move (`parents_settled`), so that no finished chunk starts again and what they block may start. Then it starts each chunk that may start now. Where the team's automation moves the issue, the stop waits for that move (`moved_by_automation`). do-epic's window closes as it exits."""
move = issue_move(landed, epic.config.automation_moves, epic.config.pull_merged_status, epic.config.pull_open_status, finishing=key == epic.key)
issues: list[EpicIssue] | Failure
match move:
+6 -2
View File
@@ -18,7 +18,7 @@ DRIVER_PARKED = f"{chunk_prompt.DRIVER} parked the chunk while"
def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finished: bool, based: str | None) -> str | Stop:
"""Keeps the chunk in loop's window parked. Its work is in the repo called repo. It stays parked for as long as its pull request waits on a gate, and returns once its worker has something to do: what to tell that worker, or empty where the chunk was never parked. told is the news its last cycle's worker got, None where the window just started, and finished says the judge ruled the chunk finished. based is the epic's working branch that `epic_based` recorded as the chunk's base when the window started, None where it recorded none. A window that just started parks the chunk only if its file says so: the forge isn't read for a chunk that starts afresh.
Where a person merges, a worker ends its run with the pull request open, so the judge may rule the chunk finished before it is. For such a finished chunk, a gate that cannot be read is read again until it can, and a pull request no longer open, in a worktree that still stands, is news the worker hasn't been told: the worker removes the worktree. A pull request that doesn't merge into its base is news after every cycle that leaves it so: the worker levels the branch.
Where a person merges, a worker ends its run with the pull request open, so the judge may rule the chunk finished before it is. For such a finished chunk, a gate that cannot be read is read again until it can (`Poll.first_gate`), and what the worker must still do is news (`news_after`).
A chunk parks in three steps: its file is written, its window is shown as parked, and the epic's next chunks start in the slot it frees. It resumes in the reverse order: `scheduler.resume` gives it a running slot, then its file is removed. So a window that ends in between finds the chunk parked when it starts again.
"""
@@ -54,7 +54,11 @@ def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finis
def news_after(entered: gates.Open | Failure | None, finished: bool, by_human: bool, told: str | None) -> str:
"""What to tell the worker of a chunk that isn't parked as its cycle ends, empty where there isn't anything. entered is what was read instead of a gate, None where the window just started. Only a chunk the judge ruled finished, whose pull request a person merges, has news: that its pull request doesn't merge into its base, after every cycle that leaves it so, or that its worktree stands though no pull request is open, unless told, the news its last worker got, says so already."""
"""What to tell the worker of a chunk that isn't parked as its cycle ends, empty where there isn't anything. entered is what was read instead of a gate, None where the window just started, and told is the news the last worker got.
Only a chunk the judge ruled finished, whose pull request a person merges, has news, of one of two kinds:
- its pull request doesn't merge into its base: news after every cycle that leaves it so, and the worker levels the branch;
- its worktree stands though no pull request is open: news once, unless told says so already, and the worker removes the worktree."""
if not (finished and by_human):
return ""
if isinstance(entered, gates.Unmergeable):
+2 -2
View File
@@ -19,12 +19,12 @@ class TheNewsOfAChunkThatIsNotParked(unittest.TestCase):
def test_a_window_that_just_started_has_no_news(self) -> None:
self.assertEqual(news_after(None, finished=True, by_human=True, told=None), "")
def test_a_gate_that_cannot_be_read_or_a_pull_request_with_news_of_its_own_adds_none(self) -> None:
def test_a_gate_that_cannot_be_read_or_one_that_lets_the_chunk_go_on_does_not_add_any_news(self) -> None:
for entered in (Failure("no network"), Open("a reviewer requested changes")):
with self.subTest(entered):
self.assertEqual(news_after(entered, finished=True, by_human=True, told=""), "")
def test_an_unfinished_chunk_or_one_no_person_merges_has_no_news(self) -> None:
def test_an_unfinished_chunk_or_one_that_merges_without_a_person_has_no_news(self) -> None:
for entered in (UNOPENED, UNMERGEABLE):
for finished, by_human in ((False, True), (True, False), (False, False)):
with self.subTest(entered=entered, finished=finished, by_human=by_human):