Answer principles round 1: 0 🔴, 1 🟡 (0 misread); bound and stream a patch cut's ci.sh, keep a trace of each deploy-release run, fail on file errors and a missing Unreleased heading, read the plan once per cut, one home for the review title, inject task-bench's container names, one spelling of its task kind
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-27 11:57:54 +01:00
parent f8ad35c1f9
commit 4fc4763710
16 changed files with 627 additions and 157 deletions
+27 -4
View File
@@ -33,6 +33,8 @@ with --cut-patch.
deletes the branch on origin, then moves <checkout> to the tag as above. A failed delete only warns.
It says on stderr as each step finishes, and ends stdout, after the changelog, with the line
`Done: v<version> is cut and pushed, and <checkout> is on it.`
It keeps each of those lines, with its time, in a file of the run's own under $XDG_STATE_HOME/deploy-release
(default ~/.local/state/deploy-release), and so does --cut-patch.
Where a step fails it stops, exit 1, with git's or the forge's reason, and leaves the pull request
and the branch as they are. A rerun continues: it takes the branch's open pull request and a cut
commit already merged, and drops a cut tag an earlier run made but never pushed. Once the tag is pushed, the release is cut: where only the
@@ -51,7 +53,8 @@ doesn't hold, and on a GitHub origin, whose rebase merge would drop the tag from
2. In a worktree of its own at the tag, it applies each commit's changes, except to CHANGELOG.md, todo.md,
docs/comprehension-history.md and docs/reading-cost.md, heads CHANGELOG.md with the release's section, and commits that
titled `Cut release <version>`. Where a commit doesn't apply, it stops, names it, and says how to cut the patch by hand.
3. It runs ci.sh on that commit, and stops where it fails, before anything is tagged.
3. It runs ci.sh on that commit, with its output in a file beside the run's trace, which it names on stderr. It stops
where ci.sh fails or still runs after 30 minutes, before anything is tagged.
4. It tags the commit v<version>, annotated `Cut release <version>`, and pushes only the tag.
5. On a fresh origin/main it merges the tag keeping main's files, moves the release's entries from ## Unreleased to a
## <version> section below it, commits that titled `Merge release <version> into main`, and lands it through the branch
@@ -60,15 +63,19 @@ doesn't hold, and on a GitHub origin, whose rebase merge would drop the tag from
A rerun takes a tag origin holds already, once it checks the tag lists the same changelog entries, and the merge-back's open
pull request. Once the merge-back has merged, the release is cut: where only the move stopped, run a bare deploy-release.
"""
import datetime
import os
import pathlib
import shlex
import sys
import time
from deploy_release.ci_script import ci_runner, CI_SECONDS
from deploy_release.cut import cut
from deploy_release.patch import cut_patch
from deploy_release.deploy import deploy
from failure import Failure
from deploy_release import trace
def main(argv: list[str]) -> int:
@@ -82,12 +89,28 @@ def main(argv: list[str]) -> int:
print("deploy-release: usage: deploy-release [--cut | --cut-patch <commits>] [<checkout>]", file=sys.stderr)
return 1
checkout = rest[0] if rest else str(pathlib.Path.home() / ".claude")
if not cutting and commits is None:
moved = deploy(checkout)
if isinstance(moved, Failure):
print(f"deploy-release: {moved.reason}", file=sys.stderr)
return 1
print(moved)
return 0
clone, now = os.getcwd(), datetime.datetime.now
folder, name = trace.trace_folder(os.environ, pathlib.Path.home()), trace.run_name(now(), os.getpid())
begun = trace.started(folder, name, f"deploy-release {shlex.join([*argv[:2 if patching else 1], checkout])} in {clone}", now)
if isinstance(begun, Failure):
print(f"deploy-release: warning: {begun.reason}", file=sys.stderr)
file = None if isinstance(begun, Failure) else begun
say = trace.saying(file, now, sys.stderr)
if commits is not None:
moved = cut_patch(os.getcwd(), checkout, commits, time.sleep)
moved = cut_patch(clone, checkout, commits, time.sleep, say, ci_runner(folder / f"{name}-ci.log", CI_SECONDS, say))
else:
moved = cut(os.getcwd(), checkout, time.sleep) if cutting else deploy(checkout)
moved = cut(clone, checkout, time.sleep, say)
if isinstance(moved, Failure):
print(f"deploy-release: {moved.reason}", file=sys.stderr)
say(moved.reason)
return 1
print(moved)
# The ending is on stdout already, so only the trace takes it.
trace.kept(file, moved.splitlines()[-1], now, sys.stderr)
return 0