This commit is contained in:
@@ -15,6 +15,7 @@ from do_epic.epic_record import parallel_chunks_in
|
||||
from loop_claude.cycle import prompts
|
||||
from model_routing.route import Route
|
||||
from model_routing.ladder import Rung
|
||||
from project_config import settings
|
||||
from agent_cycle import tmux
|
||||
|
||||
|
||||
@@ -314,6 +315,9 @@ class StartingAnEpicsChunks(unittest.TestCase):
|
||||
self.assertRegex(found.reason, f"^cannot lock {self.home}/.local/state/do-epic/ABC-12: \\w")
|
||||
|
||||
|
||||
CONFIG = settings.ProjectConfig("api", pathlib.Path("/c/api"), pathlib.Path("/code/api"), {"changelog": pathlib.Path("/code/api/CHANGELOG.md")}, epic=settings.Epic("https://acme.atlassian.net", "API-1"))
|
||||
|
||||
|
||||
class TheFirstPrompt(unittest.TestCase):
|
||||
def test_the_task_names_the_checkout_and_branch_and_quotes_a_description_only_where_there_is_one(self) -> None:
|
||||
labels = "`repo:<name>` for the repo that works it, `do-epic-claude` for work of Claude's that changes no repo, or `do-epic-human` for a task of the human's"
|
||||
@@ -322,7 +326,32 @@ class TheFirstPrompt(unittest.TestCase):
|
||||
"Where filing fails and says the issue may exist, ask the human to look before you file it again. File a finding about a repo's goals by that repo's rules. Where unsure which, ask the human. "
|
||||
"Record a decision that governs the epic, such as an answer the human typed, with `/b/do-epic ABC-12 --record-decision \"<title>\"` and its text on stdin. Write the issue and the decision in Swedish, the epic's language."
|
||||
)
|
||||
self.assertEqual(chunk_prompt.task(issue("ABC-20"), "ABC-12", "/code/api", pathlib.Path("/b/do-epic"), "Swedish"), f"Work the Jira issue ABC-20 of the epic ABC-12 as one chunk, in the checkout /code/api, on the branch ABC-20. {told} Its summary: Do ABC-20")
|
||||
task = chunk_prompt.task(issue("ABC-20"), "ABC-12", "/code/api", pathlib.Path("/b/do-epic"), "Swedish", CONFIG)
|
||||
self.assertTrue(task.startswith(f"Work the Jira issue ABC-20 of the epic ABC-12 as one chunk, in the checkout /code/api, on the branch ABC-20. {told} "))
|
||||
self.assertTrue(task.endswith(" Its summary: Do ABC-20"))
|
||||
|
||||
def test_a_chunk_without_a_repo_is_told_nothing_of_shipping(self) -> None:
|
||||
task = chunk_prompt.task(issue("ABC-20"), "ABC-12", None, pathlib.Path("/b/do-epic"), "Swedish", None)
|
||||
self.assertTrue(task.endswith("Swedish, the epic's language. Its summary: Do ABC-20"))
|
||||
self.assertNotIn("--finish", task)
|
||||
|
||||
def test_a_repo_with_a_plan_file_is_told_to_add_a_bullet_to_its_changelog_where_it_publishes(self) -> None:
|
||||
config = settings.ProjectConfig("api", pathlib.Path("/c/api"), pathlib.Path("/code/api"), {"changelog": pathlib.Path("/code/api/CHANGELOG.md")})
|
||||
told = chunk_prompt.shipping(config)
|
||||
self.assertTrue(told.startswith("The issue isn't an item of the repo's plan, so run `chunk-pr merge` without `--finish`."))
|
||||
self.assertIn("Where the repo publishes something others consume, add one bullet to `## Unreleased` in `CHANGELOG.md`", told)
|
||||
|
||||
def test_a_changelog_outside_the_checkout_or_on_a_page_is_named_as_the_config_spells_it(self) -> None:
|
||||
config = settings.ProjectConfig("api", pathlib.Path("/c/api"), pathlib.Path("/code/api"), {"changelog": pathlib.Path("/c/api/CHANGELOG.md")})
|
||||
self.assertIn("in `/c/api/CHANGELOG.md`", chunk_prompt.shipping(config))
|
||||
paged = settings.ProjectConfig("api", pathlib.Path("/c/api"), pathlib.Path("/code/api"), {}, pages={"changelog": settings.Page("https://acme.atlassian.net", "7", "confluence:https://acme.atlassian.net/wiki/pages/7")})
|
||||
self.assertIn("in `confluence:https://acme.atlassian.net/wiki/pages/7`", chunk_prompt.shipping(paged))
|
||||
|
||||
def test_a_repo_with_its_plan_in_jira_is_told_to_leave_the_changelog_as_it_is(self) -> None:
|
||||
told = chunk_prompt.shipping(CONFIG)
|
||||
self.assertTrue(told.startswith("The issue isn't an item of the repo's plan, so run `chunk-pr merge` without `--finish`."))
|
||||
self.assertIn("leave the changelog as it is", told)
|
||||
self.assertNotIn("## Unreleased", told)
|
||||
|
||||
def test_an_answer_the_judge_quoted_names_the_epics_description_first(self) -> None:
|
||||
self.assertTrue(chunk_prompt.WORKER.answered("Q", "A", Route(Rung("off-the-ladder")), None, False).startswith("Your question: Q\n\nthe epic's description, "))
|
||||
@@ -339,7 +368,7 @@ class TheFirstPrompt(unittest.TestCase):
|
||||
class WindowsAcrossSessions(unittest.TestCase):
|
||||
def test_lists_each_window_with_its_session_and_root(self) -> None:
|
||||
run = Tmux(("epic-ABC-12", "ABC-20 ?", False, "/code/api"), ("loop-api", "item-3", True, ""))
|
||||
self.assertEqual(tmux.everywhere(run), [tmux.Placed("epic-ABC-12", tmux.Listed("ABC-20", "@0", False), "/code/api"), tmux.Placed("loop-api", tmux.Listed("item-3", "@1", True), "")])
|
||||
self.assertEqual(tmux.everywhere(run), [tmux.Placed("epic-ABC-12", tmux.Listed("ABC-20", "@0", False, asks=True), "/code/api"), tmux.Placed("loop-api", tmux.Listed("item-3", "@1", True), "")])
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user