Merge origin/main into item-441

This commit is contained in:
2026-11-19 01:37:46 +01:00
49 changed files with 2178 additions and 324 deletions
+15 -2
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, rank and finish 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, issue finish 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,7 +61,19 @@ class MemoryEpic:
self.comments.setdefault(key, []).append(text.strip())
return None
def finish(self, key: str) -> None | Failure:
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 finish_issue(self, key: str) -> None | Failure:
if self.fails:
return Failure(self.fails)
children = {issue.key for issue in self.issues if issue.parent == self.epic_key}