Test do-epic's chunk run in a repo, its stops and its judge model
This commit is contained in:
@@ -60,7 +60,7 @@ class DoEpicTest(unittest.TestCase):
|
||||
|
||||
class TheCommand(DoEpicTest):
|
||||
def test_prints_the_help_for_anything_but_one_epic_key(self) -> None:
|
||||
for argv, code in ((["--help"], 0), (["-h"], 0), ([], 1), (["abc"], 1), (["ABC-12", "ABC-13"], 1), (["--chunk", "x", "ABC-12"], 1)):
|
||||
for argv, code in ((["--help"], 0), (["-h"], 0), ([], 1), (["abc"], 1), (["ABC-12", "ABC-13"], 1), (["--chunk", "x", "ABC-12"], 1), (["--chunk", "ABC-12"], 1)):
|
||||
with self.subTest(argv=argv):
|
||||
ran_code, out, err = self.run_main(argv, FakeEffects())
|
||||
self.assertEqual((ran_code, (err if code else out).split(" ", 1)[1]), (code, main.HELP + "\n"))
|
||||
@@ -123,6 +123,7 @@ class ACycleOfAChunkWithoutARepo(DoEpicTest):
|
||||
self.assertEqual(cycle.route, Route(cycle.project.worker_rung(3), 21, 3, 5))
|
||||
self.assertEqual(cycle.judge.model, "claude-opus-5-5")
|
||||
self.assertEqual(self.cycle({"LOOP_CLAUDE_WORKER_MODEL": "off-the-ladder"}).route, Route(Rung("off-the-ladder")))
|
||||
self.assertEqual(self.cycle({"LOOP_CLAUDE_JUDGE_MODEL": "claude-fable-5-2"}).judge.model, "claude-fable-5-2")
|
||||
|
||||
def test_works_in_the_epics_folder_and_archives_apart_from_loop_claude(self) -> None:
|
||||
cycle = self.cycle()
|
||||
@@ -256,6 +257,7 @@ class AChunksRun(DoEpicTest):
|
||||
checkout = self.home / "code" / "api"
|
||||
configured(self, checkout, home=self.home)
|
||||
(checkout / "README.md").write_text("## Goals\nServe the API.\n\n## Audience\nIts callers.\n", encoding="utf-8")
|
||||
(checkout / "AGENTS.md").write_text("Squash every merge.\n", encoding="utf-8")
|
||||
self.issues = [dataclasses.replace(issue("ABC-20", "repo:api"), scores={"L": 2, "E": 1, "I": 1})]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD)
|
||||
code, out, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS)
|
||||
@@ -265,6 +267,23 @@ class AChunksRun(DoEpicTest):
|
||||
self.assertIn("Ship the import.", prompt)
|
||||
self.assertIn("The repo's goals, which rank after the epic's and after code health, are from", prompt)
|
||||
self.assertIn("Serve the API.", prompt)
|
||||
self.assertIn("the chunk finished; started no other\n", out)
|
||||
self.assertIn("Squash every merge.", [what[1] for seam, what in fake.calls if seam == "claude"][0])
|
||||
|
||||
def test_a_chunk_in_a_repo_without_premises_stops(self) -> None:
|
||||
configured(self, self.home / "code" / "api", home=self.home)
|
||||
self.issues = [issue("ABC-20", "repo:api")]
|
||||
code, _, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], FakeEffects(git=UNREAD), MODELS)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("README.md is missing or empty - no premises.\n", err)
|
||||
|
||||
def test_a_chunk_stops_where_the_epics_issues_cannot_be_read(self) -> None:
|
||||
store = MemoryEpic("ABC-12", [])
|
||||
store.read = lambda: Failure("Jira answered 503") # type: ignore[method-assign]
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
code, _, err = self.run_main(["--chunk", "ABC-21", "ABC-12"], FakeEffects(), MODELS)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("Jira answered 503\n", err)
|
||||
|
||||
def test_a_chunk_whose_repo_or_premises_cannot_be_read_stops(self) -> None:
|
||||
self.issues = [issue("ABC-20", "repo:api"), issue("ABC-23", "repo:api", "repo:web")]
|
||||
@@ -296,6 +315,7 @@ class WhatAWorkerJudgeAndHumanRead(DoEpicTest):
|
||||
for text in texts:
|
||||
self.assertNotIn("loop-claude", text)
|
||||
self.assertIn(f"do-epic runs you on {cycle.route.rung}, routed by the issue's L of 3. Where a sentence below names item 21, it means the issue.", texts[0])
|
||||
self.assertRegex(texts[0], r"it means the issue\.( \S|\n\n)")
|
||||
self.assertNotIn("Chunk items:", texts[1])
|
||||
# The worker's prompt and the judge's rules word the request for a higher rung alike, from one place.
|
||||
for text in (texts[0], texts[3]):
|
||||
|
||||
@@ -185,7 +185,7 @@ class StartingAnEpicsChunks(unittest.TestCase):
|
||||
(self.home / ".local/state/do-epic/ABC-12").write_text("", encoding="utf-8")
|
||||
found = start_chunks(self.epic(1, api=1), [issue("ABC-20", "repo:api")], None, Tmux())
|
||||
assert isinstance(found, Failure)
|
||||
self.assertRegex(found.reason, f"^cannot lock {self.home}/.local/state/do-epic/ABC-12(/starting)?: \\w")
|
||||
self.assertRegex(found.reason, f"^cannot lock {self.home}/.local/state/do-epic/ABC-12: \\w")
|
||||
|
||||
|
||||
class TheFirstPrompt(unittest.TestCase):
|
||||
@@ -208,7 +208,7 @@ class WindowsAcrossSessions(unittest.TestCase):
|
||||
self.assertEqual(run.calls, [["list-windows", "-a", "-F", f"#{{session_name}}\t#{{window_name}}\t#{{pane_dead}}\t#{{window_id}}\t#{{{tmux.ROOT}}}"]])
|
||||
|
||||
def test_without_a_tmux_server_there_are_none(self) -> None:
|
||||
self.assertEqual(tmux.everywhere(lambda args: subprocess.CompletedProcess(args, 1, "no server running\n", "")), [])
|
||||
self.assertEqual(tmux.everywhere(lambda args: subprocess.CompletedProcess(args, 1, "epic-ABC-12\tABC-20\t0\t@0\t/code/api\n", "")), [])
|
||||
|
||||
def test_a_started_chunk_joins_the_sessions_windows_as_running(self) -> None:
|
||||
found = tmux.start_chunk(tmux.Window("epic-ABC-12", "ABC-20", ""), "/code/api", {}, ["do-epic"], [tmux.Listed("ABC-20", "@0", True), tmux.Listed("ABC-21", "@1", False)], False, Tmux(("epic-ABC-12", "ABC-20", True, "/code/api"), ("epic-ABC-12", "ABC-21", False, "/code/api")))
|
||||
|
||||
Reference in New Issue
Block a user