Answer stability round 1: 0 🔴, 1 🟡 (0 misread); pin the sentence once at worked_by, and the product-owner and prose fixes beside it

This commit is contained in:
Lilleman
2026-11-20 12:30:23 +01:00
parent ff16a80546
commit 868169ccb6
4 changed files with 23 additions and 13 deletions
+5 -4
View File
@@ -7,7 +7,7 @@ import fcntl
import pathlib
import typing
from do_epic.repo_pick import CLAUDE_LABEL, HUMAN_LABEL, LabelRepos, of_label, REPO_PREFIX, REVIEW_LABEL, team_label
from do_epic.repo_pick import CLAUDE_LABEL, HUMAN_LABEL, label_of, LabelRepos, of_label, REPO_PREFIX, REVIEW_LABEL, team_label
from do_epic.backend.protocol import EpicIssue, EpicStore
from do_epic.epic_record import EpicRecord
from failure import Failure
@@ -23,8 +23,8 @@ RECORD_DECISION = "--record-decision"
def worked_by(team: LabelRepos) -> str:
"""The labels that say where an issue is worked, as do-epic's scheduler reads them. Each repo the team's table names takes the team's label, and `repo:<name>` stays for any other."""
named = [f"`{label}` for the repo {name}" for name in dict.fromkeys(team.values()) if (label := team_label(name, team))]
"""The labels that say where an issue is worked, as do-epic's scheduler reads them: for each repo the team's table names, the label on its first line for that repo, and `repo:<name>` for any other repo."""
named = [f"`{label}` for the repo {name}" for name in sorted(set(team.values())) if (label := team_label(name, team))]
repos = ", ".join([*named, f"`{REPO_PREFIX}<name>` for {'any other repo' if named else 'the repo'} that works it"])
return f"{repos}, `{CLAUDE_LABEL}` for work of Claude's that changes no repo, or `{HUMAN_LABEL}` for a task of the human's"
@@ -48,7 +48,8 @@ def instructions(epic: str, launcher: pathlib.Path, language: str, team: LabelRe
next_step = ""
if issue:
parent = f" {PARENT} {issue.parent}" if issue.parent != epic else ""
label = next((f" {LABEL} {each}" for each in issue.labels if of_label(each, team)), "")
pick = next((found for each in issue.labels if (found := of_label(each, team))), None)
label = f" {LABEL} {label_of(pick, team)}" if pick else ""
next_step = f"Where the repo's rules ask for a change to ship as more than one pull request, finish only this issue's pull request, and file only the next one as an issue that waits for it, with `{launcher} {epic} {FILE} \"<summary>\" {BLOCKED_BY} {issue.key}{parent}{label}` and its detail on stdin. "
return (
f"File a finding about one of the epic's goals in the epic, with `{launcher} {epic} {FILE} \"<summary>\" {LABEL} <label>` and its detail on stdin. "
+15 -7
View File
@@ -93,9 +93,9 @@ class FilingAFinding(FindingsTest):
code, _, err, _ = self.run_with(["ABC-12", "--file", "Retry", "--label", "twu-4", "--label", "repo:api"])
self.assertEqual((code, err), (1, "cannot file the finding in the epic ABC-12: twu-4 and repo:api each say who works it; write one of them\n"))
_, _, err, _ = self.run_with(["ABC-12", "--file", "Retry", "--label", "twu"])
self.assertTrue(err.endswith("write `twu-4` for the repo tenant-web-ui-4, `repo:<name>` for any other 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\n"), err)
self.assertTrue(err.endswith(f"write {findings.worked_by({'twu-4': 'tenant-web-ui-4'})}\n"), err)
_, out, _, _ = self.run_with(["ABC-12", "--file", "Retry"])
self.assertTrue(out.endswith("picks one: `twu-4` for the repo tenant-web-ui-4, `repo:<name>` for any other 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.\n"), out)
self.assertTrue(out.endswith(f"picks one: {findings.worked_by({'twu-4': 'tenant-web-ui-4'})}.\n"), out)
def test_a_release_review_takes_its_label_beside_its_repo(self) -> None:
code, out, _, _ = self.run_with(["ABC-12", "--file", "Review api", "--label", "repo:api", "--label", "do-epic-release-review"])
@@ -156,12 +156,20 @@ class Instructions(unittest.TestCase):
told = findings.instructions("ABC-12", pathlib.Path("/b/do-epic"), "Swedish", {})
self.assertTrue(told.endswith("its text on stdin. Write the issue and the decision in Swedish, the epic's language."), told)
self.assertNotIn("--blocked-by", told)
self.assertIn("The label is `repo:<name>` for the repo that works it, `do-epic-claude`", told)
def test_name_the_teams_label_for_each_repo_its_table_names_and_repo_name_for_any_other(self) -> None:
told = findings.instructions("ABC-12", pathlib.Path("/b/do-epic"), "Swedish", {"core": "core-4", "twu-4": "tenant-web-ui-4", "c4": "core-4"})
self.assertIn("The label is `core` for the repo core-4, `twu-4` for the repo tenant-web-ui-4, `repo:<name>` for any other repo that works it, `do-epic-claude`", told)
self.assertNotIn("`c4`", told)
def test_name_the_labels_the_team_has_for_its_repos(self) -> None:
team = {"core": "core-4", "twu-4": "tenant-web-ui-4"}
self.assertIn(f"The label is {findings.worked_by(team)};", findings.instructions("ABC-12", pathlib.Path("/b/do-epic"), "Swedish", team))
class WorkedBy(unittest.TestCase):
def test_lists_repo_colon_name_alone_for_a_team_without_a_table(self) -> None:
self.assertEqual(findings.worked_by({}), "`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")
def test_lists_each_repo_the_table_names_once_by_the_first_label_for_it_in_the_order_of_the_repos(self) -> None:
named = findings.worked_by({"twu-4": "tenant-web-ui-4", "core": "core-4", "c4": "core-4"})
self.assertTrue(named.startswith("`core` for the repo core-4, `twu-4` for the repo tenant-web-ui-4, `repo:<name>` for any other repo that works it, `do-epic-claude`"), named)
self.assertNotIn("`c4`", named)
class RecordingADecision(FindingsTest):
+1 -2
View File
@@ -55,12 +55,11 @@ class TheFinishingChunksTask(DoEpicTest):
self.assertIn("first, and api and web have none. ", task)
self.assertIn("first, and api has none. ", finish.task("ABC-12", [issue("ABC-20", "repo:api", done=True)], {}, LAUNCHER, "Swedish"))
self.assertIn('`/b/do-epic ABC-12 --file "<summary>" --label <label> --label do-epic-release-review`', task)
self.assertIn("The `<label>` is `repo:api` for api and `repo:web` for web. ", task)
self.assertIn("`Release review of ABC-12`", task)
self.assertIn("in Swedish", task)
self.assertNotIn("--close-epic", task)
def test_names_each_lacking_repos_label_as_the_team_has_it_and_repo_name_for_one_the_table_lacks(self) -> None:
def test_names_each_unreviewed_repos_label_from_the_teams_table_else_repo_colon_name(self) -> None:
done = [issue("ABC-20", "twu-4", done=True), issue("ABC-21", "repo:web", done=True)]
task = finish.task("ABC-12", done, {"twu-4": "tenant-web-ui-4"}, LAUNCHER, "Swedish")
self.assertIn("The `<label>` is `twu-4` for tenant-web-ui-4 and `repo:web` for web. ", task)
+2
View File
@@ -426,6 +426,8 @@ class TheFirstPrompt(unittest.TestCase):
self.assertIn("--file \"<summary>\" --blocked-by ABC-23 --parent ABC-20 --label repo:api` and its detail on stdin.", task)
task = chunk_prompt.task(issue("ABC-20", "twu-4", "urgent"), "ABC-12", {"twu-4": "tenant-web-ui-4"}, "/code/api", pathlib.Path("/b/do-epic"), "Swedish", CONFIG)
self.assertIn("--file \"<summary>\" --blocked-by ABC-20 --label twu-4` and its detail on stdin.", task)
task = chunk_prompt.task(issue("ABC-20", "repo:tenant-web-ui-4"), "ABC-12", {"twu-4": "tenant-web-ui-4"}, "/code/api", pathlib.Path("/b/do-epic"), "Swedish", CONFIG)
self.assertIn("--file \"<summary>\" --blocked-by ABC-20 --label twu-4` and its detail on stdin.", task)
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)