Record do-epic's repo picks and sub-task summaries in the team's own spelling
CI / tests (pull_request) Failing after 2m33s

This commit is contained in:
Lilleman
2026-11-20 09:10:55 +01:00
parent e9e11f10a0
commit 15c978b708
9 changed files with 130 additions and 23 deletions
+13 -5
View File
@@ -61,8 +61,16 @@ class Unclear:
Pick = Repo | ClaudeWork | HumanTask
def label_of(pick: Pick) -> str:
return f"{REPO_PREFIX}{pick.name}" if isinstance(pick, Repo) else CLAUDE_LABEL if isinstance(pick, ClaudeWork) else HUMAN_LABEL
def team_label(repo: str, team: LabelRepos) -> str | None:
"""The team's label for the repo: the first by name where the table maps several labels to it, None where it names none."""
return min((label for label, name in team.items() if name == repo), default=None)
def label_of(pick: Pick, team: LabelRepos) -> str:
"""The label that records the pick: for a repo the team's own, and `repo:<name>` only where the team's table doesn't name it."""
if isinstance(pick, Repo):
return team_label(pick.name, team) or f"{REPO_PREFIX}{pick.name}"
return CLAUDE_LABEL if isinstance(pick, ClaudeWork) else HUMAN_LABEL
def recorded(issue: EpicIssue, team: LabelRepos) -> Pick | None | Failure:
@@ -100,12 +108,12 @@ def picked(store: EpicStore, issue: EpicIssue, team: LabelRepos, rule: str, rung
answer = answer_of(structured_output(reply))
if isinstance(answer, Failure | Unclear):
return answer
return record(store, issue, answer)
return record(store, issue, answer, team)
def record(store: EpicStore, issue: EpicIssue, pick: Pick) -> Pick | Failure:
def record(store: EpicStore, issue: EpicIssue, pick: Pick, team: LabelRepos) -> Pick | Failure:
"""pick, once the issue is labelled with it."""
added = store.add_label(issue.key, label_of(pick))
added = store.add_label(issue.key, label_of(pick, team))
return added if isinstance(added, Failure) else pick