Merge remote-tracking branch 'origin/main' into item-460
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- do-epic reads two new settings from a project's config: `jira-unblocking-statuses` names the statuses at which an issue unblocks the issues it blocks, and `jira-automation-moves-issues` leaves the move out of "In Progress" to the team's own automation.
|
||||
- The prose standard asks that a sentence about several named things holds for each of them.
|
||||
- `do-epic` resumes a chunk parked on `your merge` when its pull request no longer merges into its base, so the worker runs `chunk-pr merge` again to level the branch; a finished chunk in that state stays open until its pull request merges.
|
||||
- `larv-review prepare-scoring` takes the scoring run's project values from the checkout's `skills/comprehension-panel/seat-prompts.md` where the working-rules file holds no "Scoring run" section, not only where that file is missing.
|
||||
|
||||
@@ -155,6 +155,9 @@ The last line prints each setting's path once the config is complete.
|
||||
`do-epic` keeps its settings per machine, not per project, in `~/.claude-projects/do-epic/`, two files for every epic:
|
||||
|
||||
- `config.toml` sets `jira-url`, the site, such as `https://acme.atlassian.net`; `env-file`, the file holding `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN`, a path that starts with `/` or `~/`, outside the clone folder and every folder of `~/.claude-projects`; and `repoless-model`, the model that works an item with no repo. It may also set `clone-folder`, where a missing repo is cloned, `~/code` if left out; `language`, the language of Jira text, English if left out; and `jira-finish-transition` with `jira-finish-status`, which name the workflow transition that moves a finished chunk's issue, and closes a finished epic, and the status it leads to, such as `"Mark as done"` and `"Done"`. Set both or neither: without them do-epic moves no issue to done and closes no epic, and a chunk that finishes stops with that reason.
|
||||
- `config.toml` fits do-epic to a team whose own automation moves issues, such as a CI job that moves an issue when its pull request merges. Two settings do:
|
||||
- `jira-unblocking-statuses` lists the statuses at which an issue's work has landed though Jira doesn't count it done yet, such as `["Release Ready"]`, in upper or lower case. An issue in one of them takes no chunk and no longer blocks the issues it blocks, and `--status` names the statuses beside each blocker. A status Jira counts as done always does both. The release reviews, which are the epic's last chunk, still wait until Jira counts every issue done: run `do-epic <EPIC-KEY>` then, to start them.
|
||||
- `jira-automation-moves-issues = true` keeps do-epic from moving the issue of a finished chunk in a repo: the automation moves it, and do-epic waits for that move before it starts what the issue blocks. An issue without a repo has no pull request, so do-epic still moves it, with `jira-finish-transition`. The setting needs `jira-unblocking-statuses`, which names the status the automation gives an issue whose pull request merged.
|
||||
- `config.toml` may end with a `[label-repos]` table, for a team that already labels its issues by repo. Give it one line for each such label: the label, then the repo's name, such as `twu-4 = "tenant-web-ui-4"`. do-epic reads such a label as it reads its own `repo:<name>`. Where the label is the repo's name, map the name to itself, as in `core-4 = "core-4"`. Write every other setting above the table.
|
||||
- `repo-rule.md` is prose that says how to tell an item's repo, such as "a label that equals a repo's name names that repo". It may not be blank. `do-epic <EPIC-KEY>` uses it to pick where each open issue without such a label is worked, and records the pick as a label: `repo:<name>` for its repo, `do-epic-claude` for work of Claude's that changes no repo, and `do-epic-human` for a task of yours. Where the rule leaves an issue unclear, do-epic asks you on the terminal. Answer with the label, or with Enter alone to leave the issue waiting. Change a pick by editing the label in Jira.
|
||||
|
||||
|
||||
+25
-3
@@ -17,6 +17,8 @@ One pair per machine, the same for every epic (docs/decisions.md → `do-epic: d
|
||||
- `clone-folder` is the folder a missing repo is cloned into: a path that starts with / or ~/. `~/code` where left out.
|
||||
- `language` is the default language of Jira text, by its English name. English where left out.
|
||||
- `jira-finish-transition` and `jira-finish-status` name the workflow transition that moves a finished chunk's issue and closes a finished epic, such as "Mark as done", and the status it leads to, such as "Done". A project's config names a plan item's the same way. Set both or neither; without them do-epic moves no issue to done and closes no epic.
|
||||
- `jira-unblocking-statuses` lists the statuses at which an issue's work has landed though Jira doesn't count it done yet, such as `["Release Ready"]`, in upper or lower case. An issue in one of them takes no chunk and no longer blocks the issues it blocks. A status Jira counts as done always does both, listed or not.
|
||||
- `jira-automation-moves-issues = true` says the team's own automation moves an issue when its pull request merges. do-epic then moves only the issue of a chunk without a repo, which has no pull request, and waits for the automation to move each other. It needs `jira-unblocking-statuses`, which then names the status the automation gives an issue whose pull request merged. false where left out.
|
||||
- `[label-repos]` has one line for each label of the team's own that names a repo: the label, then that repo's name, such as `twu-4 = "tenant-web-ui-4"`. do-epic reads such a label as it reads its own `repo:<name>`. A team whose label is the repo's name maps the name to itself.
|
||||
- `repo-rule.md` is prose that says how to tell an item's repo, and mustn't be blank."""
|
||||
import dataclasses
|
||||
@@ -24,7 +26,7 @@ import pathlib
|
||||
import re
|
||||
import types
|
||||
|
||||
from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, Finish, finish_faults, finish_of, JIRA_FINISH, LANGUAGE, language_fault, lies_in, parsed, PROJECTS, SITE
|
||||
from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, Finish, finish_faults, finish_of, JIRA_FINISH, LANGUAGE, language_fault, lies_in, name_of, parsed, PROJECTS, SITE
|
||||
from failure import Failure
|
||||
from do_epic.backend.protocol import LABEL
|
||||
from do_epic.repo_pick import LabelRepos, of_label, REPO_NAME, REVIEW_LABEL
|
||||
@@ -40,7 +42,10 @@ CLONE_FOLDER = "clone-folder"
|
||||
SETTINGS = (JIRA_URL, ENV_FILE, REPOLESS_MODEL)
|
||||
# Three readers, seated as those who write and read this config, picked `label-repos` from four candidates, over `repo-aliases`, `repo-labels` and `team-labels`, 2-1. All three readers would misread `repo-labels` as mapping a repo to its label.
|
||||
LABEL_REPOS = "label-repos"
|
||||
OPTIONAL = (CLONE_FOLDER, LANGUAGE, *JIRA_FINISH, LABEL_REPOS)
|
||||
# Three readers, seated as those who write and read this config, picked `jira-unblocking-statuses` from four candidates, 3-0, and `jira-automation-moves-issues` 2-1. `jira-unblock-statuses` reads as statuses do-epic moves an issue to, and `jira-finish-issues = false` as closing no epic either.
|
||||
UNBLOCKING_STATUSES = "jira-unblocking-statuses"
|
||||
AUTOMATION_MOVES = "jira-automation-moves-issues"
|
||||
OPTIONAL = (CLONE_FOLDER, LANGUAGE, *JIRA_FINISH, UNBLOCKING_STATUSES, AUTOMATION_MOVES, LABEL_REPOS)
|
||||
LISTED = f"The settings are {', '.join(SETTINGS)}, and optionally {listed(OPTIONAL, 'and')}."
|
||||
|
||||
|
||||
@@ -58,6 +63,9 @@ class DoEpicConfig:
|
||||
finish: Finish | None = None
|
||||
# The LABEL_REPOS table; empty where the config has none.
|
||||
label_repos: LabelRepos = types.MappingProxyType({})
|
||||
# The UNBLOCKING_STATUSES list; empty where the config has none.
|
||||
unblocking: tuple[str, ...] = ()
|
||||
automation_moves: bool = False
|
||||
|
||||
|
||||
def label_repo_faults(table: object) -> list[str]:
|
||||
@@ -72,6 +80,17 @@ def label_repo_faults(table: object) -> list[str]:
|
||||
]
|
||||
|
||||
|
||||
def workflow_faults(values: dict[str, object]) -> list[str]:
|
||||
"""What is wrong with the UNBLOCKING_STATUSES list and the AUTOMATION_MOVES switch in values."""
|
||||
statuses, moves = values.get(UNBLOCKING_STATUSES, ["Done"]), values.get(AUTOMATION_MOVES, False)
|
||||
return [
|
||||
*([f"`{UNBLOCKING_STATUSES}` is {statuses!r}, not a list of the status names Jira shows, such as [\"Release Ready\"]"] if not (isinstance(statuses, list) and statuses and all(name_of(status) for status in statuses)) else []),
|
||||
*([f"`{AUTOMATION_MOVES}` is {moves!r}, not true or false"] if not isinstance(moves, bool) else []),
|
||||
# With no status listed, an issue whose pull request merged would read as open, and its chunk would start again.
|
||||
*([f"`{AUTOMATION_MOVES}` is set, so `{UNBLOCKING_STATUSES}` must name the status the automation gives an issue whose pull request merged"] if moves is True and UNBLOCKING_STATUSES not in values else []),
|
||||
]
|
||||
|
||||
|
||||
def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfig | Failure:
|
||||
"""The settings and the repo rule under home; a Failure naming the file it can't read, else each missing or misspelt setting it finds, so that do-epic refuses to start."""
|
||||
folder = home / PROJECTS / DO_EPIC
|
||||
@@ -102,6 +121,7 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
|
||||
*([f"`{LANGUAGE}` is {language!r}, {fault}"] if LANGUAGE in values and (fault := language_fault(language)) else []),
|
||||
*([f"`{REPOLESS_MODEL}` is {model!r}, not a model on the routing ladder: {', '.join(models)}"] if REPOLESS_MODEL in values and model not in models else []),
|
||||
*finish_faults(values),
|
||||
*workflow_faults(values),
|
||||
*label_repo_faults(values.get(LABEL_REPOS, {})),
|
||||
*([rule.reason] if isinstance(rule, Failure) else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []),
|
||||
]
|
||||
@@ -111,4 +131,6 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
|
||||
assert clone_folder and env_file and isinstance(url, str) and isinstance(model, str) and isinstance(language, str) and isinstance(rule, str)
|
||||
labels = values.get(LABEL_REPOS, {})
|
||||
assert isinstance(labels, dict)
|
||||
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule, finish_of(values), types.MappingProxyType(labels))
|
||||
statuses = values.get(UNBLOCKING_STATUSES, [])
|
||||
assert isinstance(statuses, list)
|
||||
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule, finish_of(values), types.MappingProxyType(labels), tuple(statuses), values.get(AUTOMATION_MOVES) is True)
|
||||
|
||||
@@ -16,11 +16,11 @@ from agent_cycle import tmux
|
||||
AWAITS = "a human's task"
|
||||
|
||||
|
||||
def holds_up(key: str, issues: list[EpicIssue], team: LabelRepos) -> list[str]:
|
||||
def holds_up(key: str, issues: list[EpicIssue], team: LabelRepos, unblocking: tuple[str, ...]) -> list[str]:
|
||||
"""The keys of the open issues that the human's task called key holds up; none where it is no such task, is closed, or an issue blocks it."""
|
||||
if not any(chunk.human and chunk.issue == key for chunk in scheduler.chunks(issues, team)[0]):
|
||||
if not any(chunk.human and chunk.issue == key for chunk in scheduler.chunks(issues, team, unblocking)[0]):
|
||||
return []
|
||||
return scheduler.held_up(issues)[key]
|
||||
return scheduler.held_up(issues, unblocking)[key]
|
||||
|
||||
|
||||
def message(task: EpicIssue, epic: str, held: list[str]) -> str:
|
||||
@@ -37,7 +37,7 @@ def notifier_checkout(issues: list[EpicIssue], team: LabelRepos, home: pathlib.P
|
||||
return None
|
||||
|
||||
|
||||
def awaited(task: EpicIssue, epic: str, store: EpicStore, team: LabelRepos, window: tmux.Window, poll: int, home: pathlib.Path, effects: Effects) -> None:
|
||||
def awaited(task: EpicIssue, epic: str, store: EpicStore, team: LabelRepos, unblocking: tuple[str, ...], window: tmux.Window, poll: int, home: pathlib.Path, 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 no longer holds up any issue. A read of the epic that fails is said once and tried again."""
|
||||
tmux.park(window, AWAITS, effects.tmux)
|
||||
told, said = False, None
|
||||
@@ -47,7 +47,7 @@ def awaited(task: EpicIssue, epic: str, store: EpicStore, team: LabelRepos, wind
|
||||
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, team)):
|
||||
elif not (held := holds_up(task.key, issues, team, unblocking)):
|
||||
return
|
||||
elif not told:
|
||||
text = message(task, epic, held)
|
||||
|
||||
+41
-14
@@ -27,6 +27,7 @@ from agent_cycle.verdicts import Finished, TakenIn
|
||||
from atlassian.jira import ISSUE_KEY
|
||||
from do_epic.backend.jira import JiraEpic
|
||||
from claude_code.reply import Limited
|
||||
from text_files.markdown_text import listed
|
||||
from do_epic.repos import locate
|
||||
from chunk_driver.this_loop import Loop
|
||||
from chunk_driver.project.model_choice import Models, overridden
|
||||
@@ -142,7 +143,7 @@ def run(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher:
|
||||
def status_printed(epic: EpicRun) -> Stop:
|
||||
"""What `do-epic <EPIC-KEY> --status` does: prints a line per open issue, and doesn't start anything."""
|
||||
issues = epic.store.read()
|
||||
lines = issues if isinstance(issues, Failure) else status.lines(epic.key, epic.paths.home, issues, epic.config.label_repos, epic.effects.tmux)
|
||||
lines = issues if isinstance(issues, Failure) else status.lines(epic.key, epic.paths.home, issues, epic.config.label_repos, epic.config.unblocking, epic.effects.tmux)
|
||||
return Stop(1, lines.reason) if isinstance(lines, Failure) else Stop(0, "\n".join(lines) or f"the epic {epic.key} has no open issue")
|
||||
|
||||
|
||||
@@ -211,7 +212,7 @@ def scheduled_epic(epic: EpicRun) -> scheduler.Epic | Failure:
|
||||
seen.append(found.checkout)
|
||||
return real(found.checkout), found.config.parallel_chunks
|
||||
|
||||
return scheduler.Epic(epic.key, cap, located, epic.paths.home, epic.launcher, epic.env, epic.config.label_repos)
|
||||
return scheduler.Epic(epic.key, cap, located, epic.paths.home, epic.launcher, epic.env, epic.config.label_repos, epic.config.unblocking)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -248,8 +249,8 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
if isinstance(issue, Stop):
|
||||
return issue
|
||||
if issue and isinstance(recorded(issue, epic.config.label_repos), HumanTask):
|
||||
human_tasks.awaited(issue, epic.key, epic.store, epic.config.label_repos, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.paths.home, epic.effects)
|
||||
return handed_on(key, epic)
|
||||
human_tasks.awaited(issue, epic.key, epic.store, epic.config.label_repos, epic.config.unblocking, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.paths.home, epic.effects)
|
||||
return handed_on(key, epic, humans=True)
|
||||
place = chunk_root(key, issue, epic)
|
||||
if isinstance(place, Stop):
|
||||
return place
|
||||
@@ -281,7 +282,7 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
news = parked_through(repo, loop, epic, told=news, finished=isinstance(concluded.verdict, Finished)) if repo is not None else ""
|
||||
# A chunk that was parked has work again, whatever the judge ruled before its pull request passed the gate.
|
||||
if isinstance(concluded.verdict, Finished) and news == "":
|
||||
return handed_on(key, epic)
|
||||
return handed_on(key, epic, repo is not None)
|
||||
|
||||
|
||||
def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finished: bool) -> str | Stop:
|
||||
@@ -427,17 +428,23 @@ def folder_made(root: str) -> Failure | None:
|
||||
return None
|
||||
|
||||
|
||||
def handed_on(key: str, epic: EpicRun) -> 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 split item too where that was the last of the item's sub-tasks, so that no finished chunk starts again and what they block may start, then starts each chunk that may start now. Its window closes as it exits."""
|
||||
# The epic's finishing has no issue to move: the epic is closed by `--close-epic`.
|
||||
moved = None if key == epic.key else epic.store.finish_issue(key)
|
||||
if isinstance(moved, Failure):
|
||||
return Stop(1, f"the chunk finished, but its issue could not move to done: {moved.reason}; once it is done in Jira, run `do-epic {epic.key}` to start the chunks it blocks")
|
||||
issues = epic.store.read()
|
||||
def handed_on(key: str, epic: EpicRun, in_repo: bool = False, humans: bool = False) -> 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 split item too where that was the last of the item's sub-tasks, 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 in a repo, which in_repo marks, from its pull request: the stop waits for that move (`moved_by_automation`). The human moves their own task, which humans marks: the stop moves and awaits nothing. 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. Its window closes as it exits."""
|
||||
automated = epic.config.automation_moves
|
||||
# The epic's finishing has no issue to move: the epic is closed by `--close-epic`. Nor has a human's task where the human moves it: its window waited until it holds up no issue.
|
||||
if key == epic.key or (humans and automated):
|
||||
issues: list[EpicIssue] | Failure = epic.store.read()
|
||||
elif in_repo and automated:
|
||||
issues = moved_by_automation(key, epic)
|
||||
else:
|
||||
moved = epic.store.finish_issue(key)
|
||||
if isinstance(moved, Failure):
|
||||
return Stop(1, f"the chunk finished, but its issue could not move to done: {moved.reason}; once it is done in Jira, run `do-epic {epic.key}` to start the chunks it blocks")
|
||||
issues = epic.store.read()
|
||||
# A search may not show the move yet, so the issue counts as done here whatever the read says.
|
||||
issues = issues if isinstance(issues, Failure) else [dataclasses.replace(each, done=True) if each.key == key else each for each in issues]
|
||||
if isinstance(issues, Failure):
|
||||
return Stop(1, f"the chunk finished, but the next could not start: {issues.reason}")
|
||||
# A search may not show the move yet, so the issue counts as done here whatever the read says.
|
||||
issues = [dataclasses.replace(each, done=True) if each.key == key else each for each in issues]
|
||||
closed = split_items_closed(epic, issues)
|
||||
if isinstance(closed, Stop):
|
||||
return closed
|
||||
@@ -448,6 +455,26 @@ def handed_on(key: str, epic: EpicRun) -> Stop:
|
||||
return Stop(0, "")
|
||||
|
||||
|
||||
def moved_by_automation(key: str, epic: EpicRun) -> list[EpicIssue]:
|
||||
"""The epic's issues once the issue called key no longer holds up another: read every POLL_SECONDS until the team's automation, or a person, has moved it. Until then a read would show it open, and its chunk would start again. A read that fails is made again."""
|
||||
told, unread = False, ""
|
||||
while True:
|
||||
issues = epic.store.read()
|
||||
if isinstance(issues, Failure):
|
||||
if issues.reason != unread:
|
||||
say(f"cannot read the epic, so cannot tell whether {key} has moved; trying again every {POLL_SECONDS} seconds: {issues.reason}", epic.effects, stdout=True)
|
||||
unread = issues.reason
|
||||
epic.effects.sleep(POLL_SECONDS)
|
||||
continue
|
||||
by_key = {each.key: each for each in issues}
|
||||
if key not in by_key or scheduler.settled(by_key[key], by_key, epic.config.unblocking):
|
||||
return issues
|
||||
if not told:
|
||||
say(f"{key} is {by_key[key].status}: it waits for the team's automation to move it to {listed(epic.config.unblocking, 'or')}; move it in Jira if the automation doesn't", epic.effects, stdout=True)
|
||||
told = True
|
||||
epic.effects.sleep(POLL_SECONDS)
|
||||
|
||||
|
||||
def split_items_closed(epic: EpicRun, issues: list[EpicIssue]) -> list[EpicIssue] | Stop:
|
||||
"""The issues, with each item split by repo whose sub-tasks are all done moved to done in the tracker and read as done; the stop where one cannot move. Its last sub-task to finish closes it, and one an earlier run left open closes with it."""
|
||||
for item in issues:
|
||||
|
||||
+34
-14
@@ -9,8 +9,9 @@ from do_epic.epic_record import CAP
|
||||
from chunk_driver.claims import CHUNK_FLAG, epic_chunks, HANDED, loop_chunks, project_lock, starting
|
||||
from do_epic.backend.protocol import EpicIssue
|
||||
from failure import Failure
|
||||
from do_epic.split import finished, is_split
|
||||
from do_epic.split import finished, is_split, SPLIT_LABEL
|
||||
from do_epic.repo_pick import HumanTask, LabelRepos, Pick, recorded, Repo
|
||||
from text_files.markdown_text import listed
|
||||
from project_config.settings import PARALLEL_CHUNKS
|
||||
from do_epic.parked import parked_chunks
|
||||
from chunk_pr.approval import PARKS
|
||||
@@ -73,43 +74,59 @@ class Epic:
|
||||
env: typing.Mapping[str, str]
|
||||
# The team's own labels for its repos.
|
||||
team: LabelRepos
|
||||
# The statuses `jira-unblocking-statuses` names; `settled` says what they do.
|
||||
unblocking: tuple[str, ...] = ()
|
||||
|
||||
@property
|
||||
def folder(self) -> pathlib.Path:
|
||||
return self.home / STATE / self.key
|
||||
|
||||
|
||||
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."""
|
||||
def unblocks(status: str, unblocking: tuple[str, ...]) -> bool:
|
||||
"""Whether status is one of the unblocking statuses, whatever its case, so a name typed in another case than Jira shows still matches."""
|
||||
return status.casefold() in {name.casefold() for name in unblocking}
|
||||
|
||||
|
||||
def settled(issue: EpicIssue, by_key: dict[str, EpicIssue], unblocking: tuple[str, ...]) -> bool:
|
||||
"""Whether the issue's work has landed, so that it takes no chunk and unblocks what it blocks: the tracker counts it done, or its status is one of unblocking, such as one the team's automation gives an issue whose pull request merged. An item marked SPLIT_LABEL has landed once each of its sub-tasks has, since nobody moves it before they are done."""
|
||||
tasks = [task for task in by_key.values() if task.parent == issue.key] if SPLIT_LABEL in issue.labels else []
|
||||
return issue.done or unblocks(issue.status, unblocking) or bool(tasks) and all(settled(task, by_key, unblocking) for task in tasks)
|
||||
|
||||
|
||||
def open_blockers(issue: EpicIssue, by_key: dict[str, EpicIssue], unblocking: tuple[str, ...] = ()) -> list[str]:
|
||||
"""The keys of the issues that block issue, or its parent, that are not settled. 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]
|
||||
return [key for key in (*issue.blockers, *(parent.blockers if parent else ())) if key not in by_key or not settled(by_key[key], by_key, unblocking)]
|
||||
|
||||
|
||||
def held_up(issues: list[EpicIssue]) -> dict[str, list[str]]:
|
||||
def held_up(issues: list[EpicIssue], unblocking: tuple[str, ...] = ()) -> dict[str, list[str]]:
|
||||
"""Each blocker's key, mapped to the keys of the open issues it holds up, in the tracker's rank order. A split item's blocker holds up the item's sub-tasks."""
|
||||
by_key = {issue.key: issue for issue in issues}
|
||||
held: dict[str, list[str]] = {}
|
||||
for issue in issues:
|
||||
if not issue.done and not is_split(issue, issues):
|
||||
for key in open_blockers(issue, by_key):
|
||||
if not settled(issue, by_key, unblocking) and not is_split(issue, issues):
|
||||
for key in open_blockers(issue, by_key, unblocking):
|
||||
held.setdefault(key, []).append(issue.key)
|
||||
return held
|
||||
|
||||
|
||||
def chunks(issues: list[EpicIssue], team: LabelRepos) -> tuple[list[Chunk], list[Waits]]:
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. A split item is worked through its sub-tasks, and what blocks it blocks them."""
|
||||
def chunks(issues: list[EpicIssue], team: LabelRepos, unblocking: tuple[str, ...] = ()) -> tuple[list[Chunk], list[Waits]]:
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. A split item is worked through its sub-tasks, and what blocks it blocks them. An issue in one of the unblocking statuses is worked already: it waits until Jira counts it done."""
|
||||
by_key = {issue.key: issue for issue in issues}
|
||||
holding = held_up(issues)
|
||||
holding = held_up(issues, unblocking)
|
||||
found: list[Chunk] = []
|
||||
waits: list[Waits] = []
|
||||
for issue in issues:
|
||||
if issue.done:
|
||||
continue
|
||||
if unblocks(issue.status, unblocking):
|
||||
waits.append(Waits(issue.key, f"its work has landed: it is {issue.status}, and the epic's finishing waits until Jira counts it done"))
|
||||
continue
|
||||
if is_split(issue, issues):
|
||||
if all(task.done for task in issues if task.parent == issue.key) and not finished(issues, issue.key):
|
||||
waits.append(Waits(issue.key, "its sub-tasks are done; close it in Jira"))
|
||||
continue
|
||||
turn = turn_of(issue, recorded(issue, team), open_blockers(issue, by_key), by_key, issue.key in holding)
|
||||
turn = turn_of(issue, recorded(issue, team), open_blockers(issue, by_key, unblocking), by_key, issue.key in holding, unblocking)
|
||||
if isinstance(turn, Chunk):
|
||||
found.append(turn)
|
||||
else:
|
||||
@@ -117,7 +134,7 @@ def chunks(issues: list[EpicIssue], team: LabelRepos) -> tuple[list[Chunk], list
|
||||
return found, waits
|
||||
|
||||
|
||||
def turn_of(issue: EpicIssue, pick: Pick | None | Failure, blocking: list[str], by_key: dict[str, EpicIssue], holds: bool) -> Chunk | Waits:
|
||||
def turn_of(issue: EpicIssue, pick: Pick | None | Failure, blocking: list[str], by_key: dict[str, EpicIssue], holds: bool, unblocking: tuple[str, ...] = ()) -> Chunk | Waits:
|
||||
"""The open issue's chunk, or why it waits. blocking are its open blockers, and holds says it holds up another open issue. A human's task gets a window only while it holds up another issue and nothing holds it up; that window waits for the human. A blocker outside the epic blocks until the human removes the link, since its state is unknown."""
|
||||
if isinstance(pick, Failure):
|
||||
return Waits(issue.key, pick.reason)
|
||||
@@ -128,7 +145,10 @@ def turn_of(issue: EpicIssue, pick: Pick | None | Failure, blocking: list[str],
|
||||
if blocking:
|
||||
outside = [key for key in blocking if key not in by_key]
|
||||
unseen = f"; do-epic cannot see {' and '.join(outside)}, outside the epic, finish: remove such a link in Jira once its issue is done" if outside else ""
|
||||
return Waits(issue.key, f"{' and '.join(blocking)} block{'s' if len(blocking) == 1 else ''} it{unseen}")
|
||||
inside = [key for key in blocking if key in by_key]
|
||||
whom = ("it is" if len(blocking) == 1 else "each is") if not outside else f"{' and '.join(inside)} {'is' if len(inside) == 1 else 'are'}"
|
||||
until = f", until {whom} {listed((*unblocking, 'done'), 'or')}" if unblocking and inside else ""
|
||||
return Waits(issue.key, f"{' and '.join(blocking)} block{'s' if len(blocking) == 1 else ''} it{until}{unseen}")
|
||||
return Chunk(issue.key, pick.name if isinstance(pick, Repo) else None)
|
||||
|
||||
|
||||
@@ -144,7 +164,7 @@ def refusal(repo: str, room: RepoRoom) -> str | None:
|
||||
def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str | None, run: tmux.Tmux) -> Started | Failure:
|
||||
"""Starts a do-epic in a new window for each of the epic's chunks that may start now. Where finishing is set, no issue is open, and the one chunk to start is the epic's finishing (finish.py), in a window named for the epic's key. own is the key of the chunk that asks, which has finished or parked: it counts as running nowhere, and no stopped chunk starts again. Where own is None, the human's `do-epic <EPIC-KEY>` asks, and each stopped chunk starts again. A parked chunk waits in its window; one without a live window, as after a reboot, starts again as a stopped chunk does, whatever the limits, since it goes on parked. A Failure says why a window could not start; those before it run."""
|
||||
session = tmux.session_name(tmux.EPIC, epic.key)
|
||||
found, waits = chunks(issues, epic.team)
|
||||
found, waits = chunks(issues, epic.team, epic.unblocking)
|
||||
if finishing:
|
||||
found.append(Chunk(epic.key, None))
|
||||
started: list[str] = []
|
||||
|
||||
@@ -18,9 +18,9 @@ def since(folder: pathlib.Path, chunk: Parked) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def lines(key: str, home: pathlib.Path, issues: list[EpicIssue], team: LabelRepos, run: tmux.Tmux) -> list[str] | Failure:
|
||||
def lines(key: str, home: pathlib.Path, issues: list[EpicIssue], team: LabelRepos, unblocking: tuple[str, ...], run: tmux.Tmux) -> list[str] | Failure:
|
||||
"""A line per open issue of the epic called key, in the tracker's rank order: that its chunk runs or asks the human, or why it waits. It doesn't start anything or check any limit, so the line of a chunk that has yet to start doesn't say which limit holds it back."""
|
||||
found, waits = chunks(issues, team)
|
||||
found, waits = chunks(issues, team, unblocking)
|
||||
folder = home / STATE / key
|
||||
parked = parked_chunks(folder)
|
||||
if isinstance(parked, Failure):
|
||||
|
||||
@@ -78,6 +78,27 @@ class ConfigTest(unittest.TestCase):
|
||||
self.write(SETTINGS + 'jira-finish-status = " "\n')
|
||||
self.assertIn('`jira-finish-status` is \' \', not the name Jira shows, such as "Done"; `jira-finish-status` is set, so `jira-finish-transition` must be too', self.failure())
|
||||
|
||||
def test_reads_the_unblocking_statuses_and_that_the_teams_automation_moves_issues(self) -> None:
|
||||
self.write(SETTINGS)
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual((found.unblocking, found.automation_moves), ((), False))
|
||||
self.write(SETTINGS + 'jira-unblocking-statuses = ["Release Ready", "Done"]\njira-automation-moves-issues = true\n')
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual((found.unblocking, found.automation_moves), (("Release Ready", "Done"), True))
|
||||
|
||||
def test_refuses_unblocking_statuses_that_are_no_list_of_names_and_a_switch_that_is_no_boolean(self) -> None:
|
||||
for value in ('"Done"', '["Done", " "]', "[]", "[1]"):
|
||||
with self.subTest(value=value):
|
||||
self.write(SETTINGS + f"jira-unblocking-statuses = {value}\n")
|
||||
self.assertIn('`jira-unblocking-statuses` is ', self.failure())
|
||||
self.assertIn(', not a list of the status names Jira shows, such as ["Release Ready"]', self.failure())
|
||||
self.write(SETTINGS + "jira-automation-moves-issues = true\n")
|
||||
self.assertIn("`jira-automation-moves-issues` is set, so `jira-unblocking-statuses` must name the status the automation gives an issue whose pull request merged", self.failure())
|
||||
self.write(SETTINGS + 'jira-automation-moves-issues = "yes"\n')
|
||||
self.assertIn("`jira-automation-moves-issues` is 'yes', not true or false", self.failure())
|
||||
|
||||
def test_refuses_while_the_config_is_missing(self) -> None:
|
||||
self.write(None)
|
||||
self.assertIn(f"cannot read {self.folder / 'config.toml'}", self.failure())
|
||||
|
||||
@@ -27,6 +27,7 @@ class WhenTheFinishingIsDue(DoEpicTest):
|
||||
self.assertIs(finish.due([]), False)
|
||||
self.assertIs(finish.due([issue("ABC-20", done=True), issue("ABC-21")]), False)
|
||||
self.assertIs(finish.due([issue("ABC-20", done=True), issue("ABC-21", done=True)]), True)
|
||||
self.assertIs(finish.due([issue("ABC-20", done=True), issue("ABC-21", status="Release Ready")]), False)
|
||||
|
||||
def test_an_item_split_by_repo_is_done_once_its_sub_tasks_are(self) -> None:
|
||||
split = [issue("ABC-20", "split-by-repo"), issue("ABC-40", "repo:api", done=True, parent="ABC-20")]
|
||||
|
||||
@@ -11,6 +11,7 @@ from do_epic.test_main import DESCRIPTION, Description, DoEpicTest, MODELS, UNRE
|
||||
from do_epic.epic_record import EpicRecord
|
||||
from failure import Failure
|
||||
from loop_effects.doubles import FakeEffects
|
||||
from do_epic.human_tasks import holds_up
|
||||
from do_epic.scheduler import HUMAN_WAIT
|
||||
from do_epic.test_scheduler import issue
|
||||
from do_epic.backend.fake import MemoryEpic
|
||||
@@ -49,6 +50,37 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest):
|
||||
self.slept = slept
|
||||
return self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
|
||||
def moved_to_an_unblocking_status(self, switch: str, frees: tuple[str, dict[str, object]] = ("ABC-19", {"status": "Release Ready"}), starts: str = "ABC-21") -> bool:
|
||||
"""Whether Jira counts the task done after its window's run, where the config ends with switch. frees is the change in Jira that ends the wait: by default the human moves the task to an unblocking status. starts is what the window then starts."""
|
||||
with (self.home / ".claude-projects" / "do-epic" / "config.toml").open("a") as config:
|
||||
config.write('jira-unblocking-statuses = ["Release Ready"]\n' + switch)
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
slept: list[int] = []
|
||||
|
||||
def sleep(seconds: int) -> None:
|
||||
slept.append(seconds)
|
||||
self.assertLess(len(slept), 5, "the window still waits")
|
||||
if len(slept) == 2:
|
||||
self.epic.change(frees[0], **frees[1])
|
||||
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, slept), (0, "", [60, 60]))
|
||||
self.assertIn(f"the chunk finished; started {starts}\n", out)
|
||||
return next(each.done for each in self.epic.issues if each.key == "ABC-19")
|
||||
|
||||
def test_a_task_the_human_moves_to_an_unblocking_status_no_longer_holds_up_an_issue_and_moves_to_done(self) -> None:
|
||||
self.assertTrue(self.moved_to_an_unblocking_status(""))
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_the_humans_task_stays_where_the_human_moved_it(self) -> None:
|
||||
self.assertFalse(self.moved_to_an_unblocking_status("jira-automation-moves-issues = true\n"))
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_task_that_blocks_no_open_issue_any_more_ends_its_window_unmoved(self) -> None:
|
||||
self.assertFalse(self.moved_to_an_unblocking_status("jira-automation-moves-issues = true\n", ("ABC-21", {"done": True}), starts="no other"))
|
||||
|
||||
def test_a_task_holds_up_only_the_issues_no_unblocking_status_settles(self) -> None:
|
||||
issues = [issue("ABC-19", "do-epic-human"), issue("ABC-20", "do-epic-claude", blockers=("ABC-19",), status="Release Ready"), issue("ABC-21", "do-epic-claude", blockers=("ABC-19",))]
|
||||
self.assertEqual(holds_up("ABC-19", issues, {}, ("Release Ready",)), ["ABC-21"])
|
||||
|
||||
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)
|
||||
|
||||
@@ -449,6 +449,18 @@ class AChunksRun(DoEpicTest):
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_finished_chunk_without_a_repo_still_moves_its_own(self) -> None:
|
||||
(self.home / ".claude-projects" / "do-epic" / "config.toml").write_text(SETTINGS + 'jira-unblocking-statuses = ["Release Ready"]\njira-automation-moves-issues = true\n', encoding="utf-8")
|
||||
parent = issue("ABC-23", "split-by-repo")
|
||||
store = MemoryEpic("ABC-12", [self.issues[0], parent, issue("ABC-21", "do-epic-claude", parent="ABC-23"), issue("ABC-22", "do-epic-claude", blockers=("ABC-23",))])
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows="ABC-21\t0\t@9\n")
|
||||
code, out, err = self.run_main(["--chunk", "ABC-21", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 0, err)
|
||||
# No pull request carries ABC-21, so do-epic moves it; its split item, then all done, closes as ever.
|
||||
self.assertEqual({each.key: each.done for each in store.issues}, {"ABC-20": False, "ABC-23": True, "ABC-21": True, "ABC-22": False})
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_the_last_sub_task_of_a_split_item_to_finish_moves_the_item_to_done_and_starts_what_it_blocks(self) -> None:
|
||||
parent = issue("ABC-21", "split-by-repo")
|
||||
tasks = [issue("ABC-23", "do-epic-claude", parent="ABC-21"), issue("ABC-24", "do-epic-claude", parent="ABC-21", done=True)]
|
||||
@@ -777,6 +789,27 @@ class AChunkWhosePullRequestWaitsOnAGate(DoEpicTest):
|
||||
code, _, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (0, 1), err)
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_finished_chunk_in_a_repo_moves_none_and_waits_for_the_move(self) -> None:
|
||||
(self.home / ".claude-projects" / "do-epic" / "config.toml").write_text(SETTINGS + 'jira-unblocking-statuses = ["Release Ready", "Shipped"]\njira-automation-moves-issues = true\n', encoding="utf-8")
|
||||
store = MemoryEpic("ABC-12", [*self.issues[:-1], issue("ABC-22", "do-epic-claude", blockers=("ABC-20",))])
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
self.forges = [awaiting(pulls="")]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
slept: list[float] = []
|
||||
|
||||
def sleep(seconds: float) -> None:
|
||||
slept.append(seconds)
|
||||
store.fails = "Jira answered 503" if len(slept) in (1, 2) else None
|
||||
if len(slept) == 4:
|
||||
store.change("ABC-20", status="Release Ready")
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign]
|
||||
code, out, err, _ = self.parked_run(fake)
|
||||
self.assertEqual((code, slept), (0, [60, 60, 60, 60]), err)
|
||||
self.assertEqual(out.count("cannot read the epic, so cannot tell whether ABC-20 has moved; trying again every 60 seconds: Jira answered 503\n"), 1, out)
|
||||
self.assertEqual([(each.status, each.done) for each in store.issues if each.key == "ABC-20"], [("Release Ready", False)])
|
||||
self.assertEqual(out.count("ABC-20 is To Do: it waits for the team's automation to move it to Release Ready or Shipped; move it in Jira if the automation doesn't\n"), 1, out)
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_where_the_chunk_merges_an_approved_pull_request_parks_no_chunk(self) -> None:
|
||||
self.forges = [awaiting(decision="APPROVED")]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
|
||||
@@ -7,7 +7,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from do_epic.scheduler import Chunk, chunks, Epic, HUMAN_WAIT, refusal, RepoRoom, resume, start_chunks, Started, Waits
|
||||
from do_epic.scheduler import Chunk, chunks, Epic, held_up, HUMAN_WAIT, refusal, RepoRoom, resume, start_chunks, Started, Waits
|
||||
from chunk_driver.claims import CHUNK_FLAG
|
||||
from do_epic import chunk_prompt
|
||||
from do_epic.backend.protocol import EpicIssue
|
||||
@@ -21,8 +21,8 @@ from project_config import settings
|
||||
from agent_cycle import tmux
|
||||
|
||||
|
||||
def issue(key: str, *labels: str, done: bool = False, blockers: tuple[str, ...] = (), parent: str = "ABC-12") -> EpicIssue:
|
||||
return EpicIssue(key, f"Do {key}", "", tuple(sorted(labels)), None, "Done" if done else "To Do", done, parent, blockers=blockers)
|
||||
def issue(key: str, *labels: str, done: bool = False, blockers: tuple[str, ...] = (), parent: str = "ABC-12", status: str | None = None) -> EpicIssue:
|
||||
return EpicIssue(key, f"Do {key}", "", tuple(sorted(labels)), None, status or ("Done" if done else "To Do"), done, parent, blockers=blockers)
|
||||
|
||||
|
||||
class TheCapLine(unittest.TestCase):
|
||||
@@ -120,6 +120,39 @@ class WhichIssuesAreChunks(unittest.TestCase):
|
||||
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")]))
|
||||
|
||||
def test_an_issue_in_an_unblocking_status_unblocks_what_it_blocks_and_waits_to_be_done_itself(self) -> None:
|
||||
issues = [issue("ABC-19", "repo:api", status="Release Ready"), issue("ABC-20", "repo:api", blockers=("ABC-19",)), issue("ABC-21", "repo:api", status="Code Review"), issue("ABC-22", "repo:api", blockers=("ABC-21",)), issue("ABC-23", "repo:api", done=True), issue("ABC-24", "repo:api", blockers=("ABC-23", "ABC-21", "ABC-22"))]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready", "Shipped")), ([Chunk("ABC-20", "api"), Chunk("ABC-21", "api")], [
|
||||
Waits("ABC-19", "its work has landed: it is Release Ready, and the epic's finishing waits until Jira counts it done"),
|
||||
Waits("ABC-22", "ABC-21 blocks it, until it is Release Ready, Shipped or done"),
|
||||
Waits("ABC-24", "ABC-21 and ABC-22 block it, until each is Release Ready, Shipped or done"),
|
||||
]))
|
||||
self.assertEqual(chunks(issues[:2], {}), ([Chunk("ABC-19", "api")], [Waits("ABC-20", "ABC-19 blocks it")]))
|
||||
self.assertEqual(held_up(issues, ("Release Ready", "Shipped")), {"ABC-21": ["ABC-22", "ABC-24"], "ABC-22": ["ABC-24"]})
|
||||
|
||||
def test_a_humans_task_gets_no_window_for_an_issue_it_blocks_that_is_in_an_unblocking_status(self) -> None:
|
||||
issues = [issue("ABC-19", "do-epic-human"), issue("ABC-20", "repo:api", blockers=("ABC-19",), status="Release Ready")]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready",))[0], [])
|
||||
|
||||
def test_an_unblocking_status_matches_whatever_its_case(self) -> None:
|
||||
issues = [issue("ABC-19", "repo:api", status="Release Ready"), issue("ABC-20", "repo:api", blockers=("ABC-19",))]
|
||||
self.assertEqual(chunks(issues, {}, ("release ready",)), ([Chunk("ABC-20", "api")], [Waits("ABC-19", "its work has landed: it is Release Ready, and the epic's finishing waits until Jira counts it done")]))
|
||||
|
||||
def test_names_an_unblocking_status_only_for_a_blocker_inside_the_epic(self) -> None:
|
||||
unseen = "outside the epic, finish: remove such a link in Jira once its issue is done"
|
||||
issues = [issue("ABC-19", "repo:api"), issue("ABC-20", "repo:api", blockers=("XYZ-1",)), issue("ABC-21", "repo:api", blockers=("ABC-19", "XYZ-1")), issue("ABC-22", "repo:api", blockers=("ABC-19", "ABC-20", "XYZ-1"))]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready",))[1], [
|
||||
Waits("ABC-20", f"XYZ-1 blocks it; do-epic cannot see XYZ-1, {unseen}"),
|
||||
Waits("ABC-21", f"ABC-19 and XYZ-1 block it, until ABC-19 is Release Ready or done; do-epic cannot see XYZ-1, {unseen}"),
|
||||
Waits("ABC-22", f"ABC-19 and ABC-20 and XYZ-1 block it, until ABC-19 and ABC-20 are Release Ready or done; do-epic cannot see XYZ-1, {unseen}"),
|
||||
])
|
||||
|
||||
def test_a_split_item_unblocks_what_it_blocks_once_each_sub_task_is_in_an_unblocking_status(self) -> None:
|
||||
issues = [issue("ABC-20", "split-by-repo"), issue("ABC-23", "repo:api", parent="ABC-20", status="Release Ready"), issue("ABC-24", "repo:web", parent="ABC-20", done=True), issue("ABC-21", "repo:api", blockers=("ABC-20",))]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready",))[0], [Chunk("ABC-21", "api")])
|
||||
self.assertEqual(chunks(issues, {})[0], [Chunk("ABC-23", "api")])
|
||||
self.assertEqual(chunks([*issues[:2], issue("ABC-24", "repo:web", parent="ABC-20"), issues[3]], {}, ("Release Ready",))[0], [Chunk("ABC-24", "web")])
|
||||
|
||||
|
||||
class RoomInARepo(unittest.TestCase):
|
||||
def test_a_repo_with_room_and_no_loop_claude_takes_a_chunk(self) -> None:
|
||||
|
||||
@@ -23,13 +23,21 @@ class TheStatusLines(unittest.TestCase):
|
||||
parked.park(self.folder, parked.Parked(key, f"/code/api-{key}", "7", "s", on))
|
||||
os.utime(parked.file_of(self.folder, key), (SINCE, SINCE))
|
||||
|
||||
def lines(self, issues: list, *windows: tuple[str, str, bool, str]) -> list[str] | Failure:
|
||||
return status.lines("ABC-12", self.home, issues, {}, Tmux(*windows))
|
||||
def lines(self, issues: list, *windows: tuple[str, str, bool, str], unblocking: tuple[str, ...] = ()) -> list[str] | Failure:
|
||||
return status.lines("ABC-12", self.home, issues, {}, unblocking, Tmux(*windows))
|
||||
|
||||
def test_a_chunk_that_asks_says_where_to_answer_and_one_that_works_runs(self) -> None:
|
||||
found = self.lines([issue("ABC-20", "repo:api"), issue("ABC-21", "repo:api")], (EPIC, "ABC-20 ?", False, ""), (EPIC, "ABC-21", False, ""))
|
||||
self.assertEqual(found, ["ABC-20 asks you: answer its question in the tmux window epic-ABC-12:ABC-20", "ABC-21 runs"])
|
||||
|
||||
def test_names_the_status_a_blocker_must_reach_and_the_one_a_merged_issue_is_in(self) -> None:
|
||||
found = self.lines([issue("ABC-20", "repo:api", status="Release Ready"), issue("ABC-21", "repo:api", status="Code Review"), issue("ABC-22", "repo:api", blockers=("ABC-21",))], (EPIC, "ABC-21", False, ""), unblocking=("Release Ready",))
|
||||
self.assertEqual(found, [
|
||||
"ABC-20 waits: its work has landed: it is Release Ready, and the epic's finishing waits until Jira counts it done",
|
||||
"ABC-21 runs",
|
||||
"ABC-22 waits: ABC-21 blocks it, until it is Release Ready or done",
|
||||
])
|
||||
|
||||
def test_a_parked_chunk_says_what_it_awaits_and_since_when(self) -> None:
|
||||
self.park("ABC-20", "an approval")
|
||||
self.assertEqual(self.lines([issue("ABC-20", "repo:api")], (EPIC, "ABC-20 awaits its checks", False, "")), [f"ABC-20 waits: it is parked: its pull request #7 awaits its checks, since {SINCE_ON}"])
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 460 | 0.14.0 | | | **Review the judge's fix for quoting the worker's task as evidence with every larv-review pass it fires, and adjust it to their findings.** | 2 | 2 | 3 | 5 | 2 | code health by 3, 1.1 by 5 | 7.2 |
|
||||
| 463 | 0.14.0 | | defect | **Show the judge the transcript's tail whatever the size of the records.** | 2 | 2 | 3 | 5 | 3 | 1.2 by 6, 1.5 by 4, 1.4 by 2 | 4.2 |
|
||||
| 452 | 0.14.0 | | | **Make do-epic's view of the Jira workflow settings: the statuses at which an issue unblocks the issues it blocks, and the moves the team's own automation makes, so do-epic makes none of those.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 7, 1.5 by 3 | 2.1 |
|
||||
| 449 | 0.14.0 | | | **Record do-epic's repo picks and sub-task summaries in the team's own spelling, such as `core-4` and `core-4: Bygg …`, as its config sets them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 6 | 2.0 |
|
||||
| 453 | 0.14.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 |
|
||||
| 457 | 0.14.0 | | | **Keep loop-claude from starting a chunk for an item whose pull request is ready and awaits a person's merge under `merge = "human"`.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 5, 1.4 by 3 | 1.7 |
|
||||
@@ -105,29 +104,6 @@ Touches:
|
||||
- `bin/agent_cycle/judge.py`: `JUDGE_PROMPT_CHARS` (small), `judge_prompt` (small)
|
||||
- `bin/agent_cycle/test_judge.py`: `JudgePrompt`
|
||||
|
||||
### 452. Make do-epic's view of the Jira workflow settings: the statuses at which an issue unblocks the issues it blocks, and the moves the team's own automation makes, so do-epic makes none of those.
|
||||
|
||||
do-epic counts an issue as done only where Jira's status category is done, and moves a finished chunk's issue to done itself, by `jira-finish-transition`. On a team whose CI moves issues through the workflow, both are wrong. On TW, CI moves an issue to Code Review when its pull request opens, to Release Ready when it merges, and to Done when it is deployed. So do-epic would move an issue to Done before it is deployed, and would hold every blocked issue until the blocker is deployed, though the team wants blocked work to start once the blocker's pull request merges.
|
||||
|
||||
- Settings in do-epic's config.toml name the statuses at which an issue unblocks the issues it blocks, such as `jira-unblock-statuses = ["Release Ready", "Done"]`; without them, Jira's done category counts, as today.
|
||||
- A setting says which moves the team's workflow makes on its own, so do-epic makes none of them. With the setting, a finished chunk moves no status and stops with no reason; `jira-finish-transition` then only closes the epic.
|
||||
- The epic's finishing waits until every issue is in Jira's done category, so release reviews follow the deploy.
|
||||
- `--status` names the status an issue waits to reach.
|
||||
|
||||
Touches:
|
||||
|
||||
- `bin/do_epic/config.py`: `DoEpicConfig`, `load`
|
||||
- `bin/do_epic/backend/protocol.py`: `EpicIssue` (small)
|
||||
- `bin/do_epic/backend/jira.py`: `found_of` (small), `finish_issue`
|
||||
- `bin/do_epic/scheduler.py`: `open_blockers`
|
||||
- `bin/do_epic/main.py`: `handed_on`, `split_items_closed`
|
||||
- `bin/do_epic/finish.py`: `due` (small), `still_open` (small)
|
||||
- `bin/do_epic/status.py`: `lines` (small)
|
||||
- `bin/do_epic/test_scheduler.py`
|
||||
- `bin/do_epic/test_main.py`
|
||||
- `bin/do_epic/backend/test_jira.py`
|
||||
- `README.md`: `### Set up a project` (small)
|
||||
|
||||
### 449. Record do-epic's repo picks and sub-task summaries in the team's own spelling, such as `core-4` and `core-4: Bygg …`, as its config sets them.
|
||||
|
||||
do-epic writes its own spelling into a team's Jira: a pick as `repo:core-4` and a sub-task's summary as `[core-4] <the item's summary>`. A team with its own convention, such as TW's label `core-4` and summary `core-4: Bygg …` with a capital after the colon, then finds two labels on each issue and summaries in a shape its board doesn't use. Goal 1.6 asks the loop to fit the tracker's conventions, not change them.
|
||||
|
||||
Reference in New Issue
Block a user