Answer prose round 1: 0 🔴, 9 🟡 (0 misread); reword split.py's docstrings, prompt and failure messages, and test the repeated comment
CI / tests (pull_request) Failing after 2m56s

This commit is contained in:
2026-11-18 17:33:46 +01:00
parent 2241ec9b37
commit 2d76216a00
5 changed files with 52 additions and 33 deletions
+14 -5
View File
@@ -21,9 +21,10 @@ TWO = {"parts": [{"repo": "api", "change": "Serve the count."}, {"repo": "web",
class Flaky(MemoryEpic):
"""An epic that, while jammed is set, files no sub-task after the first under an issue."""
jammed = False
fails_files = False
def file(self, parent: str, summary: str, detail: str, labels: tuple[str, ...]) -> str | Failure:
return Failure("Jira answered 500") if self.jammed and any(issue.parent == parent for issue in self.issues) else super().file(parent, summary, detail, labels)
return Failure("Jira answered 500") if self.fails_files or self.jammed and any(issue.parent == parent for issue in self.issues) else super().file(parent, summary, detail, labels)
class Split_(unittest.TestCase):
@@ -82,11 +83,18 @@ class Split_(unittest.TestCase):
self.assertEqual(self.run_split(claude), Split((), ()))
self.assertEqual((claude.calls, self.tasks()), ([], []))
def test_a_first_filing_that_fails_after_the_comment_posts_the_comment_again_on_the_next_run(self) -> None:
self.store.fails_files = True
self.assertIsInstance(self.run_split(says(TWO), by_person=True), Failure)
self.store.fails_files = False
self.run_split(says(TWO), by_person=True)
self.assertEqual(self.store.comments[self.key], ["Delat per repo: api och web."] * 2)
def test_a_failed_filing_names_what_was_filed_and_a_second_run_files_only_the_rest(self) -> None:
self.store.jammed = True
failed = self.run_split(says(TWO), by_person=True)
first = self.tasks()[0].key
self.assertEqual(failed, Failure(f"split {self.key} only as far as {first}: Jira answered 500; run it again to file the rest"))
self.assertEqual(failed, Failure(f"cannot file the sub-task for web under {self.key}: Jira answered 500; this run filed {first}; run split again to file the rest"))
self.assertEqual(self.issue().labels, ("api",))
self.store.jammed = False
done = self.run_split(says(TWO), by_person=True)
@@ -102,13 +110,14 @@ class Split_(unittest.TestCase):
self.assertEqual(args[12], "/repos/web")
self.assertIn(RULE, prompt)
self.assertIn("## Item ABC-100: Count the runs.", prompt)
self.assertIn("Write each part's change and the comment in Swedish.", prompt)
self.assertIn("Leave the comment out.", prompt)
self.assertIn("write each part's change in Swedish.", prompt)
self.assertIn("Give no comment.", prompt)
self.assertTrue(prompt.rstrip().endswith("Why it counts."))
def test_asks_a_persons_issue_for_a_comment(self) -> None:
claude = says(TWO)
self.run_split(claude, by_person=True)
self.assertIn("The item is a person's issue: give a comment", claude.calls[0][2])
self.assertIn("The item is a person's issue: also give a comment, in Swedish,", claude.calls[0][2])
def test_fails_on_an_answer_without_parts_or_with_a_repo_name_that_is_a_path(self) -> None:
for output in ({}, {"parts": "api"}, {"parts": [{"repo": "../x", "change": "c"}]}, {"parts": [{"repo": "api"}]}, {"parts": [3]}):