Name the team's label for each repo in do-epic's finding and release-review prompts #659

Merged
lilleman merged 9 commits from item-468 into main 2026-11-20 13:52:30 +01:00
8 changed files with 88 additions and 26 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- do-epic names the team's own label for each repo, from the `[label-repos]` table, when it tells a chunk's worker how to file a finding or a release review, and keeps `repo:<name>` for a repo the table doesn't name.
- do-epic records a repo pick, and the summary of each sub-task it files, in the team's own spelling: a label from the `[label-repos]` table of its config, and a `sub-task-summary` template with `{label}` and `{Summary}`.
- Add `do-epic <EPIC-KEY> --dry-run`, which prints every Jira write planning would make and each chunk that would start, and makes none of them.
- The stability reviewer checks each parser that splits text on a separator or strips a suffix against a value that holds the separator, and reports a row the parse misplaces or drops.
+16 -8
View File
@@ -7,7 +7,7 @@ import fcntl
import pathlib
import typing
from do_epic.repo_pick import also, CLAUDE_LABEL, HUMAN_LABEL, LabelRepos, of_label, REPO_PREFIX, REVIEW_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
@@ -20,15 +20,22 @@ LABEL = "--label"
BLOCKED_BY = "--blocked-by"
PARENT = "--parent"
RECORD_DECISION = "--record-decision"
# The labels that say where an issue is worked, as do-epic's scheduler reads them.
LABELS = f"`{REPO_PREFIX}<name>` for the repo that works it, `{CLAUDE_LABEL}` for work of Claude's that changes no repo, or `{HUMAN_LABEL}` for a task of the human's"
def worked_by(team: LabelRepos) -> str:
"""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"
# Under the epic's folder, the file a do-epic holds locked while it appends a decision.
DECISIONS_LOCK = "decisions.lock"
USAGE = f"""do-epic <EPIC-KEY> {FILE} <summary> [{LABEL} <label>]... [{BLOCKED_BY} <KEY>] [{PARENT} <KEY>] [<<'EOF' detail EOF]
do-epic <EPIC-KEY> {RECORD_DECISION} <title> <<'EOF' entry EOF"""
HELP = f"""{FILE} files a finding about one of the epic's goals as an open issue of the epic, with the markdown piped in as its description.
A finding about a repo's own goals goes into that repo's plan instead.
{LABEL} is {LABELS}; without one, the next `do-epic <EPIC-KEY>` you run picks where the issue is worked.
{LABEL} is {worked_by({})}; without one, the next `do-epic <EPIC-KEY>` you run picks where the issue is worked.
A second {LABEL}, `{REVIEW_LABEL}`, marks the issue as a repo's release review, which the epic's finishing files.
{BLOCKED_BY} <KEY> makes the new issue wait for the issue <KEY>, which is a child issue of the epic or a sub-task of one.
{PARENT} <KEY> files the new issue as a sub-task of the child issue <KEY>.
@@ -41,11 +48,12 @@ 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. "
f"The label is {LABELS}; leave it out where you cannot tell, and the next `do-epic` the human runs picks it. "
f"The label is {worked_by(team)}; leave it out where you cannot tell, and the next `do-epic` the human runs picks it. "
"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. "
f"Record a decision that governs the epic, such as an answer the human typed, with `{launcher} {epic} {RECORD_DECISION} \"<title>\"` and its text on stdin. "
@@ -96,13 +104,13 @@ def written(epic: str, write: Write, store: EpicStore, team: LabelRepos, record:
flag, value, labels = write.flag, write.value, write.labels
if flag == FILE:
if unread := [label for label in labels if of_label(label, team) is None and label != REVIEW_LABEL]:
return Failure(f"cannot file the finding in the epic {epic}: do-epic doesn't read the label {unread[0]!r}; write {LABELS}{also(team)}")
return Failure(f"cannot file the finding in the epic {epic}: do-epic doesn't read the label {unread[0]!r}; write {worked_by(team)}")
if len(picks := [label for label in labels if of_label(label, team)]) > 1:
return Failure(f"cannot file the finding in the epic {epic}: {listed(picks, 'and')} each say who works it; write one of them")
key = store.file(write.parent or epic, value, text, labels, write.blocked_by)
if isinstance(key, Failure):
return Failure(f"cannot file the finding in the epic {epic}: {key.reason}")
return f"Filed {key} {f'under {write.parent} in ' if write.parent else 'in '}the epic {epic}." + (f" It is blocked by {write.blocked_by}." if write.blocked_by else "") + ("" if any(of_label(label, team) for label in labels) else f" It has no label that says where it is worked, so the next `do-epic {epic}` picks one: {LABELS}.")
return f"Filed {key} {f'under {write.parent} in ' if write.parent else 'in '}the epic {epic}." + (f" It is blocked by {write.blocked_by}." if write.blocked_by else "") + ("" if any(of_label(label, team) for label in labels) else f" It has no label that says where it is worked, so the next `do-epic {epic}` picks one: {worked_by(team)}.")
try:
with decisions_locked(folder):
added = record.append_decision(value, text)
+3 -2
View File
@@ -15,7 +15,7 @@ from do_epic.backend.protocol import EpicIssue, EpicStore
from failure import Failure
from do_epic import findings
from do_epic.split import finished
from do_epic.repo_pick import LabelRepos, recorded, Repo, REPO_PREFIX, REVIEW_LABEL
from do_epic.repo_pick import label_of, LabelRepos, recorded, Repo, REVIEW_LABEL
from text_files.markdown_text import listed
from text_files.piped_text import piped
@@ -57,7 +57,8 @@ def task(epic: str, issues: list[EpicIssue], team: LabelRepos, launcher: pathlib
if lacking := unreviewed(issues, team):
return (
f"{opening} Each repo the epic changed takes a release review first, and {listed(lacking, 'and')} {'has' if len(lacking) == 1 else 'have'} none. "
f"File one issue per such repo, with `{launcher} {epic} {findings.FILE} \"<summary>\" {findings.LABEL} {REPO_PREFIX}<name> {findings.LABEL} {REVIEW_LABEL}` and its detail on stdin, both in {language}, the epic's language. "
f"File one issue per such repo, with `{launcher} {epic} {findings.FILE} \"<summary>\" {findings.LABEL} <label> {findings.LABEL} {REVIEW_LABEL}` and its detail on stdin, both in {language}, the epic's language. "
f"The `<label>` is {listed([f'`{label_of(Repo(name), team)}` for {name}' for name in lacking], 'and')}. "
f"The detail asks for a release review of the whole repo, as the epic's issues left it: the one `~/.claude/skills/larv-review/SKILL.md` → \"Release review\" describes. The epic's key stands in place of the release there, so the review's branch opens with an empty commit titled `Release review of {epic}`. "
"Where filing fails and says the issue may exist, ask the human to look before you file it again. "
f"The chunk is finished once each issue is filed: {DRIVER} works them, and starts this chunk again once the epic holds no open issue."
+17 -1
View File
@@ -93,7 +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("or `do-epic-human` for a task of the human's (or the team's `twu-4`)\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(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"])
@@ -155,6 +157,20 @@ class Instructions(unittest.TestCase):
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)
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):
def test_appends_the_entry_to_the_descriptions_decisions(self) -> None:
+7 -1
View File
@@ -54,11 +54,17 @@ class TheFinishingChunksTask(DoEpicTest):
self.assertIn("Finish the epic ABC-12", task)
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 repo:<name> --label do-epic-release-review`', task)
self.assertIn('`/b/do-epic ABC-12 --file "<summary>" --label <label> --label do-epic-release-review`', task)
self.assertIn("`Release review of ABC-12`", task)
self.assertIn("in Swedish", task)
self.assertNotIn("--close-epic", task)
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)
self.assertIn("The `<label>` is `twu-4` for tenant-web-ui-4. ", finish.task("ABC-12", done[:1], {"twu-4": "tenant-web-ui-4", "web": "tenant-web-ui-4"}, LAUNCHER, "Swedish"))
def test_then_has_the_human_confirm_each_goal_before_the_summary_and_the_closing(self) -> None:
task = finish.task("ABC-12", REVIEWED, {}, LAUNCHER, "Swedish")
self.assertIn("Finish the epic ABC-12", 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)
+41
View File
@@ -3130,3 +3130,44 @@ Read most (opens and searches):
- `bin/claude_code/reply.py` 2
- `bin/loop_claude/loop/main.py` 2
- `bin/loop_claude/loop/usage.py` 2
## Reading cost, chunk 8b39330f66f0, finished 2026-11-20T08:17:51Z
64149 new input tokens before the first commit.
Read most (opens and searches):
- `agents/stability-reviewer.md` 2
## Reading cost, chunk 6bfa5e67ef2f, finished 2026-11-20T09:55:09Z
140577 new input tokens before the first commit.
Read most (opens and searches):
- `README.md` 11
- `bin/do_epic/scheduler.py` 6
- `bin/do_epic/main.py` 5
- `bin/do_epic/test_main.py` 5
- `bin/loop_effects/effects.py` 5
- `bin/agent_cycle/tmux.py` 4
- `bin/do_epic/repos.py` 4
- `bin/loop_effects/doubles.py` 4
- `bin/do_epic/planning.py` 3
- `bin/do_epic/status.py` 3
## Reading cost, chunk 5e454f713506, finished 2026-11-20T10:16:35Z
106445 new input tokens before the first commit.
Read most (opens and searches):
- `bin/do_epic/test_planning.py` 10
- `bin/do_epic/planning.py` 6
- `bin/do_epic/test_split.py` 5
- `bin/do_epic/split.py` 4
- `README.md` 3
- `bin/do_epic/config.py` 3
- `bin/do_epic/repo_pick.py` 3
- `bin/do_epic/test_do_epic.py` 2
- `bin/do_epic/test_repo_pick.py` 2
+1 -14
View File
@@ -15,9 +15,8 @@
| 469 | 0.15.0 | | | **Move a do-epic parent issue whose sub-tasks a person filed to Release Ready once every sub-task has landed, and to Done once every sub-task is done, by transitions its config names.** | 3 | 2 | 2 | 5 | 4 | 1.2 by 4, 1.5 by 4, 1.6 by 3 | 3.1 |
| 453 | 0.15.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 |
| 470 | 0.15.0 | | | **Start an epic's runnable issues in order of score alone, scoring each open issue that holds no scores, the ones people filed included, so Jira's backlog order no longer decides what starts.** | 3 | 2 | 2 | 5 | 5 | 1.2 by 4, 1.6 by 3 | 1.5 |
| 468 | 0.15.0 | | | **Tell a do-epic worker the team's own label for each repo when it files a finding or a release-review issue, so those issues carry the label the team's board uses.** | 2 | 2 | 2 | 4 | 2 | 1.6 by 4 | 1.4 |
| 454 | 0.15.0 | | | **Start a do-epic chunk's issue as the team's board expects, by settings: assigned to the account do-epic works as, moved by a start transition and added to a board's active sprint.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 4 | 1.1 |
| 467 | 0.15.0 | 453, 454, 468, 469, 470 | question | **Cut 0.15.0 as soon as items 449, 450, 453, 454, 468, 469 and 470 have merged, before its release review, and run that review in 0.15.1.** | 1 | 1 | 1 | 1 | 1 | | 0.0 |
| 467 | 0.15.0 | 453, 454, 469, 470 | question | **Cut 0.15.0 as soon as items 449, 450, 453, 454, 468, 469 and 470 have merged, before its release review, and run that review in 0.15.1.** | 1 | 1 | 1 | 1 | 1 | | 0.0 |
| 446 | 0.16.0 | | question | **Kill the process a stuck check names where its verdict is `stuck`, once the human says the recorded verdicts match what they would have done.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 3 | 1.0 |
| 462 | 0.16.0 | | | **Run under `mutate-changes` the tests that today fail in mutmut's copy of the tree, so a mutant of a line only they cover is killed.** | 2 | 1 | 2 | 3 | 3 | code health by 3 | 4.7 |
| 77 | 0.16.0 | | | **Teach `bin/metric-bench` Go and TypeScript, rerun it once two projects' comprehension histories name places, and bring into review only a metric that tracks the panel.** | 4 | 2 | 1 | 5 | 6 | 1.1 by 7, 1.4 by 7 | 2.1 |
@@ -151,18 +150,6 @@ Touches:
- `bin/do_epic/test_do_epic.py`
- `README.md`: `### Set up a project` (small)
### 468. Tell a do-epic worker the team's own label for each repo when it files a finding or a release-review issue, so those issues carry the label the team's board uses.
Item 449 makes do-epic record a repo pick, and each sub-task it files, under the team's own label from the `[label-repos]` table (`repo_pick.label_of(pick, team)`). The instructions do-epic gives a chunk's worker still name only `repo:<name>`: `LABELS` in `bin/do_epic/findings.py` (used in `HELP` at findings.py:31, in `instructions` at :48, and in `written`'s refusal at :99 and its reply at :105) and the `--file ... --label repo:<name> --label do-epic-release-review` command in `finish.task` at `bin/do_epic/finish.py:60`. A team whose board uses its own labels therefore still gets a finding or a release review labelled `repo:core-4` where it expects `core-4`.
Give both prompts the team's label for each repo of the table where the table names it (`repo_pick.team_label`, `also`), and keep `repo:<name>` for a repo the table doesn't name. `finish.task` already knows each repo that lacks its review, so it can name each one's label outright, as `label_of(Repo(name), team)` gives it. The README states the pick's spelling (`repo-rule.md`'s bullet) but not the finding's, so it needs no change.
Touches:
- `bin/do_epic/findings.py`: `LABELS`, `instructions` (small), `written` (small)
- `bin/do_epic/finish.py`: `task` (small)
- `bin/do_epic/test_findings.py`: `Instructions`
- `bin/do_epic/test_finish.py`: `TheFinishingChunksTask`
### 454. Start a do-epic chunk's issue as the team's board expects, by settings: assigned to the account do-epic works as, moved by a start transition and added to a board's active sprint.
When a do-epic chunk starts, its issue stays as Jira holds it: unassigned, in New and outside the sprint. A team whose board shows who works on what, such as TW, where an issue being worked is assigned to the person, In Progress and in the active sprint, then sees nothing of the loop's work. Today each worker would have to do this by hand, from rules only some machines hold.