The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
A release from a checkout behind the last release is refused (#1249)
Deede3ccb586ca2
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex a0ad44aa5..2e8f67801 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -114,6 +114,8 @@ jobs:/.github//scripts//desktop/scripts/+ /cli/scripts/release-cli.sh+ /backend/scripts/release-be.sh/.gitattributes/.gitignore/.gitmodulesdiff --git a/backend/README.md b/backend/README.mdindex a282bda6f..c45d87800 100644--- a/backend/README.md+++ b/backend/README.md@@ -77,6 +77,9 @@ make release-backend ARGS=--dry-run # preview, tags/pushes nothing(equivalent to `bash backend/scripts/release-be.sh`, see that script for details).+The script refuses a checkout that lacks the last `vX.Y.Z_backend` release's commit: it would deploy+older code under a newer version. Update the checkout first; `ARGS=--allow-older` is for a rollback.+### Memory sizing and Redis limitsThe `backend` app runs as a pm2 cluster: every worker has its own V8 heap. `ecosystem.config.cjs`diff --git a/backend/scripts/release-be.sh b/backend/scripts/release-be.shindex cc82bb142..de8fdbec4 100755--- a/backend/scripts/release-be.sh+++ b/backend/scripts/release-be.sh@@ -6,6 +6,7 @@# ./scripts/release-be.sh major # v1.1.2_backend -> v2.0.0_backend# ./scripts/release-be.sh 1.4.1 # exact version -> v1.4.1_backend# ./scripts/release-be.sh --dry-run # print what it WOULD do, touch nothing+# ./scripts/release-be.sh --allow-older # a rollback: older code under a higher version## Pushing the tag is the whole point: ../.github/workflows/production-be-build.yaml triggers on# `vX.Y.Z_backend` tags and builds Dockerfile.k8s -> autonomous-code-be.@@ -26,13 +27,15 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"cd "$REPO_ROOT"DRY_RUN=0+ALLOW_OLDER=0BUMP="patch"for arg in "$@"; docase "$arg" in--dry-run) DRY_RUN=1 ;;+ --allow-older) ALLOW_OLDER=1 ;;patch|minor|major) BUMP="$arg" ;;[0-9]*.[0-9]*.[0-9]*) BUMP="exact"; EXACT="${arg#v}" ;;- *) echo "usage: $0 [patch|minor|major|X.Y.Z] [--dry-run]" >&2; exit 1 ;;+ *) echo "usage: $0 [patch|minor|major|X.Y.Z] [--dry-run] [--allow-older]" >&2; exit 1 ;;esacdone@@ -67,6 +70,26 @@ LATEST="$(git tag -l 'v*_backend' \| { grep -E '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)_backend$' || true; } \| sed -E 's/^v//; s/_backend$//' \| sort -V | tail -1)"++# --- preflight: this release must contain the one before it.+# HEAD on origin is not enough: a checkout nobody updated is on it too, and a tag cut there deploys older+# code under a newer version. v0.3.82_cli was tagged that way on October 12, 2026, 27 minutes after+# v0.3.81_cli and three commits behind it. A rollback is the one release that means to do this.+if [[ -n "$LATEST" ]]; then+ LATEST_SHA="$(git rev-list -n1 "v${LATEST}_backend")"+ if ! git merge-base --is-ancestor "$LATEST_SHA" "$HEAD_SHA" 2>/dev/null; then+ if [[ "$ALLOW_OLDER" == "1" ]]; then+ echo ">> WARNING HEAD (${HEAD_SHA:0:12}) does not contain v${LATEST}_backend (${LATEST_SHA:0:12}) — releasing older code (--allow-older)" >&2+ else+ echo "ERROR HEAD (${HEAD_SHA:0:12}) does not contain v${LATEST}_backend (${LATEST_SHA:0:12})." >&2+ echo " This release would deploy older code under a newer version, taking back" >&2+ echo " $(git rev-list --count "$HEAD_SHA..$LATEST_SHA") commit(s) that v${LATEST}_backend already shipped." >&2+ echo " Update this checkout first: git fetch origin && git checkout --detach origin/main" >&2+ echo " Re-run with --allow-older only to roll back on purpose." >&2+ exit 1+ fi+ fi+fiLATEST="${LATEST:-0.0.0}"MAJOR="${LATEST%%.*}"diff --git a/cli/RELEASE.md b/cli/RELEASE.mdindex f95f325f3..a42973ec5 100644--- a/cli/RELEASE.md+++ b/cli/RELEASE.md@@ -27,6 +27,14 @@ last tag. Bumping from tags alone there would produce a version LOWER than what'every daemon refuses it (`shouldUpdate` / `semverGt` in `src/lib/selfUpdate.ts`) while the releasestill reports success.+**A release contains the one before it.** The script refuses a checkout that lacks the last release's+commit (the highest `v*_cli` tag, and the tag of the version the manifest serves): it is still on+`origin/main`, so nothing else stopped it, and it would publish older code under a newer version to+every daemon. `v0.3.82_cli` was tagged that way on October 12, 2026, from a checkout three commits+behind `v0.3.81_cli`; its run was cancelled before it published. Update the checkout+(`git fetch origin && git checkout --detach origin/main`). A rollback, which means to do exactly this,+is `make release-cli ARGS="--allow-older"`. The desktop, backend and web release scripts check the same.+Unlike `autonomous-harness-desktop`'s `make release`, there is no `--minor` flag: `shouldUpdate` is aplain "strictly newer" check with no major/minor-triggers-a-forced-update concept, so every releasejust needs to outrank what's live.diff --git a/cli/scripts/release-cli.sh b/cli/scripts/release-cli.shindex 64526eab7..e7d67a060 100755--- a/cli/scripts/release-cli.sh+++ b/cli/scripts/release-cli.sh@@ -11,6 +11,7 @@# bash cli/scripts/release-cli.sh 0.2.0 # release an explicit version# bash cli/scripts/release-cli.sh --notes-file f.md # hand-written release notes instead of the# # generated commit list+# bash cli/scripts/release-cli.sh --allow-older # a rollback: older code under a higher version## THE NEXT VERSION COMES FROM TWO SOURCES, AND BOTH MATTER — same reasoning as# autonomous-harness-desktop/scripts/release-desktop.sh. Git tags alone are not enough:@@ -41,6 +42,7 @@ BRANCH="${BRANCH:-main}"DRY_RUN=0ALLOW_NO_MANIFEST=0+ALLOW_OLDER=0NEW_VER=""NOTES_FILE=""@@ -50,9 +52,10 @@ for arg in "$@"; docase "$arg" in--dry-run) DRY_RUN=1 ;;--allow-no-manifest) ALLOW_NO_MANIFEST=1 ;;+ --allow-older) ALLOW_OLDER=1 ;;--notes-file) want_notes_file=1 ;;--notes-file=*) NOTES_FILE="${arg#*=}" ;;- -h|--help) sed -n '2,23p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;+ -h|--help) sed -n '2,24p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;-*) echo "ERROR unknown flag: $arg" >&2; exit 1 ;;*) NEW_VER="$arg" ;;esac@@ -156,6 +159,31 @@ if [ -z "$GCS_VER" ]; thenfifi+# --- preflight: this release must contain the one before it ---+# HEAD on origin/$BRANCH is not enough: a checkout nobody updated is on it too, and a tag cut there ships+# older code under a newer version, which every daemon installs. v0.3.82_cli was tagged that way on+# October 12, 2026, 27 minutes after v0.3.81_cli and three commits behind it (its run was cancelled+# before it published). Checked against the highest tag and against the tag of the version being served:+# they differ when a tag's release never published. A rollback is the one release that means to do this.+contains_release() {+ local tag="$1" sha+ git rev-parse -q --verify "refs/tags/$tag" >/dev/null || return 0+ sha="$(git rev-list -n1 "$tag")"+ git merge-base --is-ancestor "$sha" "$HEAD_SHA" 2>/dev/null && return 0+ if [ "$ALLOW_OLDER" -eq 1 ]; then+ echo ">> WARNING HEAD (${HEAD_SHA:0:12}) does not contain $tag (${sha:0:12}) — releasing older code (--allow-older)" >&2+ return 0+ fi+ echo "ERROR HEAD (${HEAD_SHA:0:12}) does not contain $tag (${sha:0:12})." >&2+ echo " This release would ship older code under a newer version, taking back" >&2+ echo " $(git rev-list --count "$HEAD_SHA..$sha") commit(s) that $tag already shipped." >&2+ echo " Update this checkout first: git fetch origin && git checkout --detach origin/$BRANCH" >&2+ echo " Re-run with --allow-older only to roll back on purpose." >&2+ exit 1+}+[ -z "$LAST_TAG" ] || contains_release "$LAST_TAG"+contains_release "v${GCS_VER}_cli"+# --- the next version ---CUR="$TAG_VER"version_gt "$GCS_VER" "$CUR" && CUR="$GCS_VER"diff --git a/desktop/RELEASE.md b/desktop/RELEASE.mdindex 6eaece01f..e8be85d19 100644--- a/desktop/RELEASE.md+++ b/desktop/RELEASE.md@@ -42,6 +42,14 @@ repo once had a single tag `v1.0.52` while the manifest was already serving `1.0tags alone there produces a version LOWER than what users run — every app refuses it (`semverGt`)while the release still reports success. That local path is gone; the tag is now the only way in.+**A release contains the one before it.** The script refuses a checkout that lacks the last release's+commit (the highest `v*_desktop` tag, and the tag of the version the manifest serves): it is still on+`origin/main`, so nothing else stopped it, and it would ship older code under a newer version to every+app. `v1.2.36_desktop` was cut that way on October 1, 2026, twenty commits behind+`v1.2.35_desktop`. Update the checkout (`git fetch origin && git checkout --detach origin/main`). A+rollback, which means to do exactly this, is `make release-desktop ARGS="--allow-older"`. `--prepare`+is not checked: it publishes nothing. `make release-web` checks the same against the last `v*_web` tag.+`pubspec.yaml`'s `version:` field is never touched; it's a dev-only placeholder.## Managed Node runtimediff --git a/desktop/scripts/release-desktop.sh b/desktop/scripts/release-desktop.shindex 69a4575c2..1c21c9f43 100755--- a/desktop/scripts/release-desktop.sh+++ b/desktop/scripts/release-desktop.sh@@ -16,6 +16,7 @@# # generated commit list# bash scripts/release-desktop.sh --wait # finish when this tag is live and verified# bash scripts/release-desktop.sh --prepare # package the pushed PR head during final checks; no publication+# bash scripts/release-desktop.sh --allow-older # a rollback: older code under a higher version## THE NEXT VERSION COMES FROM TWO SOURCES, AND BOTH MATTER. Git tags alone are not enough: this repo# had one tag (v1.0.52) while the live manifest was already serving 1.0.61, because@@ -44,6 +45,7 @@ WAIT=0PREPARE=0DO_MINOR=0ALLOW_NO_MANIFEST=0+ALLOW_OLDER=0NEW_VER=""NOTES_FILE=""@@ -56,9 +58,10 @@ for arg in "$@"; do--prepare) PREPARE=1 ;;--minor) DO_MINOR=1 ;;--allow-no-manifest) ALLOW_NO_MANIFEST=1 ;;+ --allow-older) ALLOW_OLDER=1 ;;--notes-file) want_notes_file=1 ;;--notes-file=*) NOTES_FILE="${arg#*=}" ;;- -h|--help) sed -n '2,25p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;+ -h|--help) sed -n '2,26p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;-*) echo "ERROR unknown flag: $arg" >&2; exit 1 ;;*) NEW_VER="$arg" ;;esac@@ -191,6 +194,34 @@ if [ -z "$GCS_VER" ]; thenfifi+# --- preflight: this release must contain the one before it ---+# HEAD on origin/$BRANCH is not enough: a checkout nobody updated is on it too, and a tag cut there ships+# older code under a newer version, which every app installs. v1.2.36_desktop was cut that way on+# October 1, 2026, twenty commits behind v1.2.35_desktop, and v0.3.82_cli on October 12.+# Checked against the highest tag and against the tag of the version being served: they differ when a+# tag's release never published. A rollback is the one release that means to do this. Not for --prepare,+# which publishes nothing: its candidate is a PR's head, and the release itself is cut after the merge.+contains_release() {+ local tag="$1" sha+ git rev-parse -q --verify "refs/tags/$tag" >/dev/null || return 0+ sha="$(git rev-list -n1 "$tag")"+ git merge-base --is-ancestor "$sha" "$HEAD_SHA" 2>/dev/null && return 0+ if [ "$ALLOW_OLDER" -eq 1 ]; then+ echo ">> WARNING HEAD (${HEAD_SHA:0:12}) does not contain $tag (${sha:0:12}) — releasing older code (--allow-older)" >&2+ return 0+ fi+ echo "ERROR HEAD (${HEAD_SHA:0:12}) does not contain $tag (${sha:0:12})." >&2+ echo " This release would ship older code under a newer version, taking back" >&2+ echo " $(git rev-list --count "$HEAD_SHA..$sha") commit(s) that $tag already shipped." >&2+ echo " Update this checkout first: git fetch origin && git checkout --detach origin/$BRANCH" >&2+ echo " Re-run with --allow-older only to roll back on purpose." >&2+ exit 1+}+if [ "$PREPARE" -eq 0 ]; then+ [ -z "$LAST_TAG" ] || contains_release "$LAST_TAG"+ contains_release "v${GCS_VER}_desktop"+fi+# --- the next version ---CUR="$TAG_VER"version_gt "$GCS_VER" "$CUR" && CUR="$GCS_VER"diff --git a/desktop/scripts/release-web.sh b/desktop/scripts/release-web.shindex a05fa5cee..ea38df536 100755--- a/desktop/scripts/release-web.sh+++ b/desktop/scripts/release-web.sh@@ -16,6 +16,7 @@# bash desktop/scripts/release-web.sh --minor # bump the MINOR version# bash desktop/scripts/release-web.sh --website-only # preserve the deployed Flutter bundle# bash desktop/scripts/release-web.sh 1.3.0 # an explicit version+# bash desktop/scripts/release-web.sh --allow-older # a rollback: older code under a higher version## RESUMING: after a failure, re-run with the SAME explicit version — an existing tag is reused rather# than moved, and the script only waits for its run. A tag whose build failed is not retried by moving@@ -41,13 +42,15 @@ RUN_APPEAR_TIMEOUT="${RUN_APPEAR_TIMEOUT:-180}" # seconds for the tag's workflDRY_RUN=0DO_MINOR=0WEBSITE_ONLY=0+ALLOW_OLDER=0NEW_VER=""for arg in "$@"; docase "$arg" in--dry-run) DRY_RUN=1 ;;--minor) DO_MINOR=1 ;;--website-only) WEBSITE_ONLY=1 ;;- -h|--help) sed -n '2,30p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;+ --allow-older) ALLOW_OLDER=1 ;;+ -h|--help) sed -n '2,31p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;-*) echo "ERROR unknown flag: $arg" >&2; exit 1 ;;*) NEW_VER="${arg#v}" ;;esac@@ -80,6 +83,8 @@ git fetch --tags --quiet originLAST_VER="$(git tag -l 'v*_web' \| { grep -E '^v[0-9]+\.[0-9]+\.[0-9]+_web$' || true; } \| sed -E 's/^v//; s/_web$//' | sort -V | tail -1)"+LAST_TAG=""+[ -z "$LAST_VER" ] || LAST_TAG="v${LAST_VER}_web"LAST_VER="$(printf '%s\n%s\n' "${LAST_VER:-0.0.0}" "$VERSION_FLOOR" | sort -V | tail -1)"if [ -n "$NEW_VER" ]; thenVER="$NEW_VER"@@ -105,6 +110,18 @@ elseSHA="$(git rev-parse HEAD)"git merge-base --is-ancestor "$SHA" "origin/$BRANCH" 2>/dev/null \|| die "HEAD is not on origin/$BRANCH — merge and push it first; the web ships from $BRANCH"+ # This release must contain the one before it. HEAD on origin/$BRANCH is not enough: a checkout nobody+ # updated is on it too, and a tag cut there ships older code under a newer version. v1.3.17_web was cut+ # that way on October 1, 2026, twenty commits behind v1.3.16_web, and v0.3.82_cli on October 12. A+ # rollback is the one release that means to do this.+ if [ -n "$LAST_TAG" ]; then+ LAST_SHA="$(git rev-list -n1 "$LAST_TAG")"+ if ! git merge-base --is-ancestor "$LAST_SHA" "$SHA" 2>/dev/null; then+ [ "$ALLOW_OLDER" -eq 1 ] \+ || die "HEAD (${SHA:0:12}) does not contain $LAST_TAG (${LAST_SHA:0:12}): this release would ship older code under a newer version, taking back $(git rev-list --count "$SHA..$LAST_SHA") commit(s) that $LAST_TAG already shipped. Update this checkout first (git fetch origin && git checkout --detach origin/$BRANCH), or re-run with --allow-older to roll back on purpose."+ say "WARNING HEAD (${SHA:0:12}) does not contain $LAST_TAG (${LAST_SHA:0:12}) — releasing older code (--allow-older)"+ fi+ fi[ "$(printf '%s\n%s\n' "$VER" "$LAST_VER" | sort -V | tail -1)" = "$VER" ] && [ "$VER" != "$LAST_VER" ] \|| die "$VER is not higher than the last web release $LAST_VER"fidiff --git a/scripts/record-ci-validation.py b/scripts/record-ci-validation.pyindex bc8842297..31dce5955 100644--- a/scripts/record-ci-validation.py+++ b/scripts/record-ci-validation.py@@ -31,7 +31,10 @@ SCOPES["full"] = CLI_JOBS | TUI_JOBS | SCOPES["backend"] | DESKTOP_JOBS | {"comp# whole workflow/action and helper trees: a changed test, toolchain pin, cache# recipe or source contract must invalidate earlier evidence too.SOURCE_INPUTS = {- "process": (".github/", "scripts/", "desktop/scripts/", ".gitattributes", ".gitignore", ".gitmodules", "Makefile"),+ # The CLI's and the backend's release commands are here for scripts/tests/test_release_contains_last.py,+ # which runs all four release commands; the desktop's and the web's are in desktop/scripts/.+ "process": (".github/", "scripts/", "desktop/scripts/", "cli/scripts/release-cli.sh", "backend/scripts/release-be.sh",+ ".gitattributes", ".gitignore", ".gitmodules", "Makefile"),# VM tests also read CLI protocol definitions, shared layout fixtures,# daemon metadata and store catalog/artwork, including docs/images posters,# the Hub's publication rules that desktop/lib/community/hub_contract.dart mirrors, and thediff --git a/scripts/tests/test_release_contains_last.py b/scripts/tests/test_release_contains_last.pynew file mode 100644index 000000000..9dfd5ffdc--- /dev/null+++ b/scripts/tests/test_release_contains_last.py@@ -0,0 +1,145 @@+"""Run the four real release commands against a private Git fixture: none may release older code by accident.++A checkout nobody updated is still on origin/main, so "HEAD is on origin/main" let it through. v0.3.82_cli was+tagged that way on October 12, 2026, 27 minutes after v0.3.81_cli and three commits behind it.+"""+import json+import os+from pathlib import Path+import shutil+import subprocess+import tempfile+import unittest++ROOT = Path(__file__).resolve().parents[2]++# kind -> (script, the version its last release has here, the version a dry run would cut next)+RELEASES = {+ 'cli': ('cli/scripts/release-cli.sh', '0.3.81', '0.3.82'),+ 'desktop': ('desktop/scripts/release-desktop.sh', '1.2.65', '1.2.66'),+ 'backend': ('backend/scripts/release-be.sh', '1.2.63', '1.2.64'),+ 'web': ('desktop/scripts/release-web.sh', '1.3.44', '1.3.45'),+}+++class ReleaseContainsLastTests(unittest.TestCase):+ def setUp(self):+ self.temp = tempfile.TemporaryDirectory()+ self.addCleanup(self.temp.cleanup)+ self.root = Path(self.temp.name)+ self.repo = self.root / 'repo'+ self.repo.mkdir()+ self.remote = self.root / 'origin'+ self.bin = self.root / 'bin'+ self.bin.mkdir()+ self.manifest = self.root / 'manifest.json'+ self.env = dict(os.environ, PATH=str(self.bin) + os.pathsep + os.environ['PATH'], RELEASE_FIXTURE_MANIFEST=str(self.manifest))+ for name in ('BRANCH', 'GIT_DIR', 'GIT_WORK_TREE', 'META_URL', 'METADATA_PATH', 'GCS_BUCKET', 'GCS_PUBLIC_BASE_URL', 'OTA_KEY',+ 'VERSION_FLOOR', 'WORKFLOW'):+ self.env.pop(name, None)+ self.git('init', '-q', '-b', 'main')+ for script, _, _ in RELEASES.values():+ target = self.repo / script+ target.parent.mkdir(parents=True, exist_ok=True)+ shutil.copyfile(ROOT / script, target)+ self.git('add', '.')+ self.git('commit', '-qm', 'older')+ self.older = self.git('rev-parse', 'HEAD')+ self.git('commit', '--allow-empty', '-qm', 'newer')+ self.newer = self.git('rev-parse', 'HEAD')+ self.git('init', '-q', '--bare', str(self.remote))+ self.git('remote', 'add', 'origin', str(self.remote))+ self.git('push', '-q', 'origin', 'main')+ # The live manifest, and a signed-in gh that names the repository: all a dry run asks of either.+ for name, body in {+ 'curl': '#!/usr/bin/env python3\nimport os\nprint(open(os.environ["RELEASE_FIXTURE_MANIFEST"]).read())\n',+ 'gh': '#!/usr/bin/env python3\nimport sys\nif sys.argv[1:3] == ["repo", "view"]: print("fixture/repo")\n',+ }.items():+ path = self.bin / name+ path.write_text(body)+ path.chmod(0o755)+ self.live(cli='0.3.81', desktop='1.2.65')++ def git(self, *args):+ return subprocess.check_output(['git', '-c', 'user.name=Fixture', '-c', '[email protected]', *args],+ cwd=self.repo, env=self.env, stderr=subprocess.STDOUT, text=True, timeout=30).strip()++ def live(self, cli, desktop):+ self.manifest.write_text(json.dumps({'cli': {'version': cli}, 'desktop-macos': {'version': desktop}}))++ def tag(self, kind, version, commit):+ self.git('tag', '-a', f'v{version}_{kind}', '-m', f'{kind} {version}', commit)+ self.git('push', '-q', 'origin', f'v{version}_{kind}')++ def stale(self):+ """This checkout's main as it was before the newer commit: on origin/main, and behind it."""+ self.git('reset', '-q', '--hard', self.older)++ def release(self, kind, *args):+ return subprocess.run(['bash', RELEASES[kind][0], *args], cwd=self.repo, env=self.env, capture_output=True, text=True, timeout=30)++ def test_a_checkout_behind_the_last_release_is_refused(self):+ for kind, (_, last, _) in RELEASES.items():+ with self.subTest(kind=kind):+ self.tag(kind, last, self.newer)+ self.stale()+ before = self.git('ls-remote', '--tags', 'origin')+ for args in (['--dry-run'], []):+ result = self.release(kind, *args)+ self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr)+ self.assertIn(f'does not contain v{last}_{kind}', result.stderr)+ self.assertIn('1 commit(s)', result.stderr)+ self.assertIn('--allow-older', result.stderr)+ self.assertEqual(self.git('ls-remote', '--tags', 'origin'), before)+ self.assertEqual(self.git('tag', '-l', f'v*_{kind}'), f'v{last}_{kind}')+ self.git('reset', '-q', '--hard', self.newer)++ def test_a_rollback_is_allowed_by_name(self):+ for kind, (_, last, following) in RELEASES.items():+ with self.subTest(kind=kind):+ self.tag(kind, last, self.newer)+ self.stale()+ result = self.release(kind, '--allow-older', '--dry-run')+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)+ self.assertIn(f'does not contain v{last}_{kind}', result.stdout + result.stderr)+ self.assertIn(following, result.stdout)+ self.git('reset', '-q', '--hard', self.newer)++ def test_a_checkout_that_contains_the_last_release_releases(self):+ for kind, (_, last, following) in RELEASES.items():+ with self.subTest(kind=kind, at='the tip'):+ self.tag(kind, last, self.older)+ result = self.release(kind, '--dry-run')+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)+ self.assertIn(following, result.stdout)+ # Behind origin/main and at the last release: a release of less than everything is still one.+ with self.subTest(kind=kind, at='the last release'):+ self.stale()+ result = self.release(kind, '--dry-run')+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)+ self.git('reset', '-q', '--hard', self.newer)++ def test_the_version_being_served_counts_when_a_higher_tag_never_published(self):+ # October 12, 2026 as it stood: 0.3.82 tagged on the older commit and cancelled, 0.3.81 live from the newer.+ for kind, live, cancelled in (('cli', '0.3.81', '0.3.82'), ('desktop', '1.2.65', '1.2.66')):+ with self.subTest(kind=kind):+ self.tag(kind, live, self.newer)+ self.tag(kind, cancelled, self.older)+ self.stale()+ result = self.release(kind, '--dry-run')+ self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr)+ self.assertIn(f'does not contain v{live}_{kind}', result.stderr)+ self.git('reset', '-q', '--hard', self.newer)+ result = self.release(kind, '--dry-run')+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)++ def test_a_first_release_has_nothing_to_contain(self):+ self.live(cli='0.0.0', desktop='0.0.0')+ for kind in RELEASES:+ with self.subTest(kind=kind):+ result = self.release(kind, '--dry-run')+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)+++if __name__ == '__main__':+ unittest.main()