incident response for a collection product · lesson 6 of 8 · sources checked 2026-11-30
rollback and roll forward
This lesson selects a rollback or a roll forward for each change class, and verifies the result with facts of the work.
purpose
During an incident, the fastest safe action can be to return one change to its last good version. Some changes cannot go back, and a wrong verification hides a fault that stays live. You must know the reverse path of each change before the incident starts.
objectives
- Select a rollback or a roll forward for each change class.
- Explain why a schema change or a data change does not roll back by itself.
- Verify the result with canary results and the stage reached, not with the deploy status.
- Write a rollback runbook for each change class.
new terms
- roll back
- To return one change class to its last good version.
- roll forward
- To fix a fault with a new release in place of a rollback.
- expand and contract
- A schema change in steps that keeps the old and the new code correct at each step.
how it works
A collector changes in four ways. Each way is a change class:
| change class | last good version | reverse path |
|---|---|---|
| Collector code | The previous release | Deploy the previous release again. |
| Browser image | The previous image digest | Start the workers on the previous digest. |
| Extractor | The previous extractor version | Load the previous version for the affected targets. |
| Target policy | The previous policy entry | Write the previous entry back. |
Each class has its own last good version and its own path. Thus the action of an incident is for one class, not for the whole system.
roll back or roll forward
To roll back is to return one change class to its last good version. It is the correct action when two conditions are true:
- The change log names a last good version for the class.
- The reverse path has a test before the incident.
To roll forward is to fix the fault with a new release. It is correct when the fix exists and the release path is fast. For example, a one-line repair of an extractor can go out faster than a rollback of three versions.
A roll forward has one trap. A fix can be merged but not deployed. Then the fault stays live. Thus the change log records the version that runs, not the version that is merged.
a schema change does not roll back by itself
A schema change or a data change has no simple rollback. Old code cannot read new rows, and new rows stay after the code goes back. Thus the runbook uses a change in steps, or a roll forward.
status of this section: from a public sourceIn 2014, Danilo Sato described the pattern "parallel change", also known as expand and contract. It has three phases Martin Fowler (Danilo Sato), source 1:
- Expand: the interface accepts both the old and the new version.
- Migrate: each client moves to the new version.
- Contract: the old version goes out.
checks after each step
A migration can fail to apply while its job reports success. Thus the runbook checks the schema state after each apply and after each rollback. The job status alone is not sufficient.
A cache can also keep a value in a shape that the running code does not expect. For example, after a rollback, the old code reads a cached record in the new shape. The runbook then clears the cache, or changes the shape version of the cache key.
a rollback that the target sees
A rollback of a browser image changes the clients that each target sees. For example, the workers go back to the previous browser version. A defender that learned the new fingerprint population then sees a second step in the traffic, back to the old population.
Thus the runbook writes the time of each rollback into the change log. A later fall in the same window then has a known suspect, and the team does not read it as a new defense.
verify with facts of the work
The deploy can end with no error while the fall continues. Thus the deploy status is not the verification. Two facts verify the result:
- The canary results: the small, repeated tests on known targets pass again.
- The distribution of the stage reached: the attempts of the affected cohort reach the last stage again. The distribution is in The stage-reached distribution over time.
For example, in a synthetic case, the canary pass share goes back to 0.94, but the share at the last stage stays at 0.62. Then the rollback did not clear the fall, and the incident goes back to the suspects.
A change can also go out to a part of the targets first. More detail is in Roll-out order by target cohort (not yet published) and Roll out a profile change.
the two sides
| automation side | detection side |
|---|---|
| A rollback is fast only for a change class that has a last good version and a tested path. A schema change has no simple rollback, so it goes forward in steps. | A rollback of a browser image returns an old fingerprint population. A defender that learned the new population sees a second step in the traffic. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| Roll back one change class | Fast, with a known result | The last good version must exist and have a tested path. | When the change log names the suspect change class |
| Roll back the whole system | One action | Each class goes back, also the classes with no fault. | Never as the first action |
| Roll forward | The fix goes out, and no old version returns. | The release path must be fast, and the fix must exist. | When the fix is small and ready |
| Expand and contract for a schema change | The old and the new code stay correct at each step. | More releases, and a longer change | For each schema change and each data change |
| Verify with canary results and the stage reached | The verification reads the work. | The canary and the stage data must exist before the incident. | Always |
diagram
rollback states of one change class
code example
The example finds the last good version of one change class in a synthetic release history. It prints the rollback action, and it checks synthetic facts after the deploy. It does not deploy anything.
Find the last good version of one change class, give the rollback action, and verify the result.
// Roll back one change class and verify the result. All values are synthetic.
type ChangeClass = "collector code" | "browser image" | "extractor" | "target policy";
type Release = { changeClass: ChangeClass; version: string; verifiedGood: boolean };
type Facts = { canaryPassShare: number; stageSixShare: number }; // shares from 0 to 1
// The release history, oldest first. Each version is a synthetic label.
const history: Release[] = [
{ changeClass: "extractor", version: "ex-41", verifiedGood: true },
{ changeClass: "browser image", version: "img-17", verifiedGood: true },
{ changeClass: "extractor", version: "ex-42", verifiedGood: true },
{ changeClass: "extractor", version: "ex-43", verifiedGood: false },
];
function lastGood(cls: ChangeClass): Release | undefined {
return history.filter((r) => r.changeClass === cls && r.verifiedGood).at(-1);
}
// Example limit of my model: the result must come back to 0.05 of the value before the fault.
function verify(before: Facts, after: Facts): string[] {
const faults: string[] = [];
if (before.canaryPassShare - after.canaryPassShare > 0.05) faults.push("canary pass share is still low");
if (before.stageSixShare - after.stageSixShare > 0.05) faults.push("share at the last stage is still low");
return faults;
}
const cls: ChangeClass = "extractor";
const current = history.filter((r) => r.changeClass === cls).at(-1)!;
const good = lastGood(cls);
if (!good) throw new Error(`no last good version for ${cls}: roll forward`);
console.log(`change class: ${cls}`);
console.log(`current version: ${current.version}, last good version: ${good.version}`);
console.log(`action: roll back ${cls} from ${current.version} to ${good.version}`);
const before: Facts = { canaryPassShare: 0.95, stageSixShare: 0.9 };
const afterRollback: Facts = { canaryPassShare: 0.94, stageSixShare: 0.62 };
const faults = verify(before, afterRollback);
console.log(`the deploy ended; verification: ${faults.length === 0 ? "verified" : "not verified"}`);
for (const f of faults) console.log(` - ${f}`);
if (faults.length > 0) console.log("next: the rollback did not clear the fall; go back to the suspects");output
The change class, the current and the last good version, the action, and the result of the verification with its faults.
change class: extractor
current version: ex-43, last good version: ex-42
action: roll back extractor from ex-43 to ex-42
the deploy ended; verification: not verified
- share at the last stage is still low
next: the rollback did not clear the fall; go back to the suspectsThe output shows that the canary result passes the limit, but the share at the last stage does not. The deploy ended, but the result is not verified.
failure modes
| problem | cause | correction |
|---|---|---|
| A fixed defect stays live. | The change log records the merged version, not the version that runs. | Record the deployed version in the change log. |
| A migration did not apply, and the job reported success. | The runbook trusts the job status. | Check the schema state after each apply and after each rollback. |
| Old code fails on a cached value after a rollback. | The cache keeps the value in the new shape. | Clear the cache, or change the shape version of the cache key. |
| The team closes the incident, and the fall continues. | The verification read the deploy status. | Verify with canary results and the stage reached. |
| A rollback of the whole system removes good changes. | Nobody named the suspect change class. | Roll back one change class at a time. |
check questions
The change log names a last good extractor version, and its reverse path had a test. Which action is correct?
- Roll back the whole system.
- Roll back the extractor to its last good version.
- Wait for a new release of the browser image.
answer
b. Roll back the extractor to its last good version.
A rollback is correct for one change class when a last good version exists and its path has a test.
A one-line fix of the fault is ready, and the release path is fast. Which action is correct?
- A rollback of three versions
- No action until the next release
- A rollback of each change class
- A roll forward with the fix
answer
d. A roll forward with the fix
A roll forward is correct when the fix exists and the release path is fast.
Explain why a schema change does not roll back by itself.
sample answer
Old code cannot read the new rows, and the new rows stay after the code goes back. Thus the change goes in steps, with expand and contract, or the team rolls forward.
The deploy of a rollback ends with no error. The share at the last stage stays low. What is the result?
- Not verified: the incident goes back to the suspects.
- Verified, because the deploy ended with no error.
- Verified, because the canary results pass.
answer
a. Not verified: the incident goes back to the suspects.
The deploy status is not the verification. The stage reached must agree with the value before the fault.
List the items of a rollback runbook for one change class.
sample answer
The runbook gives the last good version of the class, and its reverse path. It also gives the checks after each step, for example the schema state and the cache. Last, it gives the verification with canary results and the stage reached.
exercise
exercise Do this task on paper, with the synthetic facts below.
The facts of the incident:
- The suspect change class is the browser image.
- The change log gives the last good image digest, and its reverse path had a test last week.
- After the rollback, the canary pass share is 0.93. It was 0.95 before the fault.
- After the rollback, the share at the last stage is 0.88. It was 0.90 before the fault.
- The example limit is 0.05.
- Write the action: a rollback or a roll forward.
- Write the result of the verification.
- Write the reverse path and the verification of the rollback runbook for this change class.
sample answer
The answer uses the five facts of the incident.
A last good digest exists, and its path has a test. Thus the action is a rollback of the browser image only. The canary share falls by 0.02, and the share at the last stage falls by 0.02. Both are in the limit of 0.05, thus the result is verified.
The runbook lines: "Start the workers on the previous image digest from the change log." "Verify with the canary results and the share at the last stage, not with the deploy status."
sources
- Parallel Change, Martin Fowler (Danilo Sato), article, read 2026-11-22
- My model of the change classes, the reverse paths, and the verification of a rollback, 2026-11 (not public).