Start a do-epic chunk's issue in Jira: assigned, moved by a start transition and added to a board's active sprint
This commit is contained in:
@@ -30,6 +30,7 @@ from text_files.file_writes import replace_file
|
||||
from model_routing.route import Route
|
||||
from model_routing.ladder import Rung
|
||||
from do_epic.test_do_epic import SETTINGS
|
||||
from do_epic.backend.jira_start import Start
|
||||
|
||||
DESCRIPTION = "**Max parallel chunks:** 2\n\n## Goals\nShip the import.\n\n## Audience\nThe client's team.\n"
|
||||
|
||||
@@ -104,6 +105,11 @@ class TheJiraBackend(unittest.TestCase):
|
||||
self.assertEqual((store.epic, store.env_file, store.finish), (Epic("https://acme.atlassian.net", "ABC-12"), pathlib.Path("/h/jira.env"), Finish("Mark as done", "Done"))) # type: ignore[attr-defined]
|
||||
self.assertEqual((record.description.epic, record.description.env_file), (store.epic, store.env_file)) # type: ignore[attr-defined]
|
||||
|
||||
def test_starts_an_issue_as_the_config_says(self) -> None:
|
||||
config = DoEpicConfig(pathlib.Path("/c"), "https://acme.atlassian.net", pathlib.Path("/h/jira.env"), pathlib.Path("/h/code"), "English", "claude-opus-5-5", "rule", start=Start("In Progress", 6))
|
||||
store, _ = main.jira_backend(config, "ABC-12")
|
||||
self.assertEqual(store.start, Start("In Progress", 6)) # type: ignore[attr-defined]
|
||||
|
||||
def test_files_the_issue_types_the_config_names(self) -> None:
|
||||
config = DoEpicConfig(pathlib.Path("/c"), "https://acme.atlassian.net", pathlib.Path("/h/jira.env"), pathlib.Path("/h/code"), "English", "claude-opus-5-5", "rule", finding_type="Feature", review_type="Chore")
|
||||
store, _ = main.jira_backend(config, "ABC-12")
|
||||
@@ -368,6 +374,32 @@ class AChunksRun(DoEpicTest):
|
||||
# The one claude call is the judge's: ABC-22, which no label places, waits for the human's do-epic.
|
||||
self.assertEqual(len(fake.made("claude")), 1)
|
||||
|
||||
def started(self, store: MemoryEpic) -> str:
|
||||
"""What the chunk of ABC-21 prints as it runs to its end on store."""
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[assignment, method-assign, arg-type]
|
||||
code, out, err = self.run_main(["--chunk", "ABC-21", "ABC-12"], FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows="ABC-21\t0\t@9\n"), MODELS)
|
||||
self.assertEqual(code, 0, err)
|
||||
return out
|
||||
|
||||
def test_a_starting_chunk_starts_its_issue_in_the_tracker_before_its_first_cycle(self) -> None:
|
||||
store = MemoryEpic("ABC-12", list(self.issues))
|
||||
out = self.started(store)
|
||||
self.assertEqual((store.writes[0], store.issues[1].assignee), ("start ABC-21", "do-epic"))
|
||||
self.assertNotIn("assigned", out.partition("=== cycle 1")[0])
|
||||
|
||||
def test_a_starting_chunk_says_who_else_holds_its_issue_and_leaves_it_theirs(self) -> None:
|
||||
store = MemoryEpic("ABC-12", [self.issues[0], dataclasses.replace(self.issues[1], assignee="Ada Berg")])
|
||||
self.assertIn("ABC-21 stays assigned to Ada Berg, who holds it\n", self.started(store).partition("=== cycle 1")[0])
|
||||
self.assertEqual(store.issues[1].assignee, "Ada Berg")
|
||||
|
||||
def test_a_chunk_runs_though_its_issue_could_not_start_in_the_tracker_and_says_why(self) -> None:
|
||||
class Unstartable(MemoryEpic):
|
||||
def start_issue(self, key: str) -> str | None | Failure:
|
||||
return Failure(f"cannot assign {key}: Jira answered 403")
|
||||
out = self.started(Unstartable("ABC-12", list(self.issues)))
|
||||
self.assertIn("ABC-21 doesn't show in the tracker as started, and its chunk runs all the same: cannot assign ABC-21: Jira answered 403\n", out.partition("=== cycle 1")[0])
|
||||
self.assertIn("the chunk finished", out)
|
||||
|
||||
def test_runs_cycles_until_the_judge_rules_it_finished_then_starts_the_next_chunk(self) -> None:
|
||||
self.issues.append(issue("ABC-22", "do-epic-claude"))
|
||||
self.description = DESCRIPTION.replace("2", "1")
|
||||
|
||||
Reference in New Issue
Block a user