Release and Rollback
Plan the rollback before the rollout. A change that cannot be undone or observed is not
ready, whatever its tests say.
Process
Answer the rollback question first. What single action undoes this, how long does it
take, and can someone do it at 3am from a phone? If there is no answer, stop here and
escalate; that is a design problem, not a release problem.
Sequence so each step is independently reversible. The safe shape for a data change
is four deploys, not one:
- Schema change that is backward compatible (add, do not rename or drop).
- Code that writes both shapes and reads the old one.
- Code that reads the new shape.
- Removal of the old shape, after usage is measured at zero.
Four reversible deploys beat one irreversible one every time.
Choose the rollout shape and the abort criterion together. Canary, percentage,
ring, or flag. The abort criterion is a number measured from a named query, decided
before the rollout starts. Deciding it in the moment, while looking at a graph you want
to look good, does not work.
Make it observable before it ships. You must be able to answer from telemetry alone:
is the new path being taken, is it succeeding, how long does it take. Write the three
queries down. See references/observability-checklist.md.
Feature flags with a lifecycle. A flag has an owner, a default, a removal date, and
someone who can flip it without a deploy. A flag with no removal plan becomes permanent
configuration and doubles the state space forever.
Write the runbook for the alert, not for the service. The reader is woken up and has
five minutes.
Check the pipeline. Reproducible build, pinned toolchain, no secret in scope for
untrusted pull-request code, and a green run you can point at.
Release plan
## Release: <change>
- **Rollback:** <single action> — takes <duration> — executed in staging: yes/no
- **Steps:** <ordered, each independently reversible>
- **Flag:** <name, default, who can flip it, removal date>
- **Rollout:** <canary %, soak duration, then next stage>
- **Abort if:** <metric crosses <threshold>, from query `<q>`>
- **Observability:** <the three queries: taken / succeeding / duration>
- **Runbook:** <path>
- **Blast radius if wrong:** <who, how many, for how long>
Runbook
# Alert: <name>
**Means:** <the user-visible symptom>
**Check first:** <one dashboard or query>
**Common causes:** <ranked, each with its distinguishing signal>
**Mitigation:** <the action that stops the bleeding, before diagnosis>
**Escalate to:** <who, and when>
Migrations
- Run it forward against a copy of realistic production data, not a fixture.
- Execute the rollback at least once, somewhere real. An untested rollback is a plan, not
a capability.
- Long-running migrations run in batches with progress and a resume point.
- Check locking on large tables. "It only adds a column" is true right up until it takes a
lock and the site stops.
Verification
- Rollback is a single documented action with a known duration, executed at least once.
- The abort criterion is a number from a named query.
- The three observability questions have concrete queries written down.
- Every alert added has a runbook and an owner.
- Every flag has a removal date.
Red flags
| Thought |
Reality |
| "We can roll forward if it breaks" |
Roll-forward under pressure turns a small outage into a long one. |
| "The migration is safe, it only adds a column" |
With a default, on a large table, with a lock. Check. |
| "We will watch it after deploy" |
Watch what? Name the query before you ship. |
| "It passed CI so it is ready" |
CI proves the code. It says nothing about rollback or observability. |
| "Alert on CPU" |
Alert on the symptom a user feels. CPU is a dashboard. |
| "We will remove the flag later" |
Give it a date now, or it is permanent. |
| "Rollback should work" |
Should is not evidence. Run it. |
1---2name: release-and-rollback3description: Release and Rollback4---56# Release and Rollback78Plan the rollback before the rollout. A change that cannot be undone or observed is not9ready, whatever its tests say.1011## Process12131. **Answer the rollback question first.** What single action undoes this, how long does it14 take, and can someone do it at 3am from a phone? If there is no answer, stop here and15 escalate; that is a design problem, not a release problem.16172. **Sequence so each step is independently reversible.** The safe shape for a data change18 is four deploys, not one:1920 1. Schema change that is backward compatible (add, do not rename or drop).21 2. Code that writes both shapes and reads the old one.22 3. Code that reads the new shape.23 4. Removal of the old shape, after usage is measured at zero.2425 Four reversible deploys beat one irreversible one every time.26273. **Choose the rollout shape and the abort criterion together.** Canary, percentage,28 ring, or flag. The abort criterion is a number measured from a named query, decided29 before the rollout starts. Deciding it in the moment, while looking at a graph you want30 to look good, does not work.31324. **Make it observable before it ships.** You must be able to answer from telemetry alone:33 is the new path being taken, is it succeeding, how long does it take. Write the three34 queries down. See `references/observability-checklist.md`.35365. **Feature flags with a lifecycle.** A flag has an owner, a default, a removal date, and37 someone who can flip it without a deploy. A flag with no removal plan becomes permanent38 configuration and doubles the state space forever.39406. **Write the runbook for the alert, not for the service.** The reader is woken up and has41 five minutes.42437. **Check the pipeline.** Reproducible build, pinned toolchain, no secret in scope for44 untrusted pull-request code, and a green run you can point at.4546## Release plan4748```markdown49## Release: <change>50- **Rollback:** <single action> — takes <duration> — executed in staging: yes/no51- **Steps:** <ordered, each independently reversible>52- **Flag:** <name, default, who can flip it, removal date>53- **Rollout:** <canary %, soak duration, then next stage>54- **Abort if:** <metric crosses <threshold>, from query `<q>`>55- **Observability:** <the three queries: taken / succeeding / duration>56- **Runbook:** <path>57- **Blast radius if wrong:** <who, how many, for how long>58```5960## Runbook6162```markdown63# Alert: <name>64**Means:** <the user-visible symptom>65**Check first:** <one dashboard or query>66**Common causes:** <ranked, each with its distinguishing signal>67**Mitigation:** <the action that stops the bleeding, before diagnosis>68**Escalate to:** <who, and when>69```7071## Migrations7273- Run it forward against a copy of realistic production data, not a fixture.74- Execute the rollback at least once, somewhere real. An untested rollback is a plan, not75 a capability.76- Long-running migrations run in batches with progress and a resume point.77- Check locking on large tables. "It only adds a column" is true right up until it takes a78 lock and the site stops.7980## Verification8182- Rollback is a single documented action with a known duration, executed at least once.83- The abort criterion is a number from a named query.84- The three observability questions have concrete queries written down.85- Every alert added has a runbook and an owner.86- Every flag has a removal date.8788## Red flags8990| Thought | Reality |91|---------|---------|92| "We can roll forward if it breaks" | Roll-forward under pressure turns a small outage into a long one. |93| "The migration is safe, it only adds a column" | With a default, on a large table, with a lock. Check. |94| "We will watch it after deploy" | Watch what? Name the query before you ship. |95| "It passed CI so it is ready" | CI proves the code. It says nothing about rollback or observability. |96| "Alert on CPU" | Alert on the symptom a user feels. CPU is a dashboard. |97| "We will remove the flag later" | Give it a date now, or it is permanent. |98| "Rollback should work" | Should is not evidence. Run it. |