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
+2 -2
View File
@@ -123,7 +123,7 @@ def heading_commit(release: Release, ref: str, changelog: stores.RecordStore, cw
def release_reviewed(tag: str | None, ref: str, cwd: str, titles: templates.Titles, after: Release | None = None, run: Git = git) -> bool | Failure:
"""Whether ref holds a commit titled as a release review opens, `Release review of <release>`: after tag, or anywhere where tag is None.
"""Whether ref holds a commit titled as a release review opens, `Release review of <release>`: after tag, or anywhere where tag is None. A title that names no version, such as an epic's `Release review of ABC-12` (do_epic/finish.py), reviews no release.
titles holds the project's title templates, and each commit title is read as the summary they give. after is the version a branch with no tag counts as cut, or None. Where it is given, a title counts only where its release is later than after.
"""
@@ -132,7 +132,7 @@ def release_reviewed(tag: str | None, ref: str, cwd: str, titles: templates.Titl
return log
summaries = [titles.summary(line) for line in log.splitlines()]
reviews = [summary.removeprefix("Release review of ") for summary in summaries if summary.startswith("Release review of ")]
return any(after is None or ((named := parsed(review)) is not None and named > after) for review in reviews)
return any((named := parsed(review)) is not None and (after is None or named > after) for review in reviews)
def todos_since(tag: str | None | Failure, ref: str, plan: str | None, cwd: str, run: Git = git) -> list[str] | Failure:
@@ -209,6 +209,8 @@ class ChunkItem(unittest.TestCase):
self.addCleanup(subprocess.run, ["rm", "-rf", repo])
run = lambda *args: subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, cwd=repo, env=isolated_env(), text=True)
run("init", "-q", "-b", "main")
run("commit", "-q", "--allow-empty", "-m", "Release review of ABC-12")
self.assertIs(release_standing.release_reviewed(None, "main", repo, BARE), False, "an epic's review reviews no release")
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.1.0")
run("tag", "v0.1.0")
run("commit", "-q", "--allow-empty", "-m", "Ship item 4")
@@ -217,6 +219,8 @@ class ChunkItem(unittest.TestCase):
run("commit", "-q", "--allow-empty", "-m", "Answer architecture round 1: 0 🔴, 1 🟡 (0 misread); split loader")
self.assertIs(release_standing.release_reviewed("v0.1.0", "main", repo, BARE), True)
self.assertIs(release_standing.release_reviewed(None, "main", repo, BARE), True)
run("commit", "-q", "--allow-empty", "-m", "Release review of ABC-12")
self.assertIs(release_standing.release_reviewed("v0.1.0", "main", repo, BARE), True)
self.assertIsInstance(release_standing.release_reviewed("v9.9.9", "main", repo, BARE), Failure)
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.reviewed, True)
run("tag", "v0.2.0")