diff --git a/bin/do_epic/findings.py b/bin/do_epic/findings.py index 87182108..7a87bf2a 100644 --- a/bin/do_epic/findings.py +++ b/bin/do_epic/findings.py @@ -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:` 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:` 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}` 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} \"\" {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} \"\" {LABEL}