Answer product-owner round 1: 1 🔴, 3 🟡 (1 misread); finish a sub-task too, name the transition in the config where several close an issue, say how to start the blocked chunks after a refused move
This commit is contained in:
@@ -133,13 +133,19 @@ class EpicStoreContract:
|
||||
self.assertEqual([store.finish(key), store.finish(closed)], [None, None])
|
||||
self.assertEqual({issue.key: issue.done for issue in self.issues(store)}, {key: True, other: False, closed: True})
|
||||
|
||||
def test_refuses_to_finish_a_sub_task_or_an_issue_outside_the_epic(self) -> None:
|
||||
def test_finishes_a_sub_task_of_a_child_issue_and_leaves_its_parent_open(self) -> None:
|
||||
store = self.new_store()
|
||||
child = self.filed(store, store.epic_key, "Count the runs.")
|
||||
task = self.filed(store, child, "Count them in the api.")
|
||||
self.assertEqual(store.finish(task), Failure(f"{task} is not one of the child issues of the epic {store.epic_key}, so it cannot be finished"))
|
||||
self.assertIsNone(store.finish(task))
|
||||
self.assertEqual({issue.key: issue.done for issue in self.issues(store)}, {child: False, task: True})
|
||||
|
||||
def test_refuses_to_finish_an_issue_outside_the_epic(self) -> None:
|
||||
store = self.new_store()
|
||||
child = self.filed(store, store.epic_key, "Count the runs.")
|
||||
self.assertIsInstance(store.finish("ZZZ-1"), Failure)
|
||||
self.assertEqual([issue.done for issue in self.issues(store)], [False, False])
|
||||
self.assertIsInstance(store.finish("not a key"), Failure)
|
||||
self.assertEqual([issue.done for issue in self.issues(store)], [False])
|
||||
|
||||
def test_posts_comments_on_a_child_issue_in_order(self) -> None:
|
||||
store = self.new_store()
|
||||
|
||||
@@ -63,7 +63,8 @@ class MemoryEpic:
|
||||
def finish(self, key: str) -> None | Failure:
|
||||
if self.fails:
|
||||
return Failure(self.fails)
|
||||
child = next((issue for issue in self.issues if issue.key == key and issue.parent == self.epic_key), None)
|
||||
children = {issue.key for issue in self.issues if issue.parent == self.epic_key}
|
||||
child = next((issue for issue in self.issues if issue.key == key and (issue.parent == self.epic_key or issue.parent in children)), None)
|
||||
if child is None:
|
||||
return no_child(self.epic_key, key, "finished")
|
||||
if not child.done:
|
||||
|
||||
+22
-11
@@ -6,13 +6,14 @@ import typing
|
||||
from adf_codec.convert import adfs_to_markdown, markdown_to_adf, Refused
|
||||
from atlassian.client import basic_auth, Http, jira_json, ToAdf, ToMarkdown
|
||||
from plan_store.jira_epic import blocked_by_links, DONE, FILED_BY, ISSUE_KEY, ISSUE_TYPE, offer_of, project_of, PROPERTY, rank_refusal, scores, searched
|
||||
from project_config.settings import Epic
|
||||
from project_config.settings import Epic, JIRA_FINISH_TRANSITION
|
||||
from do_epic.backend.protocol import EpicIssue, no_child, no_parent, no_words, unfit, unfit_label
|
||||
from failure import Failure
|
||||
|
||||
FIELDS = ["summary", "description", "labels", "assignee", "status", "parent", "issuelinks"]
|
||||
# How many child issues one search for sub-tasks names, which keeps its JQL well inside the length Jira takes.
|
||||
PARENTS_PER_SEARCH = 50
|
||||
PERHAPS_MOVED = "unless Jira refused the request, {key} may be done: read it in Jira before moving it again"
|
||||
PERHAPS_FILED = "unless Jira refused the request, the issue may exist: look under {parent} before filing it again"
|
||||
|
||||
|
||||
@@ -31,6 +32,8 @@ class JiraEpic:
|
||||
http: Http = jira_json
|
||||
to_markdown: ToMarkdown = adfs_to_markdown
|
||||
to_adf: ToAdf = markdown_to_adf
|
||||
# The name of the transition to finish an issue by, where its status offers several to a done status.
|
||||
finish_by: str | None = None
|
||||
|
||||
@property
|
||||
def epic_key(self) -> str:
|
||||
@@ -124,7 +127,11 @@ class JiraEpic:
|
||||
if isinstance(placed, Failure):
|
||||
return placed
|
||||
above, done = placed
|
||||
if above != self.epic_key:
|
||||
# A sub-task is no child of the epic but its parent is, so a sub-task's parent is read too.
|
||||
grand = self.parent_of(above, authorization, "to finish its sub-task") if above not in (None, self.epic_key) else None
|
||||
if isinstance(grand, Failure):
|
||||
return grand
|
||||
if above is None or (above != self.epic_key and grand != self.epic_key):
|
||||
return no_child(self.epic_key, key, "finished")
|
||||
if done:
|
||||
return None
|
||||
@@ -132,11 +139,11 @@ class JiraEpic:
|
||||
offered = self.http("GET", url, authorization, None)
|
||||
if isinstance(offered, Failure):
|
||||
return Failure(f"cannot read {key}'s transitions: {offered.reason}")
|
||||
transition = done_transition(offered, key)
|
||||
transition = done_transition(offered, key, self.finish_by)
|
||||
if isinstance(transition, Failure):
|
||||
return transition
|
||||
moved = self.http("POST", url, authorization, {"transition": {"id": transition}})
|
||||
return Failure(f"cannot move {key} to done: {moved.reason}; the issue may have moved all the same: read it in Jira before moving it again") if isinstance(moved, Failure) else None
|
||||
return Failure(f"cannot move {key} to done: {moved.reason}; {PERHAPS_MOVED.format(key=key)}") if isinstance(moved, Failure) else None
|
||||
|
||||
def not_a_parent(self, parent: str, authorization: str) -> Failure | None:
|
||||
"""Why nothing can be filed under parent; None where it is the epic or one of its child issues."""
|
||||
@@ -151,7 +158,7 @@ class JiraEpic:
|
||||
return placed if isinstance(placed, Failure) else placed[0]
|
||||
|
||||
def placed(self, key: str, authorization: str, why: str, asked: str = "parent,status") -> tuple[str | None, bool] | Failure:
|
||||
"""The key of key's parent issue, None where key isn't an issue key or has no parent, and whether its status is a done one; asked names the fields to read, and a field it leaves out reads as not done. A failed read says "cannot read <key> <why>"."""
|
||||
"""The key of key's parent issue, None where key isn't an issue key or has no parent, and whether key's own status is a done one; asked names the fields to read, and leaving out `status` makes key read as not done. A failed read says "cannot read <key> <why>"."""
|
||||
if not ISSUE_KEY.fullmatch(key):
|
||||
return None, False
|
||||
# A search may not show an issue filed a moment ago, so the issue is asked for by its key.
|
||||
@@ -203,19 +210,23 @@ class JiraEpic:
|
||||
return Failure(f"{project} has no sub-task issue type; turn sub-tasks on in Jira") if found is None else {"id": found}
|
||||
|
||||
|
||||
def done_transition(offered: object, key: str) -> str | Failure:
|
||||
"""The ID of the one transition among those Jira offered for the issue named key that leads to a done status; or why no move can finish it. Which of two such moves finishes it is the team's workflow, so none is picked."""
|
||||
def done_transition(offered: object, key: str, named: str | None) -> str | Failure:
|
||||
"""The ID of the transition that finishes the issue named key, among those Jira offered, which are the ones its status has and the account may make. It is the one that leads to a done status, or where there are several, the one called named; or why Jira offered no such move. Which of several finishes an issue is the team's workflow, so none is picked without a name."""
|
||||
raw = offered.get("transitions") if isinstance(offered, dict) else None
|
||||
found = [offer for each in raw if (offer := offer_of(each))] if isinstance(raw, list) else []
|
||||
if not isinstance(raw, list) or len(found) != len(raw):
|
||||
return Failure(f"Jira answered {key}'s transitions in a shape other than the one it documents")
|
||||
closing = [(id_, name, status) for id_, name, status, category in found if category == DONE]
|
||||
if len(closing) == 1:
|
||||
return closing[0][0]
|
||||
chosen = [move for move in closing if named is None or move[1] == named]
|
||||
if len(chosen) == 1:
|
||||
return chosen[0][0]
|
||||
listed = " and ".join(f"{name!r} to {status!r}" for _, name, status in closing)
|
||||
if len(closing) > 1 and not named:
|
||||
return Failure(f"{key}'s status has more than one transition to a done status, {listed}: name the one to use in `{JIRA_FINISH_TRANSITION}`, in ~/.claude-projects/do-epic/config.toml")
|
||||
if closing:
|
||||
return Failure(f"{key}'s status has more than one transition to a done status, {' and '.join(f'{name!r} to {status!r}' for _, name, status in closing)}: move the issue in Jira, or change the workflow so that one move closes it")
|
||||
return Failure(f"{key}'s status has no transition called {named!r} to a done status, only {listed}: correct `{JIRA_FINISH_TRANSITION}`, in ~/.claude-projects/do-epic/config.toml")
|
||||
others = " and ".join(f"{name!r} to {status!r}" for _, name, status, _ in found)
|
||||
return Failure(f"{key}'s status has no transition to a done status" + (f", only {others}" if others else "") + ": move the issue in Jira, or change the workflow so that one move closes it")
|
||||
return Failure(f"{key}'s status has no transition to a done status" + (f", only {others}" if others else "") + ": Jira lists only the transitions the account may make, so move the issue in Jira, or let the account transition issues")
|
||||
|
||||
|
||||
def found_of(raw: object) -> Found | Failure:
|
||||
|
||||
@@ -64,7 +64,7 @@ class EpicStore(typing.Protocol):
|
||||
"""Posts text, markdown, as a comment on the epic's child issue named key, for the people who work the epic to read. A sub-task, an issue outside the epic, or an empty or blank text is refused."""
|
||||
|
||||
def finish(self, key: str) -> None | Failure:
|
||||
"""Moves the epic's child issue named key to a done status, so that read answers it as done; one already done stays as it is. A sub-task, or an issue outside the epic, is refused, and so is a tracker whose workflow offers no one move to a done status."""
|
||||
"""Moves the epic's child issue named key, or a sub-task of one, to a done status, so that read answers it as done; one already done stays as it is. An issue outside the epic is refused. A Failure says why the move could not be made: the issue's workflow gives no way to a done status, gives several the backend cannot choose between, or refuses the move."""
|
||||
|
||||
|
||||
def unfit(summary: str, labels: tuple[str, ...]) -> Failure | None:
|
||||
|
||||
@@ -45,6 +45,8 @@ class FakeJira:
|
||||
answers: dict[tuple[str, str], object] = dataclasses.field(default_factory=dict)
|
||||
calls: list[tuple[str, str]] = dataclasses.field(default_factory=list)
|
||||
comments: dict[str, list[object]] = dataclasses.field(default_factory=dict)
|
||||
# The ID of each transition made.
|
||||
transitioned: list[str] = dataclasses.field(default_factory=list)
|
||||
# The transitions Jira offers an issue that isn't done.
|
||||
workflow: list[dict[str, object]] = dataclasses.field(default_factory=lambda: [{"id": "31", "name": "Mark as done", "to": DONE}])
|
||||
|
||||
@@ -68,6 +70,7 @@ class FakeJira:
|
||||
if method == "POST" and (held := next((issue for issue in self.issues if url == f"{ISSUES}/{issue['key']}/transitions"), None)):
|
||||
assert isinstance(body, dict)
|
||||
held["fields"]["status"] = DONE # type: ignore[index]
|
||||
self.transitioned.append(body["transition"]["id"])
|
||||
return None
|
||||
if method == "POST" and url == ISSUES:
|
||||
return self.created(body)
|
||||
@@ -178,26 +181,46 @@ class Jira(Case):
|
||||
self.assertIsNone(store.finish(key))
|
||||
self.assertNotIn(("GET", f"{ISSUES}/{key}/transitions"), self.jira.calls)
|
||||
|
||||
def test_a_finish_names_why_no_one_move_closes_the_issue(self) -> None:
|
||||
store = self.new_store()
|
||||
key = store.file("ABC-12", "Count the runs.", "", ())
|
||||
wont = {"name": "Closed", "statusCategory": {"key": "done"}}
|
||||
def test_a_finish_names_why_no_move_closes_the_issue(self) -> None:
|
||||
key = self.new_store().file("ABC-12", "Count the runs.", "", ())
|
||||
closed = {"name": "Closed", "statusCategory": {"key": "done"}}
|
||||
start = {"id": "11", "name": "Start", "to": {"name": "In Progress", "statusCategory": {"key": "indeterminate"}}}
|
||||
for workflow, reason in (
|
||||
([start], f"{key}'s status has no transition to a done status, only 'Start' to 'In Progress'"),
|
||||
([], f"{key}'s status has no transition to a done status"),
|
||||
([{"id": "31", "name": "Mark as done", "to": DONE}, {"id": "41", "name": "Won't do", "to": wont}], f"{key}'s status has more than one transition to a done status, 'Mark as done' to 'Done' and \"Won't do\" to 'Closed'"),
|
||||
both = [{"id": "31", "name": "Mark as done", "to": DONE}, {"id": "41", "name": "Close", "to": closed}]
|
||||
config = " in `jira-finish-transition`, in ~/.claude-projects/do-epic/config.toml"
|
||||
for workflow, named, reason in (
|
||||
([start], None, f"{key}'s status has no transition to a done status, only 'Start' to 'In Progress': Jira lists only the transitions the account may make, so move the issue in Jira, or let the account transition issues"),
|
||||
([], None, f"{key}'s status has no transition to a done status: Jira lists only the transitions the account may make, so move the issue in Jira, or let the account transition issues"),
|
||||
(both, None, f"{key}'s status has more than one transition to a done status, 'Mark as done' to 'Done' and 'Close' to 'Closed': name the one to use{config}"),
|
||||
(both, "Resolve", f"{key}'s status has no transition called 'Resolve' to a done status, only 'Mark as done' to 'Done' and 'Close' to 'Closed': correct `jira-finish-transition`, in ~/.claude-projects/do-epic/config.toml"),
|
||||
([start], "Close", f"{key}'s status has no transition to a done status, only 'Start' to 'In Progress': Jira lists only the transitions the account may make, so move the issue in Jira, or let the account transition issues"),
|
||||
):
|
||||
with self.subTest(workflow=workflow):
|
||||
with self.subTest(workflow=workflow, named=named):
|
||||
self.jira.workflow = workflow # type: ignore[assignment]
|
||||
self.assertEqual(store.finish(key), Failure(f"{reason}: move the issue in Jira, or change the workflow so that one move closes it"))
|
||||
self.assertEqual(JiraEpic(EPIC, self.env_file, self.jira, to_markdown, to_adf, named).finish(key), Failure(reason))
|
||||
self.assertEqual(self.jira.issues[0]["fields"]["status"], TO_DO) # type: ignore[index]
|
||||
|
||||
def test_finishes_by_the_transition_the_config_names_where_several_lead_to_a_done_status(self) -> None:
|
||||
key = self.new_store().file("ABC-12", "Count the runs.", "", ())
|
||||
self.jira.workflow = [{"id": "31", "name": "Resolve", "to": DONE}, {"id": "41", "name": "Close", "to": {"name": "Closed", "statusCategory": {"key": "done"}}}]
|
||||
self.assertIsNone(JiraEpic(EPIC, self.env_file, self.jira, to_markdown, to_adf, "Close").finish(key))
|
||||
self.assertEqual(self.jira.calls[-1], ("POST", f"{ISSUES}/{key}/transitions"))
|
||||
self.assertEqual(self.jira.transitioned, ["41"])
|
||||
|
||||
def test_refuses_to_finish_a_sub_task_of_an_issue_that_is_no_child_of_the_epic_or_an_issue_without_a_parent(self) -> None:
|
||||
store = self.new_store()
|
||||
for key, parent in (("ABC-50", "ABC-60"), ("ABC-60", "ABC-61"), ("ABC-61", None)):
|
||||
fields = {"summary": "Other.", "description": None, "labels": [], "assignee": None, "status": TO_DO, "parent": {"key": parent} if parent else None, "issuelinks": []}
|
||||
self.jira.issues.append({"key": key, "fields": fields})
|
||||
for key in ("ABC-50", "ABC-61"):
|
||||
with self.subTest(key=key):
|
||||
self.assertEqual(store.finish(key), Failure(f"{key} is not one of the child issues of the epic ABC-12, so it cannot be finished"))
|
||||
self.assertNotIn("POST", [method for method, _ in self.jira.calls])
|
||||
|
||||
def test_a_finish_jira_refuses_says_so_and_that_the_issue_may_have_moved(self) -> None:
|
||||
store = self.new_store()
|
||||
key = store.file("ABC-12", "Count the runs.", "", ())
|
||||
self.jira.answers[("POST", f"{ISSUES}/{key}/transitions")] = Failure("Jira answered 400: Resolution is required")
|
||||
self.assertEqual(store.finish(key), Failure(f"cannot move {key} to done: Jira answered 400: Resolution is required; the issue may have moved all the same: read it in Jira before moving it again"))
|
||||
self.assertEqual(store.finish(key), Failure(f"cannot move {key} to done: Jira answered 400: Resolution is required; unless Jira refused the request, {key} may be done: read it in Jira before moving it again"))
|
||||
|
||||
def test_a_finish_whose_transitions_jira_cannot_give_or_gives_in_another_shape_fails(self) -> None:
|
||||
store = self.new_store()
|
||||
|
||||
@@ -7,18 +7,20 @@ One pair per machine, the same for every epic (docs/decisions.md → `do-epic: d
|
||||
repoless-model = "claude-opus-5-5"
|
||||
clone-folder = "~/code"
|
||||
language = "Swedish"
|
||||
jira-finish-transition = "Mark as done"
|
||||
|
||||
- `jira-url` is the Jira site's address: https, a host, and no path.
|
||||
- `env-file` is the file of Jira credentials: a path that starts with / or ~/, outside every folder of `~/.claude-projects` and outside the clone folder, which hold git checkouts. `~/.claude-projects/<key>.env` is fine.
|
||||
- `repoless-model` is the model that works an epic item with no repo: a model on the routing ladder, `model_routing/routing-ladder.json`.
|
||||
- `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` is the name Jira shows of the transition that moves a finished chunk's issue to done. It is needed only where an issue's status offers more than one transition to a done status, such as Resolve and Close. Left out, do-epic takes the one transition that leads to a done status.
|
||||
- `repo-rule.md` is prose that says how to tell an item's repo, and mustn't be blank."""
|
||||
import dataclasses
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, LANGUAGE, language_fault, lies_in, parsed, PROJECTS, SITE
|
||||
from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, JIRA_FINISH_TRANSITION, LANGUAGE, language_fault, lies_in, name_of, parsed, PROJECTS, SITE
|
||||
from failure import Failure
|
||||
from model_routing.ladder_file import read_ladder, SHIPPED
|
||||
|
||||
@@ -28,7 +30,7 @@ JIRA_URL = "jira-url"
|
||||
REPOLESS_MODEL = "repoless-model"
|
||||
CLONE_FOLDER = "clone-folder"
|
||||
SETTINGS = (JIRA_URL, ENV_FILE, REPOLESS_MODEL)
|
||||
OPTIONAL = (CLONE_FOLDER, LANGUAGE)
|
||||
OPTIONAL = (CLONE_FOLDER, LANGUAGE, JIRA_FINISH_TRANSITION)
|
||||
LISTED = f"The settings are {', '.join(SETTINGS)}, and optionally {' and '.join(OPTIONAL)}."
|
||||
|
||||
|
||||
@@ -42,6 +44,8 @@ class DoEpicConfig:
|
||||
language: str
|
||||
repoless_model: str
|
||||
repo_rule: str
|
||||
# The name of the transition that finishes an issue where its status offers several to a done status; None where the config names none.
|
||||
finish_transition: str | None = None
|
||||
|
||||
|
||||
def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfig | Failure:
|
||||
@@ -63,6 +67,7 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
|
||||
clone_folder = anywhere(values.get(CLONE_FOLDER, "~/code"), home)
|
||||
env_file = anywhere(values.get(ENV_FILE), home)
|
||||
language = values.get(LANGUAGE, "English")
|
||||
finish = values.get(JIRA_FINISH_TRANSITION)
|
||||
url, model = values.get(JIRA_URL), values.get(REPOLESS_MODEL)
|
||||
faults = [
|
||||
*(f"`{name}` is missing" for name in SETTINGS if name not in values),
|
||||
@@ -72,6 +77,7 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
|
||||
*([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not a path that starts with / or ~/"] if ENV_FILE in values and env_file is None else []),
|
||||
*([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, inside a folder of ~/{PROJECTS} or the clone folder, which hold git checkouts"] if env_file and lies_in(env_file, *config_folders, *([clone_folder] if clone_folder else [])) else []),
|
||||
*([f"`{LANGUAGE}` is {language!r}, {fault}"] if LANGUAGE in values and (fault := language_fault(language)) else []),
|
||||
*([f"`{JIRA_FINISH_TRANSITION}` is {finish!r}, not the name Jira shows, such as \"Mark as done\""] if JIRA_FINISH_TRANSITION in values and not name_of(finish) 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 []),
|
||||
*([rule.reason] if isinstance(rule, Failure) else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []),
|
||||
]
|
||||
@@ -79,4 +85,4 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
|
||||
return Failure(f"{folder}: {'; '.join(faults)}. {LISTED}")
|
||||
# Without a fault, each value above is present and of the type asserted here.
|
||||
assert clone_folder and env_file and isinstance(url, str) and isinstance(model, str) and isinstance(language, str) and isinstance(rule, str)
|
||||
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule)
|
||||
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule, name_of(finish))
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ Backend = typing.Callable[[DoEpicConfig, str], tuple[EpicStore, EpicRecord]]
|
||||
|
||||
def jira_backend(config: DoEpicConfig, key: str) -> tuple[EpicStore, EpicRecord]:
|
||||
epic = Epic(config.jira_url, key)
|
||||
return JiraEpic(epic, config.env_file), EpicRecord(EpicDescription(epic, config.env_file))
|
||||
return JiraEpic(epic, config.env_file, finish_by=config.finish_transition), EpicRecord(EpicDescription(epic, config.env_file))
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -223,10 +223,10 @@ def chunk_root(issue: EpicIssue, epic: EpicRun) -> tuple[str, bool] | Stop:
|
||||
|
||||
|
||||
def handed_on(key: str, epic: EpicRun) -> Stop:
|
||||
"""The stop of a do-epic whose chunk finished, once its issue is done in the tracker, so that no finished chunk starts again and what it blocks may start, and it has started each chunk that may start now. Its window closes as it exits."""
|
||||
"""The stop of a do-epic whose chunk finished. It first moves the chunk's issue to done, so that no finished chunk starts again and what the issue blocks may start, then starts each chunk that may start now. Its window closes as it exits."""
|
||||
moved = epic.store.finish(key)
|
||||
if isinstance(moved, Failure):
|
||||
return Stop(1, f"the chunk finished, but its issue could not move to done: {moved.reason}")
|
||||
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")
|
||||
started = chunks_started(epic, key)
|
||||
if isinstance(started, Failure):
|
||||
return Stop(1, f"the chunk finished, but the next could not start: {started.reason}")
|
||||
|
||||
@@ -43,6 +43,16 @@ class ConfigTest(unittest.TestCase):
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual((found.clone_folder, found.language), (pathlib.Path("/srv/repos"), "Brazilian Portuguese"))
|
||||
|
||||
def test_reads_the_transition_that_finishes_an_issue_and_has_none_where_the_config_names_none(self) -> None:
|
||||
self.write()
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertIsNone(found.finish_transition)
|
||||
self.write(SETTINGS + 'jira-finish-transition = "Close Issue"\n')
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual(found.finish_transition, "Close Issue")
|
||||
|
||||
def test_refuses_while_the_config_is_missing(self) -> None:
|
||||
self.write(None)
|
||||
self.assertIn(f"cannot read {self.folder / 'config.toml'}", self.failure())
|
||||
@@ -80,6 +90,7 @@ class ConfigTest(unittest.TestCase):
|
||||
('env-file = "jira.env"', "env-file"),
|
||||
('clone-folder = "code"', "clone-folder"),
|
||||
('language = "sv_SE"', "language"),
|
||||
('jira-finish-transition = " "', "jira-finish-transition"),
|
||||
('repoless-model = "opus"', "repoless-model"),
|
||||
('repoless-model = "claude-opsu-5-5"', "repoless-model"),
|
||||
):
|
||||
|
||||
@@ -299,7 +299,7 @@ class AChunksRun(DoEpicTest):
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD)
|
||||
code, out, err = self.run_main(["--chunk", "ABC-21", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("the chunk finished, but its issue could not move to done: ABC-21's status has no transition to a done status\n", err)
|
||||
self.assertIn("the chunk finished, but its issue could not move to done: ABC-21's status has no transition to a done status; once it is done in Jira, run `do-epic ABC-12` to start the chunks it blocks\n", err)
|
||||
self.assertNotIn("started", out)
|
||||
|
||||
def test_a_finished_chunk_says_why_the_next_could_not_start(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user