Pick each epic item's repo by repo-rule.md and record the pick as a label on the issue
CI / tests (pull_request) Failing after 4m10s

This commit is contained in:
2026-11-18 13:26:50 +01:00
parent f444dca67a
commit 29568fab6c
9 changed files with 377 additions and 9 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
"""An epic held in memory, for do-epic's tests, held to contract.py like every backend."""
import dataclasses
from do_epic.backend.protocol import EpicIssue, no_parent, unfit
from do_epic.backend.protocol import EpicIssue, no_child, no_parent, unfit
from failure import Failure
@@ -28,6 +28,17 @@ class MemoryEpic:
self.issues.append(EpicIssue(key, summary, detail.strip(), tuple(sorted(labels)), None, "To Do", False, parent))
return key
def add_label(self, key: str, label: str) -> None | Failure:
if self.fails:
return Failure(self.fails)
if refused := unfit("-", (label,)):
return refused
child = next((issue for issue in self.issues if issue.key == key and issue.parent == self.epic_key), None)
if child is None:
return no_child(self.epic_key, key)
self.change(key, labels=tuple(sorted({*child.labels, label})))
return None
def change(self, key: str, **fields: object) -> None:
"""Changes the issue named key as a person would in the tracker, such as assignee="Ada Lovelace"."""
self.issues = [dataclasses.replace(issue, **fields) if issue.key == key else issue for issue in self.issues] # type: ignore[arg-type]