Finish an epic: a finishing chunk files each repo's release review, has the human confirm each goal, and closes the epic with its summary

This commit is contained in:
2026-11-18 23:59:53 +01:00
parent 382ac99c41
commit fdb942472d
20 changed files with 514 additions and 63 deletions
+14 -1
View File
@@ -7,11 +7,12 @@ from failure import Failure
@dataclasses.dataclass
class MemoryEpic:
"""An epic whose issues rank in the order filed, until one is ranked. Where fails is set, every read, filing, label, comment and rank fails with it as the reason. comments holds each issue's comments, by key."""
"""An epic whose issues rank in the order filed, until one is ranked. Where fails is set, every read, filing, label, comment, rank and closing fails with it as the reason. comments holds each issue's comments, and the epic's, by key. done says whether the epic is closed."""
epic_key: str
issues: list[EpicIssue] = dataclasses.field(default_factory=list)
comments: dict[str, list[str]] = dataclasses.field(default_factory=dict)
fails: str | None = None
done: bool = False
def read(self) -> list[EpicIssue] | Failure:
if self.fails:
@@ -60,6 +61,18 @@ class MemoryEpic:
self.comments.setdefault(key, []).append(text.strip())
return None
def closed(self) -> bool | Failure:
return Failure(self.fails) if self.fails else self.done
def close(self, summary: str) -> None | Failure:
if self.fails:
return Failure(self.fails)
if refused := no_words(summary):
return refused
self.comments.setdefault(self.epic_key, []).append(summary.strip())
self.done = True
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]