Test a refused ranking and the hint for a bare repo name

This commit is contained in:
2026-11-19 04:57:47 +01:00
parent 194e3e18ad
commit 5f4bbdcbe0
+12 -2
View File
@@ -138,12 +138,13 @@ class Planning(DoEpicTest):
def test_asks_the_human_for_the_label_of_an_issue_the_rule_leaves_unclear_until_one_is_typed(self) -> None:
self.issues = [issue("ABC-20")]
fake = FakeEffects(claude=[says({"parts": []}), says({"pick": "unclear", "question": "Is the importer in api or in web?"})], inputs=["api", " repo:web "])
fake = FakeEffects(claude=[says({"parts": []}), says({"pick": "unclear", "question": "Is the importer in api or in web?"})], inputs=["api", "a b", " repo:web "])
found, store, out = self.plan(fake)
self.assertEqual(found, [issue("ABC-20", "repo:web")])
self.assertIn("ABC-20, Do ABC-20: Is the importer in api or in web?\n", self.asked.getvalue())
self.assertIn("`api` is none of those labels; the repo api's label is `repo:api`\n", self.asked.getvalue())
self.assertEqual(fake.made("input"), ["The label that says where ABC-20 is worked, `repo:<name>`, `do-epic-claude` or `do-epic-human`, or Enter alone to leave it waiting: "] * 2)
self.assertIn("`a b` is none of those labels\n", self.asked.getvalue())
self.assertEqual(fake.made("input"), ["The label that says where ABC-20 is worked, `repo:<name>`, `do-epic-claude` or `do-epic-human`, or Enter alone to leave it waiting: "] * 3)
def unclear_then_claudes(self, **fake: object) -> tuple[dict[str, tuple[str, ...]], str]:
"""The labels and the output after planning ABC-20, which the rule leaves unclear, and ABC-21, which is Claude's, on a FakeEffects made with fake."""
@@ -300,6 +301,15 @@ class Planning(DoEpicTest):
found, stopped = self.planned_on(Lagging("ABC-12", list(self.issues)), FakeEffects(claude=[says({"parts": []}), says({"pick": "claude"}), parts]))
self.assertEqual(([(each.key, each.labels) for each in found], stopped), ([("ABC-21", ("do-epic-claude",)), ("ABC-20", ("do-epic-claude",)), ("ABC-22", ("split-by-repo",))], None))
def test_keeps_the_order_and_says_why_where_the_tracker_refuses_the_ranking(self) -> None:
self.description = RANKED
self.issues = [scored("ABC-20", "epic 1 by 2", "do-epic-claude"), scored("ABC-21", "epic 1 by 9", "do-epic-claude")]
store = MemoryEpic("ABC-12", list(self.issues))
store.fails = "Jira answered 503"
found, stopped = self.planned_on(store, FakeEffects())
assert isinstance(stopped, Failure), stopped
self.assertEqual(([each.key for each in found], "Jira answered 503" in stopped.reason), (["ABC-20", "ABC-21"], True))
def test_an_issue_without_a_pick_is_not_ranked(self) -> None:
self.description = RANKED
self.issues = [scored("ABC-20", "epic 1 by 2", "do-epic-claude"), scored("ABC-21", "code health by 9")]