Skip to content

demo: throwaway incompatible migration for the rollback rehearsal (do not merge) - #801

Closed
allisonmahmood wants to merge 1 commit into
ci/790-rollback-rehearsalfrom
demo/790-incompatible-migration
Closed

allisonmahmood wants to merge 1 commit into
ci/790-rollback-rehearsalfrom
demo/790-incompatible-migration

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

Throwaway evidence for #797 / #790, closed and deleted once CI reports. It adds a migration that drops users.whats_new_seen, which the live release reads on every user lookup, and stops this branch's own code reading it. rollback-rehearsal should pass steps 1 and 2 and fail step 3, when the live release comes back.

Made by Claude Opus 5.5 in Claude Code, running in T3 Code.

@github-actions github-actions Bot added area:server Touches the server area size:s Under 100 changed lines labels Oct 19, 2026
@allisonmahmood
allisonmahmood force-pushed the ci/790-rollback-rehearsal branch from be94117 to 11acceb Compare October 19, 2026 14:03
@allisonmahmood
allisonmahmood force-pushed the demo/790-incompatible-migration branch from 1ebbe6f to 15e742a Compare October 19, 2026 14:04
@allisonmahmood
allisonmahmood force-pushed the ci/790-rollback-rehearsal branch from 11acceb to 9354b07 Compare October 19, 2026 14:04
@allisonmahmood
allisonmahmood force-pushed the demo/790-incompatible-migration branch from 15e742a to d460a08 Compare October 19, 2026 14:04
@github-actions github-actions Bot added area:ci CI, shared testing infrastructure, development scripts and tooling area:docs Touches the docs area and removed area:ci CI, shared testing infrastructure, development scripts and tooling area:docs Touches the docs area labels Oct 19, 2026
@allisonmahmood
allisonmahmood force-pushed the ci/790-rollback-rehearsal branch from 9354b07 to e1efd20 Compare October 19, 2026 14:13
@allisonmahmood
allisonmahmood force-pushed the demo/790-incompatible-migration branch from d460a08 to 585deff Compare October 19, 2026 14:13
@allisonmahmood
allisonmahmood force-pushed the ci/790-rollback-rehearsal branch from e1efd20 to 781f021 Compare October 19, 2026 14:17
@allisonmahmood
allisonmahmood force-pushed the demo/790-incompatible-migration branch from 585deff to 3475e5d Compare October 19, 2026 14:17
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Throwaway evidence for #797, done: its rollback-rehearsal passed steps 1 and 2 and failed step 3 (job). Closing and deleting the branch as planned.

@allisonmahmood
allisonmahmood deleted the demo/790-incompatible-migration branch October 19, 2026 14:24
allisonmahmood added a commit that referenced this pull request Oct 19, 2026
…lease (#797)

## What changed

A migration that breaks the live release used to surface only when a
rollback failed in production. Now a PR that changes a capability's
`src/migrations.ts` gets a **`rollback-rehearsal`** check. CI deploys
the PR onto data the live release seeded, rolls back to the live
release, and fails naming the step that broke. Every other PR passes the
check in seconds, so it can be required.

Closes #790

## Look at

**1. A deliberately incompatible migration fails it, on the right
step.** Throwaway draft PR #801 adds a migration that drops
`users.whats_new_seen`, which the live release reads on every user
lookup; its own code stops reading the column. It is closed now, and its
branch deleted. Its [CI
rehearsal](https://github.com/allisonmahmood/patchy-cloud/actions/runs/39267595825/job/118111462257)
on this PR's final code:

```
Rehearsing 03891e4 → 5624f17 → 03891e4 on one set of data.

▶ Step 1: the live commit (03891e4) seeds the data
  passed in 91s

▶ Step 2: HEAD (5624f17) upgrades it
  passed in 36s

▶ Step 3: the live commit (03891e4) comes back

Step 3 of 3, the live commit (03891e4) comes back, failed while exercising.
  signing in as [email protected] answered 500
  the server's request /dev/sign-in failed
  server-3.log:
  …
  [postgres] … ERROR:  column "whats_new_seen" does not exist at character 160
```

This PR's own [CI
rehearsal](https://github.com/allisonmahmood/patchy-cloud/actions/runs/39267586344/job/118111348334)
runs the full path, because it changes the rehearsal itself:

```
Rehearsing 03891e4 → 0586221 → 03891e4 on one set of data.
▶ Step 1: the live commit (03891e4) seeds the data
  passed in 81s
▶ Step 2: HEAD (0586221) upgrades it
  passed in 32s
▶ Step 3: the live commit (03891e4) comes back
  passed in 34s
Exercised rollback paths passed: 03891e4 → 0586221 → 03891e4, in 148s.
```

The job takes about 4 minutes, setup included. `03891e4` is production's
commit, which the check read itself.

**2. The seam, `scripts/rollback-rehearsal.ts`.** All three steps run on
one scratch worktree.

1. The live commit's own `pnpm dev up brightline` starts fresh,
migrates, seeds the scenario and loads its sample data.
2. `git checkout` of the PR, and that build's server starts on the same
`.local/dev` data and migrates it. The data is the Postgres cluster
(platform and company databases), the stored files and the credential
keys.
3. `git checkout` back to the live commit, and its server starts on that
data again.

Steps 2 and 3 swap only the server build. They start it the way the dev
runner's supervisor does, but seed nothing, so rows stay exactly as the
migration left them.

Each step is exercised the same way:
- **Health.** `/healthz/deep` answers.
- **CLI.** The build's own CLI, from the release its server serves, runs
`whoami` and `list`, and publishes a new version of a page.
- **Pages.** In Chromium, as the scenario's admin: `/`, `/patches`,
`/company`, every brightline patch and that page.
  - Each answers 200, with no 5xx and no uncaught exception.
- Each patch's live queries are delivered: as many snapshots of each as
the live release delivered in step 1, read from the server's wide
events.
  - Sample-data patches never fall back to their empty state.
- **Server events.** The server logs no failed request, call or live
query.

**3. Two choices.**
- **The skip compares the PR's merge commit with its first parent**, the
PR's own changes, rather than with the live commit. Whether to skip then
never depends on production, so a Deploy run in flight holds up only PRs
that change a migration.
- **The live commit is `/healthz/deep`'s `revision`**, with any
`-overlap-N` or `-seal-N` suffix stripped. The Deploy runs are judged by
AGENTS.md › Deploying's rule: the live commit is uncertain if any run is
unfinished, or if the run updated last didn't succeed. When it is
uncertain, the check fails and says why. It never guesses.

## How it was verified

- **CI:** this PR's run above passes, and #801's fails on step 3.
- **Locally:**
  - the full path passed in 125s;
- the same throwaway migration failed on step 3, with the same output as
in CI;
- SIGTERM during step 2 exits 143 and leaves no process, scratch
directory, git worktree or dev environment behind.
- **Four GPT 6.1 Sol review rounds,** summarised in PR comments, with
every finding fixed. The first round's blocking finding, that restarts
re-seeded rows and could hide a migration's damage, is what moved steps
2 and 3 to the seed-free server swap.
- **Not shown:**
- the quick skip on a PR without a migration, which every other PR shows
once this merges;
- the "uncertain" failures, since no Deploy run was in flight. Their
rule is AGENTS.md's, read through the same `gh run list` query.
- **Docs:**
- DEVELOPMENT › Checks covers the job beside CI's others, and ›
Migrations says to run `pnpm test:rollback-rehearsal`.
- OPERATIONS › Rolling back says what it covers and what it doesn't:
Object Storage, the fleet, anything brightline doesn't reach, and new
row shapes without a migration (#788).
  - `scenarios/README.md` notes the rehearsal depends on brightline.

## Release impact

Tick exactly one.

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — a CI job, a dev script and docs; no product
code changes.

- **What does a revert leave behind?** Nothing in production. Once
`rollback-rehearsal` is a required check, though, a revert leaves the
ruleset requiring a check that never reports, until it is taken out of
the ruleset.
- **Does the release before it still work with that?** Yes. No product
code, schema or data changes.

**For Allison after merge:** add `rollback-rehearsal` to the ruleset's
required checks.

Made by Claude Opus 5.5 in Claude Code, running in T3 Code.

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

Labels

area:server Touches the server area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant