the target as configuration · lesson 2 of 6 · sources checked 2026-11-22
the profile store
This lesson keeps each target profile in a versioned store, where each edit passes a validator, a test against recorded pages, and a review.
status of this lesson: from a public sourcepurpose
A target profile changes often: a new extractor version, a slower pace, a new owner. When each change goes straight to the collector, one typing error can stop the work or fill the data with wrong records. A profile store puts a gate between the edit and the collector, and it keeps each earlier version.
objectives
- Describe the store as data that one general reader reads, with no code branch for each target.
- Put each edit through a validator, a test against recorded pages, and a review by a second person.
- Stamp the version of the target profile on each attempt record.
- Keep one source for each fact that two target profiles share.
new terms
- profile store
- The store that keeps each version of each target profile with its review and its test result.
how it works
The store keeps each version of each target profile. It can hold the versions as data files, or as a program that makes data. The collector has one general reader for the store. It has no code branch for each target name.
rules as data, not as code
status of this section: documented in my test systemIn the benchmark platform, my test system, the success oracle rules for each target first lived in the worker code. The code kept them in a map with the host name as the key. Thus each new target was a release of code.
The correction moved the rules into data in a catalog. One general reader reads the data, and a target with no rule gets a general floor. For example, a new target then gets a data row and no release of code.
the gate of each edit
Each edit goes through three steps before it gets a version:
- The validator refuses an empty field with no default source, an unknown field, and an unknown value.
- The test runs the new version against recorded pages of the target. It compares the extracted records with the expected records.
- A second person reviews the diff and approves it. The person who made the edit cannot approve it.
Each step has a different reach. The validator sees only the form of the values. The test sees a fault only when a recorded page shows it.
The review sees a wrong value that is inside the permitted set, for example a pace of 2 seconds in place of 20 seconds. The lab result of such a gate is in The target profile.
recorded pages for the test
In WARC 1.1, a WARC file is the simple concatenation of one or more WARC records IIPC, source 1. In the standard:
- a
responserecord holds a complete response; - a
requestrecord holds the details of a complete request; - each record has the fields
WARC-Record-ID,Content-Length,WARC-Date, andWARC-Type.
A recorded page in this form gives the test what the target sent. The test of the store reads only these stored pages. It sends no request to the target. Thus it shows a fault of the extractor, but no new decision of the defender on the live target.
the version stamp on each attempt
Each attempt record names the version of the target profile that made it. For example, a record holds "profileVersion": 7 beside the target name and the verdict.
When the verdicts change, a query on the stamp shows which version was active. Without the stamp, a stored result cannot be traced to the configuration that made it.
one source for each shared fact
Two target profiles can share a fact, for example the list of status classes that end an attempt with no new try. Two copies of that list can drift apart. Then one part of the system calls a failure final, and a second part tries again. Keep the list in one place, and let each target profile refer to it.
the two sides
| automation side | detection side |
|---|---|
| A store with versions lets an operator change one target and go back to the last good version. Logic in code for each host makes each new target a release of code. | The detection side has the same problem with the remote configuration of each site. A change with no version and no test can block real users on one site. More detail is in The collection script: signals, build, delivery, and legal inputs and Release a rule in count mode (not yet published). |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| Rules in code for each target | No store to build | Each new target is a release of code. | Only for a small number of targets |
| Data files in the repository | The normal code review applies. | People who are not engineers cannot edit them easily. | For a small team of engineers |
| A store with a gate and versions | Each edit has a test, a review, and a way back. | You must build and run the store. | When many people edit many targets |
| A test against recorded pages | No load on the target, and a repeatable result | A new layout of the target is not in the old pages. | For each edit of the extractor version or the oracle |
| A review by a second person | It sees wrong values that are inside the permitted set. | Each edit waits for a person. | For each edit that goes to the collector |
diagram
The first diagram shows the path of an edit through the store.
the profile store: from an edit to a new version that each attempt record names
The second diagram puts the target profile beside the remote configuration of the detection side.
A matrix with two columns, the target profile of the operator and the remote configuration of a site. The rows compare the unit, the content, the editor, the version, and the effect of a change with no test.
| property | target profile of the operator | remote configuration of a site |
|---|---|---|
| Unit | One target | One protected site |
| Content | Method, pace, caps, oracle, owner | Rules, thresholds, and exceptions |
| Who edits it | The operator | The detection team |
| Version | One version for each change | One version for each release |
| A change with no test | Wrong records or more load | Blocks of real users on the site |
code example
The example is a store gate. It holds two synthetic recorded pages and four synthetic edits. It gives a version only when the three steps pass. Its validator checks only the empty fields and the method value.
Give a version to an edit of a target profile only after the validator, a test, and a review pass.
// Store gate: an edit of a target profile gets a version only after the
// validator, a test against recorded lab pages, and a review.
// All data is synthetic. The recorded pages and the edits are in the code.
type Profile = Record<string, string | number | undefined>;
type Page = { id: number; body: Record<string, string>; expected: { title: string; price: string } };
type Edit = { name: string; author: string; reviewer: string; profile: Profile };
type Result = { result: "accepted"; version: number } | { result: "refused"; step: string; reasons: string[] };
const REQUIRED = ["method", "extractorVersion", "dataContract", "dailyCostCap", "owner", "legalStatus"];
const METHODS = new Set(["declared-feed", "http-client", "browser"]);
function validate(p: Profile): string[] {
const faults = REQUIRED.filter((k) => p[k] === undefined || p[k] === "").map((k) => `${k}: empty, and no default source`);
if (!METHODS.has(String(p.method))) faults.push(`method: unknown value ${p.method}`);
return faults;
}
// Two synthetic extractor versions: 1 reads "price", 2 reads "amount".
function extract(version: string, body: Record<string, string>) {
const field = version.startsWith("1.") ? "price" : "amount";
return { title: body.title, price: body[field] ?? "(none)" };
}
function test(p: Profile, pages: Page[]): string[] {
const misses: string[] = [];
for (const page of pages) {
const got = extract(String(p.extractorVersion), page.body);
if (got.title !== page.expected.title || got.price !== page.expected.price)
misses.push(`page ${page.id}: expected price ${page.expected.price}, got ${got.price}`);
}
return misses;
}
function gate(edit: Edit, pages: Page[], store: Profile[]): Result {
const faults = validate(edit.profile);
if (faults.length > 0) return { result: "refused", step: "validator", reasons: faults };
const misses = test(edit.profile, pages);
if (misses.length > 0) return { result: "refused", step: "test", reasons: misses };
if (edit.reviewer === "" || edit.reviewer === edit.author)
return { result: "refused", step: "review", reasons: ["no second person"] };
store.push(edit.profile);
return { result: "accepted", version: store.length };
}
const pages: Page[] = [
{ id: 1, body: { title: "Lamp", price: "12.00" }, expected: { title: "Lamp", price: "12.00" } },
{ id: 2, body: { title: "Desk", price: "80.00" }, expected: { title: "Desk", price: "80.00" } },
];
const base: Profile = {
method: "http-client", paceSeconds: 20, extractorVersion: "1.4.0", dataContract: "product-record 3",
dailyCostCap: 20, owner: "team-a", legalStatus: "decided-go",
};
const edits: Edit[] = [
{ name: "edit 1", author: "ana", reviewer: "ben", profile: { ...base, paceSeconds: 30 } },
{ name: "edit 2", author: "ana", reviewer: "ben", profile: { ...base, owner: "" } },
{ name: "edit 3", author: "ben", reviewer: "cy", profile: { ...base, extractorVersion: "2.0.0" } },
{ name: "edit 4", author: "cy", reviewer: "cy", profile: { ...base, paceSeconds: 2 } },
];
const target = process.argv[2] ?? "shop.example";
const store: Profile[] = [];
for (const e of edits) {
const r = gate(e, pages, store);
console.log(`${target} ${e.name}: ${r.result === "accepted" ? `accepted, version ${r.version}` : `refused at the ${r.step}`}`);
if (r.result === "refused") for (const reason of r.reasons) console.log(` ${reason}`);
}output
The result of each edit: its version, or the step that refuses it and the reasons.
shop.example edit 1: accepted, version 1
shop.example edit 2: refused at the validator
owner: empty, and no default source
shop.example edit 3: refused at the test
page 1: expected price 12.00, got (none)
page 2: expected price 80.00, got (none)
shop.example edit 4: refused at the review
no second personThe output shows that only edit 1 gets a version. Edit 2 stops at the validator. Edit 3 stops at the test, because version 2 of the extractor reads a different field. Edit 4 stops at the review, because its author is also its reviewer.
data
per-target oracle definitions in the code of one platform, in three periods
status of this figure: documented in my test system
source: Benchmark platform, code: per-target oracle definitions in one source file (my test system); date 2026-11-12; sample of 17; condition: General form: no host name of a target, and no count of runs. The count is of definitions in the code at six points of its history.
data table
| period and point | definitions |
|---|---|
| early 1 | 1 |
| early 2 | 6 |
| early 3 | 9 |
| middle 1 | 10 |
| middle 2 | 14 |
| late | 17 |
The chart counts oracle definitions in one code file of the benchmark platform. The set grew over time. Some later changes corrected an earlier definition, and each such change was a change of the code.
failure modes
| problem | cause | correction |
|---|---|---|
| Each new target is a release of code. | The rules for each target live in code, with a branch for each host name. | Move the rules into data, and use one general reader. |
| An edit passes the validator but breaks the records of one layout. | The recorded pages hold no page of that layout. | Add recorded pages of each layout of the target to the test. |
| A pace of 2 seconds in place of 20 seconds goes to the collector. | The value is inside the permitted range, and nobody reviewed the diff. | Ask for a review by a second person for each edit. |
| Nobody can say which configuration made a stored result. | The attempt records carry no version of the target profile. | Stamp the version on each attempt record. |
| One part of the system tries again after a failure that a second part calls final. | Two copies of one list drifted apart. | Keep one source for the list, and let each target profile refer to it. |
check questions
Describe a store that keeps the rules of each target as data, and say what a new target then costs.
sample answer
The store keeps each version of each target profile as data, or as a program that makes data. The collector has one general reader for the store and no code branch for each target name. A target with no rule gets a general floor. Thus a new target gets a data row and no release of code.
An edit changes the pace from 20 seconds to 2 seconds. The value is inside the permitted range, and no recorded page shows a fault. Which step of the gate can stop it?
- The validator
- The review by a second person
- The test against recorded pages
answer
b. The review by a second person
The validator sees only the form of the values, and the test sees a fault only when a recorded page shows it. A person who reads the diff can see a wrong value inside the permitted set.
What can a test against recorded pages not show?
- A new decision of the defender on the live target
- A fault of the extractor on a recorded layout
- A record that does not agree with the expected record
answer
a. A new decision of the defender on the live target
The test reads only stored pages and sends no request to the target. Thus it shows a fault of the extractor, but no new decision of the defender.
The verdicts of a target change in one week. Which value on each attempt record shows which version of the target profile was active?
- The name of the target
- The time of the attempt only
- The version stamp of the target profile
answer
c. The version stamp of the target profile
Each attempt record names the version of the target profile that made it. A query on the stamp shows which version was active.
Two target profiles each keep a copy of the list of status classes that end an attempt with no new try. Explain the risk, and give the correction.
sample answer
The two copies can drift apart. Then one part of the system calls a failure final, and a second part tries again. Keep the list in one place, and let each target profile refer to it.
exercise
exercise Do this task on paper. Use the gate of the section "How it works" and these four synthetic edits. All values are synthetic.
| edit | author | reviewer | validator result | test against recorded pages |
|---|---|---|---|---|
| 1 | ana | ben | no fault | each record agrees |
| 2 | ana | ana | no fault | each record agrees |
| 3 | ben | ana | empty owner field | not run |
| 4 | ben | cy | no fault | 3 records do not agree |
- For each edit, write the first step of the gate that refuses it, or write "accepted".
- For each refusal, write the reason.
- Write which edits get a new version.
sample answer
The answer uses the order of the gate: validator, test, review.
Edit 1 is accepted. Edit 2 passes the validator and the test, but the review refuses it, because the person who made an edit cannot approve it. Edit 3 stops at the validator, because the owner field is empty and has no default source. Edit 4 stops at the test, because 3 records do not agree with the expected records. Only edit 1 gets a new version.
sources
- WARC 1.1, IIPC, standard, read 2026-11-22
- My model of the profile store, its gate, and the version stamp, 2026-11 (not public).
- Benchmark platform, code: the move of the oracle rules for each target from code into data (not public).