Pass the repo's config to the task, so the no-repo case is tested where mutants run
CI / tests (pull_request) Failing after 5m5s
CI / tests (pull_request) Failing after 5m5s
This commit is contained in:
@@ -24,8 +24,9 @@ def shipping(config: ProjectConfig) -> str:
|
||||
return f"{opening} Where the repo publishes something others consume, ship the change with one bullet for its users under `## Unreleased` in {config.places['changelog']}, added in the branch; otherwise write none."
|
||||
|
||||
|
||||
def task(issue: EpicIssue, epic: str, checkout: str | None, launcher: pathlib.Path, language: str, shipped: str) -> str:
|
||||
"""The task of the chunk that works issue, of the epic with the key epic: in checkout, or without a repo where it is None. launcher is the do-epic that runs the chunk, language the one the epic's Jira text is in, and shipped how the chunk ships its change, which `shipping` words for a chunk in a repo and is empty without one."""
|
||||
def task(issue: EpicIssue, epic: str, checkout: str | None, launcher: pathlib.Path, language: str, config: ProjectConfig | None) -> str:
|
||||
"""The task of the chunk that works issue, of the epic with the key epic: in checkout, or without a repo where it is None. launcher is the do-epic that runs the chunk, language the one the epic's Jira text is in, and config the project config of the repo's checkout, None without a repo."""
|
||||
shipped = shipping(config) if config else ""
|
||||
where = f"in the checkout {checkout}, on the branch {issue.key}" if checkout else "which changes no repo: work in the folder you start in"
|
||||
return f"Work the Jira issue {issue.key} of the epic {epic} as one chunk, {where}. {findings.instructions(epic, launcher, language)}{f' {shipped}' if shipped else ''} Its summary: {issue.summary}" + (f"\n\nIts description:\n\n{issue.detail}" if issue.detail else "")
|
||||
|
||||
|
||||
+1
-1
@@ -421,7 +421,7 @@ def chunk_work(key: str, checkout: str | None, language: str, epic: EpicRun) ->
|
||||
config = config_located(checkout, epic.paths.home) if checkout else None
|
||||
if isinstance(config, Failure):
|
||||
return Stop(1, config.reason)
|
||||
return chunk_prompt.task(issue, epic.key, checkout, epic.launcher, language, chunk_prompt.shipping(config) if config else ""), RoutingIssue(issue) if "L" in issue.scores else None
|
||||
return chunk_prompt.task(issue, epic.key, checkout, epic.launcher, language, config), RoutingIssue(issue) if "L" in issue.scores else None
|
||||
issues = epic.store.read()
|
||||
if isinstance(issues, Failure):
|
||||
return Stop(1, issues.reason)
|
||||
|
||||
@@ -292,6 +292,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"
|
||||
@@ -300,19 +303,18 @@ 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", "Ship it so."), 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} Ship it so. Its summary: Do ABC-20")
|
||||
self.assertEqual(chunk_prompt.task(issue("ABC-20"), "ABC-12", "/code/api", pathlib.Path("/b/do-epic"), "Swedish", CONFIG), 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} The issue is no item of the repo's plan, so give `chunk-pr merge` no `--finish`. The repo's plan is a Jira epic, whose issues' history is its changelog, so write no changelog bullet. Its summary: Do ABC-20")
|
||||
|
||||
def test_a_chunk_without_a_repo_has_no_shipping_sentence(self) -> None:
|
||||
self.assertEqual(chunk_prompt.task(issue("ABC-20"), "ABC-12", None, pathlib.Path("/b/do-epic"), "Swedish", "").count(" "), 0)
|
||||
self.assertTrue(chunk_prompt.task(issue("ABC-20"), "ABC-12", None, pathlib.Path("/b/do-epic"), "Swedish", "").endswith("Swedish, the epic's language. Its summary: Do ABC-20"))
|
||||
self.assertEqual(chunk_prompt.task(issue("ABC-20"), "ABC-12", None, pathlib.Path("/b/do-epic"), "Swedish", None).count(" "), 0)
|
||||
self.assertTrue(chunk_prompt.task(issue("ABC-20"), "ABC-12", None, pathlib.Path("/b/do-epic"), "Swedish", None).endswith("Swedish, the epic's language. Its summary: Do ABC-20"))
|
||||
|
||||
def test_a_repo_with_a_plan_file_ships_the_chunk_with_a_bullet_in_its_changelog(self) -> None:
|
||||
config = settings.ProjectConfig("api", pathlib.Path("/c/api"), pathlib.Path("/code/api"), {"changelog": pathlib.Path("/code/api/CHANGELOG.md")})
|
||||
self.assertEqual(chunk_prompt.shipping(config), "The issue is no item of the repo's plan, so give `chunk-pr merge` no `--finish`. Where the repo publishes something others consume, ship the change with one bullet for its users under `## Unreleased` in /code/api/CHANGELOG.md, added in the branch; otherwise write none.")
|
||||
|
||||
def test_a_repo_with_its_plan_in_jira_ships_the_chunk_with_no_bullet(self) -> None:
|
||||
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"))
|
||||
self.assertEqual(chunk_prompt.shipping(config), "The issue is no item of the repo's plan, so give `chunk-pr merge` no `--finish`. The repo's plan is a Jira epic, whose issues' history is its changelog, so write no changelog bullet.")
|
||||
self.assertEqual(chunk_prompt.shipping(CONFIG), "The issue is no item of the repo's plan, so give `chunk-pr merge` no `--finish`. The repo's plan is a Jira epic, whose issues' history is its changelog, so write no changelog bullet.")
|
||||
|
||||
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, "))
|
||||
|
||||
Reference in New Issue
Block a user