the life cycle of a target and the long tail · lesson 7 of 9 · sources checked 2026-11-22
repair with review
This lesson designs a repair queue that verifies each proposed repair on stored pages and sends it to a review by risk class.
purpose
At many targets, some page forms change each week. When a person writes each repair, the repairs fall behind the changes. When a model or a rule writes the repairs with no check, a wrong repair can go into production and give wrong records for days.
objectives
- Describe the steps of a repair from the alarm to the release.
- Verify a proposed repair on stored pages before a person sees it.
- Give each proposal a risk class, and select the proposals that a person reviews.
- Explain how the wait time of the queue and the review rate show if the reviewers can keep up.
new terms
- selector repair
- A process that proposes a new selector when the old selector stops to match.
- repair queue
- The queue of proposed repairs that wait for verification and review.
how it works
A monitor finds a fault on one target. More detail on the monitors is in Monitors at 1,000 targets. The first question is the cause of the fault.
two causes, two paths
A repair corrects the extractor of the operator after a page changed its form.
For example, the name of a record moves from an h2 element to an h3 element. The old selector then finds no element. This is selector drift.
A block or a refusal by the site is a different cause. It is not a fault of the extractor, and a repair never answers it. After a block or a refusal, the outputs are these:
- a slower pace;
- a volume cap;
- the declared path;
- a stop of the target.
Thus the first step of the queue reads the status of the failed attempts. Only a fault of the page form goes on to a repair.
the proposal
A rule or a model writes a proposal. For example, a selector repair proposes a new selector when the old selector stops to match. The proposal holds the target, the new rules, and the list of the fields that it changes.
A proposal is not a repair yet. It goes into the repair queue, and it waits there for verification and review.
verification on stored pages
Each target keeps a set of stored pages with the expected record of each page. The queue applies the new rules to each stored page. It compares each record with the expected record. This is a fixture test.
For example, a target has three stored pages. A proposal that gives the correct record for all three passes. A proposal that gives the correct record for two of three fails, and the queue refuses it. No person spends time on it.
Stored pages show only the forms that you stored. Thus add a page of the new form to the set when a person accepts a repair. The next proposal must then pass the old forms and the new form.
the risk class
A person cannot read each proposal at a high rate. Thus each verified proposal gets one of three risk classes. The key field is the field that identifies a record. For example, a change to the rule of one date field is low risk:
| risk class | rule | review |
|---|---|---|
| High | The proposal changes the key field of a record | A person reviews each proposal |
| Medium | The proposal changes two or more fields | A person reviews each proposal |
| Low | The proposal changes one field that is not the key | A person reviews a sample |
A wrong key can join two records or split one record. Thus a change to its rule is always high risk.
review rate and wait time
The review rate is the share of proposals that a person reviewed. Here, a proposal counts only after it passes verification. A review rate of 1.0 means that a person reviewed each proposal. A risk sample gives a lower rate, because some low-risk proposals go out with no review.
The wait time of a proposal is the time from the proposal to its decision. Record the review rate and the mean wait time each week. When the wait time rises from week to week, the reviewers cannot keep up.
Then you have three options: more review time, a smaller sample of the low class, or fewer proposals. A smaller sample lets more wrong low-risk repairs through. Thus record the faults that a reviewer finds in the sample, and change the sample with that record.
Give the queue an owner and a fixed review time each week. With no owner, proposals stay open, and the targets stay broken. More detail on a queue that people work is in Operate a review queue (not yet published).
the two sides
| automation side | detection side |
|---|---|
| Repair with review keeps a proposal of a model out of production until a check and a person accept it. The review rate and the wait time show if the queue can keep up. | Each failed attempt during a break is traffic that the site sees. A slow repair means more failed attempts and more load on the site. A volume cap on the broken target during the repair keeps that load low. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| A person writes each repair | Each repair has a careful author. | The repairs fall behind when many targets change. | At a few targets |
| A model releases each proposal with no check | Repairs are fast. | A wrong repair gives wrong records with no warning. | Never |
| Verification on stored pages, then review of each proposal | Each release has a person who accepted it. | The queue grows with no end when proposals arrive faster than the reviewers work. | At a low rate of proposals |
| Verification, then review by risk class | High-risk proposals keep a full review, and the queue stays short. | Some wrong low-risk repairs go out. | At a high rate of proposals, with a record of the faults in the sample |
diagram
the repair queue: from a break to a release, with verification, a risk class, and review
code example
The example verifies six synthetic proposals for one lab target on three stored pages. It gives each proposal a risk class. It reviews each high and medium proposal, and one low proposal in each two. All names and values are synthetic.
Verify each proposed repair on stored pages, give it a risk class, select the proposals that a person reviews, and print the review rate.
// Repair queue: verify proposals on stored pages, set a risk class, select reviews. Synthetic data.
type Page = { id: string; elements: Record<string, string>; expected: Record<string, string> };
type Proposal = { id: string; rules: Record<string, string>; changed: string[] };
type Risk = "high" | "medium" | "low" | "none";
// Stored pages of one lab target, with the expected record of each page.
const stored: Page[] = [
{ id: "p1", elements: { "h2.name": "Blue kettle", "span.ref": "K-100", "time.date": "2026-01-04" },
expected: { name: "Blue kettle", ref: "K-100", date: "2026-01-04" } },
{ id: "p2", elements: { "h2.name": "Red lamp", "span.ref": "L-220", "time.date": "2026-02-11" },
expected: { name: "Red lamp", ref: "L-220", date: "2026-02-11" } },
{ id: "p3", elements: { "h2.name": "Green mug", "span.ref": "M-310", "time.date": "2026-03-19" },
expected: { name: "Green mug", ref: "M-310", date: "2026-03-19" } },
];
// The key field identifies a record. A change to its rule has the high risk class.
const KEY_FIELD = "ref";
const RULES = { name: "h2.name", ref: "span.ref", date: "time.date" };
const proposals: Proposal[] = [
{ id: "r1", rules: RULES, changed: ["date"] },
{ id: "r2", rules: RULES, changed: ["name"] },
{ id: "r3", rules: RULES, changed: ["ref"] },
{ id: "r4", rules: { ...RULES, name: "h3.name" }, changed: ["name"] },
{ id: "r5", rules: RULES, changed: ["name", "date"] },
{ id: "r6", rules: RULES, changed: ["date"] },
];
// Apply the rules of a proposal to each stored page and count the pages that agree.
function verify(p: Proposal): number {
let ok = 0;
for (const page of stored) {
const record: Record<string, string> = {};
for (const [field, sel] of Object.entries(p.rules)) record[field] = page.elements[sel] ?? "";
if (Object.keys(page.expected).every((f) => record[f] === page.expected[f])) ok++;
}
return ok;
}
// Only a verified proposal gets a risk class.
function riskClass(p: Proposal): Risk {
if (p.changed.includes(KEY_FIELD)) return "high";
return p.changed.length > 1 ? "medium" : "low";
}
// A person reviews each high and medium proposal, and one low proposal in each two.
const LOW_SAMPLE = 2;
let lowSeen = 0, reviewed = 0, queued = 0;
for (const p of proposals) {
const passed = verify(p);
const risk: Risk = passed < stored.length ? "none" : riskClass(p);
let action: string;
if (passed < stored.length) action = "refuse: verification failed";
else if (risk !== "low") action = "review";
else action = lowSeen++ % LOW_SAMPLE === 0 ? "review (sample)" : "release with no review";
if (passed === stored.length) queued++;
if (action.startsWith("review")) reviewed++;
console.log(`${p.id}: verified ${passed}/${stored.length}, risk ${risk}, ${action}`);
}
console.log(`review rate: ${reviewed}/${queued} = ${(reviewed / queued).toFixed(2)}`);output
One line for each proposal with its verification, its risk class, and its action, and then the review rate.
r1: verified 3/3, risk low, review (sample)
r2: verified 3/3, risk low, release with no review
r3: verified 3/3, risk high, review
r4: verified 0/3, risk none, refuse: verification failed
r5: verified 3/3, risk medium, review
r6: verified 3/3, risk low, review (sample)
review rate: 4/5 = 0.80The output shows that proposal r4 fails on each stored page, thus it gets no risk class, and the queue refuses it before review. Five proposals pass verification. A person reviews four of them, thus the review rate is 0.80.
data
wait time of the repair queue against new proposals each day
status of this figure: simulated
band: interval, level 0.95
source: Lab result of this course: simulation of a repair review queue; date 2026-11-13; sample of 20; condition: 20 runs of 120 working days for each point. The wait time counts reviewed items only. From 55 proposals each day, review of every proposal gives a queue with no end.
data table
| series | proposals each day | thousandths of an hour | interval |
|---|---|---|---|
| review every proposal | 10 | 344.966 | 335.942 to 353.99 (level 0.95) |
| review every proposal | 20 | 396.42 | 385.113 to 407.726 (level 0.95) |
| review every proposal | 30 | 502.164 | 489.896 to 514.432 (level 0.95) |
| review every proposal | 40 | 841.109 | 788.299 to 893.918 (level 0.95) |
| review every proposal | 45 | 1404.25 | 1279.39 to 1529.1 (level 0.95) |
| review every proposal | 50 | 5004.75 | 3423.01 to 6586.5 (level 0.95) |
| review every proposal | 55 | 25420.5 | 21620.9 to 29220.1 (level 0.95) |
| review every proposal | 60 | 50649.7 | 47013.2 to 54286.3 (level 0.95) |
| review every proposal | 70 | 68228.5 | 66377.9 to 70079.2 (level 0.95) |
| review every proposal | 80 | 51112.1 | 47527.9 to 54696.2 (level 0.95) |
| review by risk sample | 10 | 347.046 | 339.49 to 354.603 (level 0.95) |
| review by risk sample | 20 | 388.314 | 376.658 to 399.97 (level 0.95) |
| review by risk sample | 30 | 495.764 | 479.247 to 512.281 (level 0.95) |
| review by risk sample | 40 | 777.727 | 731.386 to 824.068 (level 0.95) |
| review by risk sample | 45 | 936.75 | 867.003 to 1006.5 (level 0.95) |
| review by risk sample | 50 | 938.483 | 856.319 to 1020.65 (level 0.95) |
| review by risk sample | 55 | 872.735 | 822.544 to 922.927 (level 0.95) |
| review by risk sample | 60 | 943.378 | 853.566 to 1033.19 (level 0.95) |
| review by risk sample | 70 | 909.283 | 855.367 to 963.198 (level 0.95) |
| review by risk sample | 80 | 1188.33 | 1043.72 to 1332.94 (level 0.95) |
The chart compares the two designs of the section "Design decisions".
With review of every proposal, the wait time rises fast when the proposals each day come near the count that the reviewers can review. Above that rate, the queue has no end. With review by risk sample, the wait time stays low over the full range.
The chart counts only the items that left the queue. The queue serves the high-risk items first. Above that rate, low-risk items stay in the queue with no end. Thus the line of review of every proposal falls at the highest rate. The fall is not a gain.
failure modes
| problem | cause | correction |
|---|---|---|
| A repair goes out and gives wrong records for days. | A model released its proposal with no verification and no review. | Verify each proposal on stored pages, and send it to review by risk class. |
| A repair passes the stored pages but fails on the live target. | The set of stored pages has no page of the new form. | Add a page of the new form to the set when a person accepts a repair. |
| The extractor gets a new repair after each block by the site. | The queue treats a block or a refusal as a fault of the page form. | Read the status of the failed attempts first. After a block, use a slower pace, a volume cap, the declared path, or a stop. |
| Two records join into one record after a repair. | A change to the key field went out with no review. | Give each change to the key field the high risk class. |
| The wait time of the queue rises each week. | Proposals arrive faster than the reviewers work, and each proposal gets a review. | Review by risk sample, and record the faults that the sample finds. |
| Proposals stay open, and targets stay broken. | The queue has no owner and no fixed review time. | Give the queue an owner and a fixed review time each week. |
check questions
Describe the steps of a repair from the monitor alarm to the release.
sample answer
Read the cause of the fault first. A block or a refusal is not a repair. A change of the page form gets a proposal. The queue verifies it on stored pages and gives it a risk class. A person reviews the high and medium proposals and a sample of the low ones. Then the repair goes out.
The attempts on one target fail, and the status shows a refusal by the site. What is the correct action?
- Send a proposal for a new selector to the repair queue.
- Use a slower pace, a volume cap, the declared path, or a stop.
- Release a repair with no review, because the fault is urgent.
answer
b. Use a slower pace, a volume cap, the declared path, or a stop.
A repair corrects the extractor after a change of the page form. A refusal is not a fault of the extractor, and a repair never answers it.
A proposal gives the correct record for two of the three stored pages of a target. What does the queue do?
- It refuses the proposal before a person sees it.
- It gives the proposal the low risk class.
- It releases the proposal, because most stored pages pass.
answer
a. It refuses the proposal before a person sees it.
A proposal must pass each stored page. A failure on one page stops it at verification, and no person spends time on it.
A verified proposal changes only the rule of the key field. Which risk class does it get?
- Low, because it changes one field
- Medium, because it passed verification
- High, because a wrong key can join or split records
answer
c. High, because a wrong key can join or split records
The key field identifies a record. A change to its rule always gets the high risk class and a full review.
Explain what a rise of the mean wait time from week to week shows, and give the options.
sample answer
The reviewers cannot keep up with the proposals. The options are more review time, a smaller sample of the low class, or fewer proposals. A smaller sample lets more wrong low-risk repairs through, thus record the faults that the sample finds.
exercise
exercise Do this task on paper. Use the rules of the risk table in "How it works". The four synthetic proposals are for one lab target with three stored pages. The key field is ref.
| proposal | stored pages that pass | fields that it changes |
|---|---|---|
| A | 3 of 3 | date |
| B | 3 of 3 | ref |
| C | 2 of 3 | name |
| D | 3 of 3 | name, date |
- For each proposal, write if the queue refuses it at verification.
- For each verified proposal, write its risk class.
- Write which proposals a person reviews each time.
- Write which proposal goes to the sample.
sample answer
The answer uses the four synthetic proposals of the task.
Proposal C fails one stored page, thus the queue refuses it before review. Proposal B changes the key field, thus it is high risk. Proposal D changes two fields, thus it is medium risk. Proposal A changes one field that is not the key, thus it is low risk.
A person reviews B and D each time. Proposal A goes to the sample of the low class.
sources
- My model of the repair queue, its risk classes, and the review rate, 2026-11 (not public).