Answer principles round 1: 1 🔴, 7 🟡 (0 misread); every effect is handed in as an argument, no test patches a global, and the traces principle scopes tools that run on their user's machine
CI / tests (pull_request) Successful in 3m43s

This commit is contained in:
2026-11-19 12:42:03 +01:00
parent 8ca612b7a4
commit cb3135bc8c
124 changed files with 1437 additions and 793 deletions
+5 -4
View File
@@ -6,6 +6,7 @@ import pathlib
import shutil
import sys
import tempfile
import typing
from release_plan.release_standing import chunk_item, Cut, default_plan, Next, ReadyToCut, ReviewDue, Unplanned
from project_config.settings import DEFAULT_FLOOR
@@ -21,7 +22,7 @@ from deploy_release import release_pull
from project_config import templates
def cut(clone: str, checkout: str) -> str | Failure:
def cut(clone: str, checkout: str, sleep: typing.Callable[[float], None]) -> str | Failure:
"""What the cut did, as the tool prints it; a Failure with git's, the forge's or the tool's reason where a step stopped."""
if isinstance(same := same_origin(clone, checkout), Failure):
return same
@@ -39,7 +40,7 @@ def cut(clone: str, checkout: str) -> str | Failure:
title, tag = f"Cut release {named}", f"v{named}"
merged = commit_titled(title, ref, clone)
if merged is None:
landed = land(clone, ref, named, title)
landed = land(clone, ref, named, title, sleep)
if isinstance(landed, Failure):
return landed
if isinstance(fetched := git("fetch", "--quiet", "origin", cwd=clone), Failure):
@@ -149,7 +150,7 @@ def commit_titled(title: str, ref: str, clone: str) -> str | None | Failure:
return next((line.split(" ", 1)[0] for line in log.splitlines() if line.split(" ", 1)[1:] == [title]), None)
def land(clone: str, ref: str, named: str, title: str) -> Failure | None:
def land(clone: str, ref: str, named: str, title: str, sleep: typing.Callable[[float], None]) -> Failure | None:
"""Push the branch release-<named> with the cut commit and open its pull request, where an earlier run hasn't; then wait for its checks and merge it."""
url = git("config", "--get", "remote.origin.url", cwd=clone)
if isinstance(url, Failure):
@@ -182,7 +183,7 @@ def land(clone: str, ref: str, named: str, title: str) -> Failure | None:
if isinstance(required, Failure):
return required
said(f"waiting for the checks of pull request {number}" + (f"; {base} requires {', '.join(sorted(required))}" if required else ""))
if isinstance(passed := pulls.checks_passed(on, number, head, required, run), Failure):
if isinstance(passed := pulls.checks_passed(on, number, head, required, run, sleep), Failure):
return passed
said(f"the checks of pull request {number} passed")
if isinstance(merged := release_pull.merge(on, number, head, run), Failure):
+2 -1
View File
@@ -39,6 +39,7 @@ move stopped, fix what it names and run a bare deploy-release.
import os
import pathlib
import sys
import time
from deploy_release.cut import cut
from deploy_release.deploy import deploy
@@ -55,7 +56,7 @@ def main(argv: list[str]) -> int:
print("deploy-release: usage: deploy-release [--cut] [<checkout>]", file=sys.stderr)
return 1
checkout = rest[0] if rest else str(pathlib.Path.home() / ".claude")
moved = cut(os.getcwd(), checkout) if cutting else deploy(checkout)
moved = cut(os.getcwd(), checkout, time.sleep) if cutting else deploy(checkout)
if isinstance(moved, Failure):
print(f"deploy-release: {moved.reason}", file=sys.stderr)
return 1