Answer stability round 1: 1 🔴, 1 🟡 (0 misread); stamp deploy-release's trace in UTC, end a stopped run's trace, drop redundant assertions, and the product-owner and prose fixes

This commit is contained in:
2026-11-27 14:14:28 +01:00
parent 3eb57d44c6
commit 74066a3134
13 changed files with 107 additions and 77 deletions
+6 -6
View File
@@ -17,7 +17,7 @@ from failure import Failure
from plan_store.todo_md import FilePlan
from record_store.stores import FileStore
from forge.commands import forge_of, runner
from plan.release import newest_tag, Release, tagged, UNRELEASED_HEADING, version
from plan.release import newest_tag, Release, REVIEW_TITLE, tagged, UNRELEASED_HEADING, version
from forge import pulls
from deploy_release import release_pull
from deploy_release.trace import Say
@@ -54,7 +54,7 @@ def cut(clone: str, checkout: str, sleep: typing.Callable[[float], None], say: S
if isinstance(patched := patch_refusal(clone, ref, ready.release), Failure):
return patched
if not ready.reviewed:
return Failure(f"the release review of {named} hasn't landed")
return Failure(f"the release review of {named} hasn't landed: {ref} holds no commit titled `{REVIEW_TITLE}{named}` after the newest tag. `chunk-preflight --help` says which commit counts.")
title, tag, branch = f"Cut release {named}", f"v{named}", f"release-{named}"
merged = commit_titled(title, ref, clone)
if merged is None:
@@ -242,22 +242,22 @@ def push_cut_commit(clone: str, ref: str, branch: str, named: str, title: str, r
def renamed(changelog: str | None) -> str | Failure:
text, count = UNRELEASED_HEADING.subn(f"## {named}", changelog or "", count=1)
return text if count else Failure(f"CHANGELOG.md on {ref} has no ## Unreleased section to rename")
if isinstance(written := rewritten(worktree / "CHANGELOG.md", f"rename ## Unreleased to ## {named} in the cut's worktree, so nothing is pushed", renamed), Failure):
if isinstance(written := rewritten(worktree / "CHANGELOG.md", f"rename ## Unreleased to ## {named} in the cut's worktree", "Nothing is pushed.", renamed), Failure):
return written
if isinstance(committed := git("commit", "--quiet", "-am", title, cwd=str(worktree)), Failure):
return committed
return push_branch(worktree, branch, replacing)
def rewritten(file: pathlib.Path, doing: str, rewrite: typing.Callable[[str | None], str | Failure]) -> Failure | None:
"""Replace file's text with what rewrite makes of it, or of None where there is no such file. A Failure where rewrite gives one, which leaves the file, or where the file can't be read or written: that one says doing, the step that stopped, and names the file."""
def rewritten(file: pathlib.Path, doing: str, outcome: str, rewrite: typing.Callable[[str | None], str | Failure]) -> Failure | None:
"""Replace file's text with what rewrite makes of it, or of None where there is no such file. Where rewrite gives a Failure, return it and leave the file. Where the file can't be read or written, the Failure names doing, the step that stopped, then the file, and ends with outcome, a sentence on where that leaves the run."""
try:
text = rewrite(file.read_text(encoding="utf-8") if file.exists() else None)
if isinstance(text, Failure):
return text
file.write_text(text, encoding="utf-8")
except (OSError, UnicodeError) as failure:
return Failure(f"could not {doing}: {failure}" + ("" if str(file) in str(failure) else f" ({file})"))
return Failure(f"could not {doing}: {failure}" + ("" if str(file) in str(failure) else f" ({file})") + f". {outcome}")
return None