Answer stability round 1: 0 🔴, 5 🟡 (0 misread); share the scratch worktree, check a reused tag and main's merge-back, refuse GitHub, split the looped test

This commit is contained in:
Lilleman
2026-11-24 15:12:17 +01:00
parent ec497aa989
commit db32e4ef59
9 changed files with 249 additions and 124 deletions
+3 -2
View File
@@ -138,14 +138,15 @@ 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. 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.
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. A title counts only where its release is later than after, or than tag's version where after is None. A patch release cut beside the default branch and merged back leaves on ref, after its tag, the review of that patch, which reviews no later release.
"""
log = run("log", "--format=%s", f"{tag}..{ref}" if tag else ref, cwd=cwd)
if isinstance(log, Failure):
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((named := parsed(review)) is not None and (after is None or named > after) for review in reviews)
floor = after if after is not None else tagged(tag)
return any((named := parsed(review)) is not None and (floor is None or named > floor) for review in reviews)
def todos_since(tag: str | None | Failure, ref: str, plan: str | None, cwd: str, run: Git = git) -> list[str] | Failure:
+18
View File
@@ -236,6 +236,24 @@ class ChunkItem(unittest.TestCase):
self.assertIs(release_standing.project_plan(dataclasses.replace(config, commit_title="PAY-{id} - {summary}"), "main", repo).cut.reviewed, True)
self.assertIs(release_standing.project_plan(dataclasses.replace(config, pull_request_title="PAY-{id} - {summary}"), "main", repo).cut.reviewed, True)
def test_counts_no_release_review_of_the_patch_release_cut_beside_main_as_a_review_of_the_next(self):
repo = tempfile.mkdtemp()
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", "Cut release 0.15.1")
run("tag", "v0.15.1")
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.15.2")
run("switch", "-q", "--detach", "v0.15.1")
run("commit", "-q", "--allow-empty", "-m", "Cut release 0.15.2")
run("tag", "v0.15.2")
run("switch", "-q", "main")
run("merge", "-q", "--strategy", "ours", "--no-ff", "-m", "Merge release 0.15.2 into main", "v0.15.2")
# v0.15.2..main holds the review, which reviewed 0.15.2 itself, so 0.16.0 still waits for its own.
self.assertIs(release_standing.release_reviewed("v0.15.2", "main", repo, BARE), False)
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.16.0")
self.assertIs(release_standing.release_reviewed("v0.15.2", "main", repo, BARE), True)
def test_counts_no_release_review_of_a_release_cut_under_a_dated_heading_on_a_branch_with_no_tag(self):
repo = tempfile.mkdtemp()
self.addCleanup(subprocess.run, ["rm", "-rf", repo])