Record do-epic's repo picks and sub-task summaries in the team's own spelling
CI / tests (pull_request) Failing after 2m33s

This commit is contained in:
Lilleman
2026-11-20 09:10:55 +01:00
parent e9e11f10a0
commit 15c978b708
9 changed files with 130 additions and 23 deletions
+19 -2
View File
@@ -6,7 +6,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from do_epic.repo_pick import also, CLAUDE_LABEL, ClaudeWork, HUMAN_LABEL, HumanTask, label_of, PICK_SCHEMA, picked, recorded, Repo, REPO_PREFIX, Unclear
from do_epic.repo_pick import also, CLAUDE_LABEL, ClaudeWork, HUMAN_LABEL, HumanTask, label_of, PICK_SCHEMA, picked, record, recorded, Repo, REPO_PREFIX, Unclear
from do_epic.backend.protocol import EpicIssue
from failure import Failure
from claude_code.reply import Limited
@@ -137,7 +137,7 @@ class RepoPick(unittest.TestCase):
def test_the_label_of_a_pick_reads_back_as_that_pick(self) -> None:
for pick in (Repo("payments-api"), ClaudeWork(), HumanTask()):
with self.subTest(pick=pick):
self.assertEqual(recorded(EpicIssue(self.key, "s", "", (label_of(pick),), None, "To Do", False, "ABC-12"), {}), pick)
self.assertEqual(recorded(EpicIssue(self.key, "s", "", (label_of(pick, {}),), None, "To Do", False, "ABC-12"), {}), pick)
def test_a_label_the_teams_table_maps_records_its_repo_without_asking_claude(self) -> None:
self.store.add_label(self.key, "twu-4")
@@ -159,6 +159,23 @@ class RepoPick(unittest.TestCase):
self.store.add_label(self.key, "repo:core-4")
self.assertEqual(recorded(self.issue(), TEAM), Failure(f"{self.key} is labelled with 2 picks: core-4, repo:core-4, twu-4; remove the labels of all but the right one"))
def test_a_repo_the_teams_table_names_is_recorded_as_the_teams_label_and_any_other_as_repo_name(self) -> None:
for pick, label in ((Repo("tenant-web-ui-4"), "twu-4"), (Repo("core-4"), "core-4"), (Repo("api-3"), "repo:api-3"), (ClaudeWork(), CLAUDE_LABEL), (HumanTask(), HUMAN_LABEL)):
with self.subTest(pick=pick):
self.assertEqual(label_of(pick, TEAM), label)
def test_the_first_label_by_name_stands_for_a_repo_the_table_names_twice(self) -> None:
self.assertEqual(label_of(Repo("core-4"), {"core": "core-4", "core-4": "core-4"}), "core")
def test_a_pick_by_claude_is_labelled_with_the_teams_label_and_no_repo_label(self) -> None:
picked(self.store, self.issue(), TEAM, RULE, RUNG, says({"pick": "repo", "repo": "tenant-web-ui-4"}), "/rules")
self.assertEqual(self.issue().labels, ("api", "twu-4"))
def test_a_recorded_answer_is_labelled_the_same_way(self) -> None:
self.assertEqual((record(self.store, self.issue(), Repo("core-4"), TEAM), self.issue().labels), (Repo("core-4"), ("api", "core-4")))
self.assertEqual(record(self.store, self.issue(), Repo("api-3"), TEAM), Repo("api-3"))
self.assertEqual(self.issue().labels, ("api", "core-4", "repo:api-3"))
def test_a_label_with_the_prefix_alone_is_no_pick(self) -> None:
self.store.add_label(self.key, "repo:")
self.assertIsNone(recorded(self.issue(), {}))