test strategy for a collection product · lesson 7 of 7 · sources checked 2026-11-30
from a production failure to a lab reproduction
This lesson exports one failed attempt as a scrubbed bundle, repeats it in the lab, and records which part of the own system failed.
purpose
A failure in production gives one chance to see its cause, and a new live attempt is more load on the target. A copy of the failed attempt lets you test each cause in the lab. Then the fix rests on a cause that you saw, not on a guess.
objectives
- List the parts of a run bundle.
- Scrub a run bundle before it leaves the production system.
- Reproduce a failure in the lab, and name the part of the own system that differs.
- Write a reproduction record for a failure that does not reproduce.
new terms
- run bundle
- The redacted export of one attempt that holds its manifest, facets, traffic record, trace, and screenshots.
- reproduction record
- The record of a reproduction in the lab. It has the result, the part of the own system that differs, or the reason that it did not reproduce.
how it works
A run bundle is the export of one failed attempt. A reproduction record is the result of its repeat in the lab. The repeat runs only against your own lab target, and it sends nothing to the production target.
the parts of a run bundle
A run bundle holds eight parts:
- the run manifest: the reason, the versions, and the conditions of the run;
- the version of the profile;
- the configuration of the attempt;
- each facet that the operator observed, for example the status and the body class;
- the stage reached;
- the traffic record, for example a HAR file;
- the browser trace;
- the screenshots.
The bundle gets a content hash for each file, so that a later reader can see a change.
what a browser trace holds
status of this section: from a public sourceThe documentation of the Playwright trace viewer lists the contents of a trace Microsoft, source 1:
- each action, with a copy of the DOM before and after it;
- a film strip of screenshots;
- the browser console logs;
- each network request, with the request and response headers and bodies;
- metadata, for example the browser and the viewport.
scrub the bundle first
A trace and a traffic record hold the bodies of requests and responses. Thus they can hold a cookie, a credential, an account name, or personal data. The bundle leaves the production system only after you scrub each part.
I scrub by field class. Each value of a class becomes a typed placeholder, for example "[cookie]" or "[credential]". A part that the export cannot scrub stays in production. The hash goes on the scrubbed file.
repeat the failure in the lab
The repeat has two methods:
- Replay the traffic record through the extractor and the success oracle. A replay has no live transport and no fresh state.
- Do a lab run: run the same configuration against a lab copy of the flow.
Start with the replay, because it is fast and it tests the extractor alone. Use the lab run when the replay does not give the production result. For example, a replay of a slow target gets each stored response at once, so the time fault does not occur.
Compare the lab result with the production result. Then name the part of the own system that differs. The failure class points to the part:
| failure class | part of the own system to examine |
|---|---|
| Layout change | The extractor and its selectors |
| Slow target | The time limits of the own client |
| Expired state | The stored state of the profile |
| Refusal by a supplier | The live path to the target, outside the lab |
a worked case
example This case is synthetic. A production attempt reaches the results page with the status 200. The success oracle refuses it, because the record holds no items. The replay of the traffic record gives the same empty record. Thus the fault is in the extractor: a selector no longer matches the new layout of the results page.
when the failure does not reproduce
A failure can stay away in each lab method. Then the record says why, for example "the lab has no live supplier". A failure that does not reproduce, with no own change, can come from the target or from the live path.
Such a failure goes to the confirmation of a target change, and to the monitors for a change below the page. More detail is in A target change with no visible change. The monitors are in Silent failure and the change below the page. A new live attempt only for the diagnosis is a new attempt that the defender sees. More detail is in The cost of a diagnosis.
The reproduction record holds the bundle hash, the method, the result, the part that differs, and the next step. When the failure did not reproduce, it holds the reason in place of the part.
the two sides
| automation side | detection side |
|---|---|
| A repeat in the lab tests a cause with no further load on the target. A failure that does not reproduce points to the target or to the live path. | A replay in the lab sends nothing to the target. A new live attempt for the diagnosis is a new attempt that the defender sees. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| Replay of the traffic record | Fast, and it tests the extractor alone | No live transport and no fresh state | First, for each failure |
| Lab run with the same configuration | It shows faults of time and of stored state. | Slower, and it must have a lab copy of the flow | When the replay does not give the production result |
| A new live attempt | It shows the target as it is now. | It is load on the target, and the defender sees it. | Only inside the budget of the diagnosis, on a permitted target, and never after a block or a refusal |
| Export the full trace | All facts of the attempt | The trace holds bodies and personal data. | Only after the scrub of each part |
| Keep the trace in production | No data leaves the system. | The lab repeat has less to compare. | When the export cannot scrub the trace |
diagram
from a production failure to a lab reproduction
code example
The example exports a run bundle from the parts of one failed attempt. It scrubs each value of a field class, keeps the trace in production, and writes a hash for each exported part. The parts are synthetic and stay in memory.
Collect the manifest, the facets, and the traffic record of a failed attempt. Scrub by field class, also in the header and cookie lists of a HAR file, hold the trace, and write a hash for each part.
import { createHash } from "node:crypto";
// Field classes that leave the production system only as a typed placeholder.
const SCRUB = new Map<string, string>([["cookie", "[cookie]"], ["set-cookie", "[cookie]"], ["authorization", "[credential]"],
["account", "[account]"], ["egress", "[egress address]"], ["host", "[lab host]"]]);
// Replace each value of a field class, at each depth. A HAR file keeps each
// header and each cookie as an object with "name" and "value".
function scrub(value: unknown): unknown {
if (Array.isArray(value)) return value.map(scrub);
if (value === null || typeof value !== "object") return value;
const obj = value as Record<string, unknown>;
const name = typeof obj.name === "string" ? obj.name.toLowerCase() : "";
const out: Record<string, unknown> = {};
for (const [key, item] of Object.entries(obj)) {
const k = key.toLowerCase();
if (SCRUB.has(k)) out[key] = SCRUB.get(k);
else if (k === "value" && SCRUB.has(name)) out[key] = SCRUB.get(name);
else if (k === "cookies" && Array.isArray(item)) out[key] = item.map((c) => ({ ...(scrub(c) as object), value: "[cookie]" }));
else out[key] = scrub(item);
}
return out;
}
// The parts of one failed attempt. All values are synthetic.
const header = (name: string, value: string) => ({ name, value });
const attempt: Record<string, string> = {
"manifest.json": JSON.stringify({ reason: "oracle refused", profile: "v12", account: "lab-user-01", egress: "egress-a" }),
"facets.json": JSON.stringify({ status: 200, bodyClass: "results-empty" }),
"traffic.har": JSON.stringify({ log: { entries: [{
request: { method: "GET", url: "lab.example/search", cookies: [{ name: "sid", value: "synthetic-1" }],
headers: [header("Host", "lab.example"), header("Cookie", "sid=synthetic-1"), header("Authorization", "Bearer synthetic-2"), header("Accept", "text/html")] },
response: { status: 200, headers: [header("Set-Cookie", "sid=synthetic-3")], cookies: [{ name: "sid", value: "synthetic-3" }] },
}] } }),
"trace.zip": "synthetic binary",
};
const PARTS = ["manifest.json", "facets.json", "traffic.har", "trace.zip", "screenshots.json"];
const bundle: Record<string, string> = {};
for (const part of PARTS) {
const source = attempt[part];
if (source === undefined) {
console.log(`${part}: missing`);
continue;
}
if (part === "trace.zip") {
// A trace holds network bodies and page snapshots. It stays in production.
console.log(`${part}: held: scrub the trace first`);
continue;
}
bundle[part] = JSON.stringify(scrub(JSON.parse(source)), null, 2);
console.log(`${part}: ${createHash("sha256").update(bundle[part]).digest("hex")}`);
}
const har = JSON.parse(bundle["traffic.har"]);
for (const h of [...har.log.entries[0].request.headers, ...har.log.entries[0].response.headers]) console.log(`header ${h.name}: ${h.value}`);
const leaks = Object.values(bundle).filter((text) => text.includes("synthetic-")).length;
console.log(`parts with a secret value: ${leaks}`);output
One line for each part, the scrubbed headers of the traffic record, and the count of parts that still hold a secret value.
manifest.json: e4e9789bfe2017a8880a0cbf3fb96cda0489041fbcfd0d0c8cffa015451188ff
facets.json: e2d0ed4009aa5f759eb0a9e00ae26061cd915f4a38225b6fa875bf75c198c5a1
traffic.har: d49bec2dc3c0916b7b5841ce6073071cac40ac91b93ec7b5406cd0950cb2d549
trace.zip: held: scrub the trace first
screenshots.json: missing
header Host: [lab host]
header Cookie: [cookie]
header Authorization: [credential]
header Accept: text/html
header Set-Cookie: [cookie]
parts with a secret value: 0The output shows each cookie and credential as a placeholder. The trace stays in production, and the missing part has no hash.
data
injected lab failures that do not reproduce, by failure class and method
status of this figure: measured by me
lines: interval, level 0.95
source: Lab result of this course: injected failures on lab pages and a mock supplier; date 2026-11-13; sample of 80; condition: Local pages and a mock supplier, Chromium only, one host. Failures are injected in the lab. Lab teaching values.
data table
| series | failure class | % | interval |
|---|---|---|---|
| not reproduced, HAR replay | layout change | 0 | 0 to 16.11 (level 0.95) |
| not reproduced, HAR replay | slow target | 100 | 83.89 to 100 (level 0.95) |
| not reproduced, HAR replay | supplier refusal | 100 | 83.89 to 100 (level 0.95) |
| not reproduced, HAR replay | expired state | 0 | 0 to 16.11 (level 0.95) |
| not reproduced, lab run | layout change | 0 | 0 to 16.11 (level 0.95) |
| not reproduced, lab run | slow target | 10 | 2.78 to 30.1 (level 0.95) |
| not reproduced, lab run | supplier refusal | 100 | 83.89 to 100 (level 0.95) |
| not reproduced, lab run | expired state | 0 | 0 to 16.11 (level 0.95) |
A replay alone misses each failure that depends on time or on the live path. A refusal by a supplier stays outside the lab, so its reproduction record gives the reason.
failure modes
| problem | cause | correction |
|---|---|---|
| A failure cannot be repeated. | The system kept no traffic record and no trace of the failed attempt. | Keep the traffic record and the trace of each failed attempt, and scrub them. |
| A bundle in the lab holds a cookie or an account name. | The export copied the trace with no scrub. | Scrub by field class, and hold each part that the export cannot scrub. |
| The replay passes, but production still fails. | The fault is in time or in stored state, which a replay does not have. | Do a lab run with the same configuration. |
| The team fixes the extractor, and the failure stays. | Nobody compared the lab result with the production result. | Name the part that differs before the fix. |
| The team sends many live attempts to find the cause. | No lab method was tried first. | Repeat the failure in the lab, and keep live attempts inside the budget of the diagnosis. |
| A failure that does not reproduce has no record. | The team stopped when the lab gave no fault. | Write the reason, and send the failure to the confirmation of a target change. |
check questions
List the eight parts of a run bundle.
sample answer
The run manifest, the version of the profile, the configuration, and the facets. Also the stage reached, the traffic record, the browser trace, and the screenshots.
The export cannot scrub the bodies inside a browser trace. What do you do with the trace?
- Copy it to the lab, because the lab is a closed system.
- Keep it in production until a step scrubs it.
- Remove the hash, so that nobody can link it to the attempt.
answer
b. Keep it in production until a step scrubs it.
A trace holds the bodies of requests and responses, so it can hold a cookie, a credential, or personal data. A part that the export cannot scrub stays in production.
A replay of the traffic record gives the same empty record as production. Which part of the own system do you examine first?
- The time limits of the own client
- The stored state of the profile
- The extractor and its selectors
- The live path to the target
answer
c. The extractor and its selectors
A replay has no live transport and no fresh state. When it gives the production result, the fault is in the extractor, for example a selector that no longer matches the layout.
A failure does not reproduce with the replay or with the lab run, and there is no own change. Write what the reproduction record holds, and where the failure goes next.
sample answer
The record holds the bundle hash, the two methods, the result "not reproduced", the reason in place of the part, and the next step. The failure can come from the target or from the live path. It goes to the confirmation of a target change and to the monitors. A new live attempt only for the diagnosis is a new attempt that the defender sees.
exercise
exercise Do this task on paper. A collector failed in production. Use these synthetic records:
| record | value |
|---|---|
| Stage reached | Results page, status 200 |
| Result of the success oracle | Refused: the record holds no items |
| Replay of the traffic record | Record with all items, oracle accepts |
| Lab run with the same configuration and the recorded delay of the target | The items come after 30 seconds, and the record holds no items |
| Time limit of the client in the configuration | 20 seconds |
| Own change since the last good attempt | None |
- Write if the replay reproduces the failure.
- Write if the lab run reproduces the failure.
- Name the part of the own system that differs.
- Write the reproduction record: the method, the result, the part, and the next step.
sample answer
The answer uses the six synthetic records of the task.
The replay does not reproduce the failure, because the stored responses give all items. The lab run reproduces it: the items come after the time limit of the client.
The failure class is a slow target, and the part to examine is the time limits of the own client. There is no own change, thus the target became slower. The record gives the lab run as the method, the result "reproduced", and the time limit as the part. The next step is a test of a longer time limit in the lab, before a release.
sources
- Trace viewer, Microsoft, documentation, read 2026-11-22
- My model of the run bundle, of the two lab methods, and of the reproduction record, 2026-11 (not public).