Repository navigation
fix(cli): let tale deploy cross the automation protocol cutover - #4954
Merged
Merged
Conversation
From v0.5.79 every `tale deploy` refused a workspace still on v0.5.77 and sent it to managed apply, which cannot adopt a blue/green workspace and whose cutover refuses writers in `<id>-blue`/`<id>-green`. No route was left, and v0.5.89 met it on a real client host. `tale deploy` now runs the same held-census barrier itself, with custody of the deployment's own and both colour projects. Everything that can refuse is read first, read-only and before anything changes: the v0.5.77 backend source and restart policy, the exact v0.5.77 ledger and a lock-free census of unfinished runs in every organization. Each refusal names its next step. The barrier stops the old writers right before the new colour starts. A rerun resumes its own handoff, also after a first boot was cut before 0163 committed (the colour is removed on interrupt and migrations commit per file, so no census can pass any more). A resumed flip, in deploy and rollback, now waits for the colour to be healthy. Managed apply keeps its exact behaviour and wording; rollback still never crosses the cutover. Real-Postgres checks cover the readiness census and the ledger shapes.
Commander resolves program options anywhere on the command line, so the root `--version` claimed `tale update --version 0.5.77`: the CLI printed its own version, exited 0 and updated nothing. That is the documented way to change release lines, and the way a v0.5.76 workspace must reach v0.5.77 before the automation protocol cutover. Once `update` is the command, its `--version` is spelled as the `-v` only `update` declares.
The upgrades page now tells an operator on v0.5.77 or earlier what the one-time automation writer protocol cutover needs (v0.5.77 first, no unfinished runs, a preview), what `tale deploy` checks and stops, when the API is down, how a rerun resumes, and that rollback cannot cross it. The commands use `-v`, which older CLIs understand.
v0.5.79 to v0.5.89 stranded every v0.5.77 workspace at the automation writer protocol cutover while nothing ran the upgrade an operator runs. `tools/cli/scripts/workspace-upgrade-check.ts` does: it deploys an older release with its own CLI, signs up an owner and creates an organization, moves the workspace with `tale update -v`, deploys with the CLI under test, and requires the migrations, the account, the organization and a sign-in to survive, a second deploy to succeed and, across the cutover, the rollback to be refused. The Workspace upgrade workflow runs it nightly and on demand from v0.5.77 and from the release before the newest, with the CLI built from `main` against the newest published images. It is informational, never in the merge gate; RELEASING.md asks to check its newest run before tagging.
A rolling update of your own Compose files or the Kubernetes manifests starts the new backend while the v0.5.77 one still runs, so nothing holds the barrier and unfinished runs end up on hold for good. The section now says how to hold it: pause schedules and triggers, wait for zero unfinished runs (the census predicate, as a query), stop the old `backend-api` and `backend-worker`, then roll out.
Once `tale deploy` has stopped the v0.5.77 backend for the cutover, the database may already hold part of the new release's migrations. A rollback then started old writers beside it, and a later deploy could neither resume the recorded handoff nor take a census. While the receipt exists and the installed protocol is still 1, rollback now refuses and points to `tale deploy`. A deploy test also proves the read-only plan refuses a workspace it cannot cut over before any retag, volume, Compose or traffic change.
Review findings on the tale deploy cutover: - A first boot cut before 0163 plus a database restart (a host reboot) was a dead end: the resume needed the exact database start time. A workspace now takes a fresh held census over v0.5.77's ledger or one such a boot continued, and compares its database by container, image and labels when new writers already exist. - The read-only plan now asks everything that can refuse: a workspace with no recorded colour (it would deploy without a snapshot), --stop (it would replace the database mid-cutover), --services, and, when new writers exist, the recorded handoff through a verify-only barrier call that never locks or stops. Barrier refusals no longer claim that nothing changed; they say the old backend was not stopped. - Rollback refuses on a partly upgraded ledger instead of on the receipt alone, so an abandoned attempt no longer blocks a later rollback. - A resumed flip waits only on running replicas; an exited leftover would have wedged every rerun. The deploy test now runs without --skip-backup, so it proves the plan refuses before the snapshot.
Stop the v0.5.77 backend first, make sure none is left, and only then count unfinished runs: a run started between a zero count and the stop would be held for good. Step 4 says a cutover deploy runs without --stop or --services.
An earlier attempt's receipt alone made the plan report a resume, and the deploy then said the old backend stays stopped while the barrier was about to stop a backend running again. A resume now means the old writers are already stopped or the new ones exist.
Both read "as long as no run is unfinished" where the meaning is "once none is"; the French also mixed genders in "l'un d'eux".
Comparing only the database container, image and labels let a snapshot restored in place under a stopped new colour pass the census-free resume, and 0163 would then have held every run left unfinished in it. A workspace now skips the census only while its new colour runs (it installs 0163 before it serves or works, so nothing is left to protect). A new colour that does not run never finished migrating and is recreated by the deploy: the old writers take a fresh held census, in the read-only plan and again under the lock, whatever the database went through since.
yannickmonney
marked this pull request as ready for review
October 13, 2026 16:26
A stopped protocol-2 backend outside the colour projects, which the deploy would not recreate, was refused only at the barrier, after the snapshot and the sandbox roll. The read-only plan now refuses it first, and the barrier asks before its verify-only return.
yannickmonney
force-pushed
the
fix/tag-deploy-automation-cutover
branch
from
October 13, 2026 16:29
f380aef to
059a6bb
Compare
Contributor
Author
yannickmonney
added this pull request to the merge queue
Oct 13, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 13, 2026
On Windows, resolve() turns /tmp/upgrade into D:\tmp\upgrade, so the literal expectation failed the Windows CLI build in the merge queue.
yannickmonney
enabled auto-merge
October 13, 2026 20:52
yannickmonney
added this pull request to the merge queue
Oct 13, 2026
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
From v0.5.79 on,
tale deployrefused every workspace still on v0.5.77 or earlier at the automation writer protocol cutover, and pointed it at managed apply, which cannot adopt a blue/green workspace either. A client hit it upgrading to v0.5.89; every self-hoster on v0.5.77 would.tale deploynow runs the cutover barrier itself, safely and resumably, and a nightly check upgrades a real workspace so a release cannot strand one again.From v0.5.79 on,
tale deployrefused every workspace still on v0.5.77 or earlier:Managed apply could not take such a host either: it adopts only its own receipt or a complete single-project source-Compose runtime, and its cutover refuses the writers
tale deployruns in<id>-blue/<id>-green("blue/green writers are outside its custody"). A client hit this upgrading to v0.5.89; every self-hoster on a v0.5.77 workspace would too. Reproduced on a real v0.5.77 workspace with the official v0.5.89 CLI (rc=3, the message above, nothing changed).What changes
tale deployruns the cutover barrier itself.cutoverLegacyAutomationgains an optional workspace scope (managed apply is byte-identical in behaviour and wording): custody of<id>,<id>-blue,<id>-green; resumed target writers in a colour project on the admitted digest of the configured registry; recovery worded as "runtale deployagain".planTagAutomationCutover): the v0.5.77 backend source (b4931db4) andunless-stopped, the ledger, an empty census across every organization (lock-free READ ONLY; the held census still decides), a workspace that records its live colour (a first deploy would skip the snapshot and replace the database), no--stop(it would replace the database mid-cutover) or--services, and — when new writers already exist — the recorded handoff, through a verify-only barrier call that never locks or stops. Each refusal names its next step and says nothing was changed; barrier-time refusals say the old backend was not stopped.--dry-runreports readiness.0163before it serves or works), a rerun verifies the recorded handoff. Otherwise — no new colour yet, or one that stopped before finishing, which the deploy recreates — it takes a fresh held census over the old writers, over v0.5.77's ledger or one a first boot cut before0163continued (the interrupt removes that colour and migrations commit per file). A reboot or a snapshot restored in place is counted again, never waved through.tale update --version Xworks: Commander's root--versionclaimed it, printed the CLI version and exited 0 without updating — the documented way to change release lines did nothing. Refusals and the new docs use-v, which works on every release (older CLIs keep the bug).tale deployonly) and refuses on a partly upgraded ledger.tale deploychecks and stops, API downtime, how a rerun resumes, rollback, and how to hold the barrier by hand — in a safe order — with your own Compose files or the Kubernetes manifests, where nothing holds it.Independent review
An adversarial review of the first version found six issues, all fixed in
fix(cli): keep a workspace cutover resumable and refuse it earlieranddocs: hold the cutover by hand in a safe order: a dead end after a cut first boot plus a database restart; refusals that could fire after mutation and messages claiming nothing changed; a manual procedure that counted before stopping; a first deploy over an existing database skipping the snapshot; a resume health wait that an exited leftover replica could wedge; and a rollback guard that an abandoned attempt could block for good. A second pass confirmed all six and found one gap in the first fix (a database restored in place under a stopped new colour could skip the census), closed byfix(cli): count a restored database again before a workspace resumes, with tests at the barrier and the plan.How it is held
ROTATABLE_SERVICES/colorProject; every plan refusal routed with nothing changed; reruns after stop, cut boot + reboot, new writers), deploy-level refusal before the snapshot, rollback guards, running-only health wait,update --versionrouting incl. the Commander trap.legacy/continuedfrom the real ledger query, and the held census accepting the continued ledger for a workspace while managed apply does not. Ran locally against a disposable tale-db: 20/20 pass.tools/cli/scripts/workspace-upgrade-check.tsdeploys v0.5.77 (and the release before the newest) with its own CLI, signs up an owner and creates an organization,tale update -v, deploys with the CLI built frommain, and requires the migrations, data and sign-in to survive, a second deploy to succeed and the rollback across the cutover to be refused.Observed
On a real local Docker v0.5.77 workspace (project
ws-a3667f):--dry-runreports "Would run the one-time automation writer protocol cutover…"; deploy succeeds; ledger 152 → 190 with0163; the owner made on 0.5.77 signs in on 0.5.89 with the same user id;cutover-orglisted;/api/health0.5.89; a second deploy succeeds;tale rollbackto 0.5.77 refused (rc=3) with 0.5.89 still serving.tools/cli/scripts/workspace-upgrade-check.ts, end to end from v0.5.77 on a fresh workspace: passed (cutover ran, 0163 recorded, 0.5.89 serving, data survived, owner signs in, rollback refused with 0.5.89 still serving, second deploy ordinary), and its cleanup left no containers or volumes.stopped); a plaintale deployrerun started the new colour, waited for health, flipped and retired the old one.Not in this change
tale reset --alldoes not delete named volumes on Docker 23+ (volume prunewithout-a); the upgrade check removes its own.Suggested release-note text
tale deploynow upgrades a workspace from v0.5.77 across the automation writer protocol cutover, which v0.5.79–v0.5.89 refused. It checks the backend, the migration history and the automation runs before changing anything, stops the v0.5.77 backend under a held census right before the new version starts, and resumes after an interruption. Older workspaces go to v0.5.77 first (tale update -v 0.5.77,tale deploy). See Upgrades.tale update --version <x.y.z>updates again; before, it printed the CLI's version and changed nothing. With an older CLI, usetale update -v <x.y.z>.Checklist
bun run checkparts that this change touches pass locally: CLI typecheck, lint and unit suite (3200 pass; the one failure,tests/smoke-fixture.test.ts, is Bun hiding passing titles underCLAUDECODE=1and passes without it), platform typecheck, docs locale/structure/link checks (486),lint:links,lint:manual,knip,oxfmt.bun run lint:sastpasses (Opengrep) on the changed files: 205 rules, 0 findings. The upgrade check verifies TLS against the workspace's own Caddy root instead of disabling verification.docs/{en,de,fr}/self-hosted/operate/upgrades.md; CLI README,.github/CI.mdand.github/RELEASING.mdupdated.README.md/README.de.md/README.fr.md: N/A.Test plan
bun test src/lib/deployment/automation-cutover.test.ts src/lib/deployment/tag-automation-cutover.test.ts src/lib/actions/rollback.test.ts src/utils/update-version-flag.test.ts scripts/workspace-upgrade-check.test.tsintools/cli.automation-floor.integration.ts.gh workflow run workspace-upgrade.yml --ref main): both legs must pass on a hosted runner. Locally,bun tools/cli/scripts/workspace-upgrade-check.ts --from 0.5.77 --cli <CLI stamped 0.5.89> --workdir <dir>passed, and so did--from 0.5.88.