the target as configuration · lesson 3 of 6 · sources checked 2026-11-22
roll out a profile change
This lesson runs a new version of a target profile beside the active version, and promotes it or rolls it back by a written rule.
status of this lesson: from a public sourcepurpose
A new version of a target profile can pass each step of the store gate and still break the records of one layout. You must see its effect on real work before it takes all the work. You must also have a fast way back to the last good version.
objectives
- Run a new version in a shadow run beside the active version, on a sample of the same work.
- Compare the two versions on each facet against a rule that you wrote before the run.
- Promote the new version or roll it back, and record each step.
- State what the defender sees during a shadow run and after a promotion.
new terms
- promote
- To make a shadow version of a profile the active version.
how it works
In a shadow run, the new version does the same work as the active version. It reads a sample of the same pages of the target, in the same time window. Only the output of the active version goes into the data. The output of the new version goes only to the comparison. Thus the active version is the control.
the control and the candidate
The Scientist library of GitHub uses the same pattern for a change of code GitHub, source 1. Its documentation gives these properties of an experiment:
- One part is the control, and the other part is the candidate.
- A run always returns the result of the control.
- The run compares the result of the candidate with the result of the control.
- The experiment publishes this information.
A shadow run of a target profile has the same roles. For example, version 7 is the control, and version 8 is the candidate.
the facets to compare
Compare the two versions page by page, on each facet:
- the verdict of each attempt;
- the stage reached;
- the cost of each attempt;
- the extracted records, field by field.
For example, version 8 reaches the listing stage on a page, but not the detail stage. Version 7 reaches the detail stage on the same page. The stage facet then disagrees on that page.
a rule that you write before the run
Write the rule before the shadow run starts. When you write it after you see the values, the values choose the rule. For example, a rule can be: promote when the lower bound of the 95% interval of the agreement is 90% or more on each facet.
Agreement measures a change, not quality. A version that corrects a fault also disagrees with the active version. Thus the rule names the record fields that the change must alter. A difference in another field stops the promotion.
promote, roll back, and record
When the rule passes, you promote the new version. A promoted version becomes active when it takes all the work of the target. When the rule fails, you roll back to the last good version. The active version then stays as it is.
Each step writes one line of a roll-out record. The line holds the two version numbers, the sample, the facets and their intervals, and the rule. It also holds the decision, the person, and the time. For example, a line can say "version 8, rule failed on the stage facet, rolled back by team-a".
the load and what the defender sees
A shadow run with its own fetch reads each page of its sample a second time. Thus it doubles the load on the target for that sample.
The pace and the volume cap of the target profile apply to the sum of the two versions, not to each version. For example, with a pace of 10 seconds, each version reads one page each 20 seconds. This keeps the shadow run inside the politeness budget of the target.
A new version can also bring a new pace or a new method class. The defender then sees a new population on the site at the time of the promotion. When a change is only in the extractor or the oracle, one fetch can feed both versions. Then the load does not double.
A new version of the whole collector, the release program, and a return to a good version during an incident are different topics. More detail is in Shadow traffic in production (not yet published), Roll-out order by target cohort (not yet published), and Rollback and roll forward.
the two sides
| automation side | detection side |
|---|---|
| A shadow run finds a change to a target profile that breaks the stage reached before customers see it. A shadow run with its own fetch also doubles the load on the target for its sample. | A new version can bring a new pace or a new method class. The detection side sees a new population on the site at the time of the promotion. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| A shadow run with its own fetch | It tests the full new version, also a new pace or method. | The load on the target doubles for the sample. | When the change touches the fetch |
| One fetch for both versions | No added load | It does not test a change of the fetch. | When the change is only in the extractor or the oracle |
| A rule written before the run | The values cannot choose the rule. | You must know the expected changes first. | Always |
| A large sample | Narrow intervals | More time and more load | When the facets agree closely and a small fault matters |
| Promotion by a person | A person reads the record before the change. | Slower | For a change of the method class or the pace |
| Automatic promotion by the rule | Fast and the same each time | A wrong rule promotes a wrong version. | For a change of the extractor with a tested rule |
diagram
the states of one version of a target profile
code example
The example compares one shadow version with the active version on a synthetic sample of 200 lab pages. It computes the agreement of each facet with a 95% interval, applies the written rule, and writes a roll-out record.
It compares three facets: the verdict, the stage reached, and the records. It leaves out the cost facet, the person, and the time.
Compare a shadow version with the active version on one lab sample, apply a written rule, and write a roll-out record.
// Shadow comparison: compare a shadow version with the active version on one
// lab sample, apply a written rule, and write a roll-out record.
// All data is synthetic. The code makes the sample of 200 lab pages.
type Facet = "verdict" | "stage" | "records";
type PageResult = Record<Facet, string>;
type FacetResult = { agree: number; n: number; low: number; high: number };
const FACETS: Facet[] = ["verdict", "stage", "records"];
// 95% Wilson interval of a share.
function wilson(agree: number, n: number, z = 1.96): [number, number] {
const p = agree / n;
const centre = (p + (z * z) / (2 * n)) / (1 + (z * z) / n);
const half = (z * Math.sqrt((p * (1 - p)) / n + (z * z) / (4 * n * n))) / (1 + (z * z) / n);
return [centre - half, centre + half];
}
const round4 = (x: number) => Math.round(x * 10000) / 10000;
function compare(active: Record<string, PageResult>, shadow: Record<string, PageResult>) {
const pages = Object.keys(active).filter((p) => p in shadow).sort();
const result = {} as Record<Facet, FacetResult>;
for (const facet of FACETS) {
const agree = pages.filter((p) => active[p][facet] === shadow[p][facet]).length;
const [low, high] = wilson(agree, pages.length);
result[facet] = { agree, n: pages.length, low: round4(low), high: round4(high) };
}
return result;
}
function decide(result: Record<Facet, FacetResult>, floors: Record<Facet, number>): [string, string] {
for (const facet of FACETS) {
const low = result[facet].low;
if (low < floors[facet]) return ["roll back", `${facet}: lower bound ${low} is below ${floors[facet]}`];
}
return ["promote", "each facet meets the written rule"];
}
// The shadow version differs from the active version on some pages.
const active: Record<string, PageResult> = {};
const shadow: Record<string, PageResult> = {};
for (let i = 1; i <= 200; i++) {
const id = `page-${String(i).padStart(3, "0")}`;
active[id] = { verdict: "pass", stage: "detail", records: "r1" };
shadow[id] = {
verdict: i % 50 === 0 ? "fail" : "pass",
stage: i % 10 === 3 ? "listing" : "detail",
records: i % 25 === 7 ? "r2" : "r1",
};
}
const rule = { text: "promote when the lower bound is 0.9 or more on each facet", floors: { verdict: 0.9, stage: 0.9, records: 0.9 } };
const result = compare(active, shadow);
const [decision, reason] = decide(result, rule.floors);
const target = process.argv[2] ?? "shop.example";
const record = { target, activeVersion: 7, shadowVersion: 8, rule: rule.text, facets: result, decision, reason };
console.log(JSON.stringify(record, null, 2));output
The roll-out record: the versions, the rule, the agreement and the interval of each facet, and the decision with its reason.
{
"target": "shop.example",
"activeVersion": 7,
"shadowVersion": 8,
"rule": "promote when the lower bound is 0.9 or more on each facet",
"facets": {
"verdict": {
"agree": 196,
"n": 200,
"low": 0.9497,
"high": 0.9922
},
"stage": {
"agree": 180,
"n": 200,
"low": 0.8506,
"high": 0.9343
},
"records": {
"agree": 192,
"n": 200,
"low": 0.9231,
"high": 0.9796
}
},
"decision": "roll back",
"reason": "stage: lower bound 0.8506 is below 0.9"
}The output shows that the stage facet has a lower bound of 0.8506, which is below the floor of 0.9. Thus the record gives the decision to roll back.
data
agreement of two shadow profile versions with the active version, by facet
status of this figure: measured by me
lines: interval, level 0.95
source: Lab result of this course: active and shadow profile versions on one lab target, 400 pages; date 2026-11-13; condition: One invented lab target with three page layouts. The record fields have their own count: 378 pages for version 2 and 382 for version 3. The agreement measures a change, not quality.
data table
| series | facet | % | interval |
|---|---|---|---|
| shadow version 2 | verdict | 94.5 | 91.81 to 96.34 (level 0.95) |
| shadow version 2 | stage reached | 81.25 | 77.13 to 84.77 (level 0.95) |
| shadow version 2 | all record fields | 85.98 | 82.12 to 89.12 (level 0.95) |
| shadow version 3 | verdict | 95.5 | 93 to 97.13 (level 0.95) |
| shadow version 3 | stage reached | 88 | 84.45 to 90.83 (level 0.95) |
| shadow version 3 | all record fields | 92.15 | 89.01 to 94.44 (level 0.95) |
The chart comes from a lab run of this course on one invented lab target. Neither shadow version agrees with the active version on each page, also on the verdict. The written rule, not the agreement alone, decides which change is correct.
I apply the example rule above to the chart: promote when the lower bound is 90% or more on each facet.
For version 2, the lower bounds are 91.81% for the verdict, 77.13% for the stage reached, and 82.12% for the record fields. Two bounds are below 90%, thus the example rule rolls back version 2.
For version 3, the lower bounds are 93% for the verdict, 84.45% for the stage reached, and 89.01% for the record fields. Two bounds are below 90%, thus the example rule also rolls back version 3.
failure modes
| problem | cause | correction |
|---|---|---|
| A version that breaks one layout takes all the work. | The new version went to the work with no shadow run. | Run each new version in shadow on a sample first. |
| The rule moves after each run until the new version passes. | The rule was written after the values were known. | Write the rule before the run, and keep it in the roll-out record. |
| A correct fix is rolled back. | The rule asks for full agreement, and the fix alters some fields. | Name in the rule the fields that the change must alter. |
| The target gets twice the planned load. | The pace of the target profile applies to each version, not to the sum. | Apply the pace and the volume cap to the sum of the two versions. |
| Nobody can say why a version is active. | No step wrote a line of the roll-out record. | Write a line for each step: shadow, promotion, rollback, retirement. |
check questions
In a shadow run of a new version of a target profile, where does the output of the new version go?
- Into the data, beside the output of the active version
- Only to the comparison with the active version
- Into the data, in place of the output of the active version
answer
b. Only to the comparison with the active version
Only the output of the active version goes into the data. The active version is the control, and the new version is the candidate.
Explain why you write the rule of a shadow run before the run. Also explain why the rule names the fields that the change must alter.
sample answer
When the rule is written after the values are known, the values choose the rule. Agreement measures a change, not quality. A version that corrects a fault also disagrees with the active version, so the rule names the fields that the change must alter. A difference in another field stops the promotion.
The rule of a shadow run fails on the stage facet. What is the next step?
- Roll back to the last good version, and write the line of the roll-out record.
- Promote the new version, because the verdict facet passes.
- Change the rule until the stage facet passes.
answer
a. Roll back to the last good version, and write the line of the roll-out record.
When the rule fails, the operator rolls back, and the active version stays as it is. Each step writes one line of the roll-out record.
A shadow run with its own fetch reads a sample of pages. The target profile has a pace of 10 seconds. What pace must each of the two versions keep?
- 10 seconds for each version
- 5 seconds for each version
- 20 seconds for each version
answer
c. 20 seconds for each version
The pace and the volume cap apply to the sum of the two versions. Thus each version reads one page each 20 seconds, and the load on the target stays inside its budget.
A new version of a target profile changes the method class. State what the defender sees at the time of the promotion.
sample answer
The defender sees a new population on the site at the time of the promotion, because the new version brings a new method class. During the shadow run, a version with its own fetch also doubles the load for its sample.
exercise
exercise Do this task on paper. Use these synthetic results of a shadow run of version 8 against version 7. All values are synthetic.
The written rule: promote when the lower bound of the 95% interval is 90% or more on each facet. The change must alter only the record field price.
| facet | agreement | lower bound | upper bound |
|---|---|---|---|
| Verdict | 97.0% | 94.8% | 98.3% |
| Stage reached | 91.5% | 88.4% | 93.9% |
Record fields other than price | 99.0% | 97.5% | 99.6% |
- For each facet, write if its lower bound meets the rule.
- Write the decision: promote or roll back.
- Write the line of the roll-out record for the decision.
sample answer
The answer uses the written rule and the three lower bounds.
The verdict and the record fields meet the rule. The stage reached does not meet it, because its lower bound of 88.4% is below 90%. Thus the decision is to roll back, and version 7 stays active. A correct line is: "version 8, rule failed on the stage facet (lower bound 88.4%), rolled back, version 7 stays active", with the person and the time.
sources
- Scientist, GitHub, source code, read 2026-11-22
- My model of the shadow run, the written rule, and the roll-out record, 2026-11 (not public).