Public: anyone can read this; the crew can change it.

Self-deploy, step 4: rollback to a kept release, from `--rollback <sha>` and a writer's button on a releases page that lists sha, landing and healthy-since #1759

Closed opened this
Closed without merging

Rollback to a kept release now works from bun src/main.ts --rollback and from a Roll back button on a new /releases page, both through step 3's swap. tsc is clean, and the new tests plus the related suites (release-swap, schema-, reserved-names, studio, shards, check-list, hollow) pass.

Notes

stopped closed without shipping deploy ca4abc5

opened this

Rollback to a kept release now works from bun src/main.ts --rollback <sha> and from a Roll back button on a new /releases page, both through step 3's swap. tsc is clean, and the new tests plus the related suites (release-swap, schema-*, reserved-names, studio, shards, check-list, hollow) pass. The CLI's success path (swap, then drain) is not covered by a test, and /releases was not checked in a real browser.

What changed

  • CLI: --rollback <sha> takes a full sha or a unique prefix of 7 or more. It starts the kept releases/<sha>/ with the same hand-over as a landing, then sends SIGTERM to the serving process named in the new $FORGE_DATA/forge.pid. An unknown sha prints one line (rollback refused: no kept release …) and exits 1.
  • /releases page (src/web/pages/releases.ts):
    • Each row shows sha, landed pull, when, healthy since, the live one marked and failed preflights with their line.
    • A writer of FORGE_REPO gets Roll back on each kept, green, not-live release.
    • The press is same-origin checked and needs an rw scope.
    • The home shows live: <sha> since <time>.
  • New files: src/release/rollback.ts holds the shared rollback logic and src/release/live.ts holds the live record and pidfile. Migration 85 adds a release_live table, written at boot when FORGE_COMMIT is set; "healthy since" is that boot time. releases is now a reserved name.
  • Migration policy change: a build that has the migration table now serves on a database ahead of it, where it used to refuse. A rollback needs this to boot an older tree. Migrations are already guarded as additive-only by test/schema-additive.test.ts. A database from before the table existed and ahead of the build is still refused. I rewrote the old "data ahead is still refused" test to match; it was testing the policy this issue reverses.
  • Tests: test/release-rollback.test.ts is in GATE. It covers sha resolution, the CLI refusals, healthy-since, and this tree booting and answering / on a database one migration ahead. It also covers the page (button only for a writer, escaping, cross-origin 403, unknown sha refused, home line) and a button press that serves the old sha and drains.

Left out

  • The CLI does not know which commit is serving, so it will not refuse rolling back to the live sha; the button does.
  • The CLI assumes FORGE_SSH_PORT=0 the way a swap does, and the swap still needs tcp_migrate_req=1, so I did not test the CLI success path here.
  • "N-1 against N's schema" is this tree against a database with one extra migration, not a build from an earlier commit.

Try it

  • Run with FORGE_REPO and FORGE_SELF_SWAP=1, open /releases, and press Roll back on an older row.
  • Or run bun src/main.ts --rollback <sha>.

🤖 Generated with Claude Code

Closes #1664

commented

Parked by the crew: the check failed ("db > future schema refuses to run") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs