Skip to content

[M3.5a] One-click rollback - #176

Merged
samuelmbabhazi merged 3 commits into
mainfrom
feat/m3.5a-rollback
Nov 7, 2026
Merged

samuelmbabhazi merged 3 commits into
mainfrom
feat/m3.5a-rollback

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

What changed

M3.5a: one-click rollback.

  • Why a new release: allocations and container names are keyed on the release number, so an old release cannot simply run again. POST …/deployments/{id}/rollback creates a new release copying the pinned image and configuration of the version that deployment ran, then queues it through the normal pipeline. No registry resolution is needed, since the digest is already known.
  • Rules:
    • the target must have succeeded (or been rolled back), otherwise 409 rollback_target_invalid;
    • it must not already be serving, otherwise 409 release_already_serving;
    • a release that never resolved its image answers 409 release_not_deployable;
    • referenced secrets must exist, and only one deployment may run at a time.
  • No replayed migrations: the release command does not run again. The UI says so, and that database migrations are not undone.
  • Unchanged: the application's own configuration, so the next normal deployment uses it again. Secrets use their current values.
  • rolled_back: when a rollback succeeds, the deployment it replaced moves to rolled_back through the aggregate, audited as deployment.rolled_back.
  • Web: a "Roll back" button on earlier versions that ran, never on the serving or a failed one. It follows the rollback like any deployment.
  • Docs: SPEC updated. The PLAN adds M3.5b: release diff view, removal of replaced containers, and image retention.

How it was tested

  • Unit tests: rollbackDraft (never replays the release command), target rules for every state, the pipeline superseding only after a rollback.
  • Web test: the button appears only on the right version, sends the exact request, and is disabled while running.
  • Full local gate passes: 292 API and 66 web tests, Go race tests, lint, drift, Semgrep, Prettier.
  • Not run: the new integration test for rollback over HTTP, because Docker is not reachable from this environment.
  • Not proven: the PLAN acceptance "rollback under load with zero failed requests" needs the VM suite, so M3.5 stays open.

Security considerations

Same permission as deploying (deploy.run), so developers stay off protected environments. Rollback is not destructive under rule 7: it deletes no data. Audited with the source release number.

review added 3 commits November 7, 2026 12:59
Deploys a new release copying the pinned image and configuration of a
version that ran, without replaying its release command. Targets that
never ran or already serve are refused, and a succeeded rollback marks
the replaced deployment rolled_back.

Signed-off-by: review <[email protected]>
@samuelmbabhazi
samuelmbabhazi merged commit 5703d3c into main Nov 7, 2026
1 of 10 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m3.5a-rollback branch November 7, 2026 11:03
samuelmbabhazi added a commit that referenced this pull request Nov 7, 2026
## What changed

Moved two suites into their own spec files, with no change to the tests
themselves:

- `application domains over HTTP` →
`application-domains-http.integration.spec.ts`
- `rollback over HTTP` → `rollback-http.integration.spec.ts`

## Why

**These two suites never ran.** Each started a second app in a file that
had already started one. Configuration is read once per module graph, so
the second app looked for the first one's deleted KEK file and failed in
setup with `KekError`. They shipped in #176 and #178 without any
integration run, so nobody saw it.

Also updates the PLAN status with what has now run.

## How it was tested

The first integration run of this code, on `main` at #187, against a
disposable local PostgreSQL 18.4 (`DATABASE_URL`, no Docker):

- **Before the split:** 304 passed, 3 failed, 2 skipped, and these 2
suites failed in setup.
- **After the split, these 4 files:** 9 of 9 pass, including rollback
and domain uniqueness.
- **The 3 failures** expect `23503` for `ON DELETE RESTRICT`, which
PostgreSQL 18 reports as `23001`. The project pins 17, where they should
pass, but that has not been run. They are left unchanged.

Not covered: a real Docker daemon or server, and the pinned PostgreSQL
17.

## Security considerations

Test-only and documentation change.

## Checklist

- [x] Integration tests run for the changed files
- [x] No new shell invocation, no new secret exposure path
- [x] PLAN updated

---------

Signed-off-by: review <[email protected]>
Co-authored-by: review <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant