Repository navigation
Ground Truth and the Model
Role. The known answers behind every precision and recall claim: the planted suite, mutation testing on real pages, the crawl, the dataset, the tree model and the CI gates. Module ground-truth, package internal/groundtruth, the lab binary cmd/omnisnap-lab, the trainer tools/train.py, and the shipped model in assets/model.
omnisnap-lab is never released: tools/release builds only ./cmd/omnisnap. Its commands (main.go):
omnisnap-lab serve --dir testdata/planted --addr 127.0.0.1:8099
omnisnap-lab sites --n 500 --out crawl-sites.json
omnisnap-lab crawl --list crawl-sites.json --out crawl-out [--shards N --shard I]
omnisnap-lab diff --bundles <dirs>
omnisnap-lab mutate --bundles <dirs> [--per-engine 4] [--require-effective]
omnisnap-lab dataset --bundles <dirs> --group planted|crawl|mut --label -1|0|1 --out dataset.csv
omnisnap-lab fingerprints --bundles crawl-out --out assets/model/fingerprints.json
testdata/planted: 31 small synthetic pages served by omnisnap-lab serve. A blocking script adds ff to <html> in Firefox, and each planted page's .ff rule plants exactly one divergence, so every other engine sees a control. expectations.json holds each page's answer (LoadPlanted):
-
planted (24): card width, heading wrap, overflow, missing element, padding, order, font, clip, gap, image, card CTA alignment, grid column, toolbar alignment, list rhythm, equal-height tiles, badge overlap, ellipsis, line-clamp, aspect ratio, nav wrap, code scroll, hidden notice, table layout, flex min-width. Six are design-intent bugs. Each has
expectids and amaxFindingsbudget; - control (4): no bug;
- kb (2): the K1 and K2 fixtures, which must be explained;
- native (1): genuine form-control differences, not scored.
The Go port adds pages of its own, not in expectations.json: audit-* (DOM audit), appearance-*, and selector-hidden-sibling.html, whose planted differences follow display: none siblings of the same tag, so a selector must count them as CSS does (TestPlantedSelectors).
TestPlantedGates (e2e tag) runs on every PR, on the golden captures in testdata/golden/planted, so it gates the comparison, not the capture (geometry parity checks the capture separately). From SPEC-ground-truth.md, success criteria:
- planted recall in the Report tier ≥ 90% (the rules reach 24/24), and every planted page within its budget;
- 0 Report causes on control pages and on planted pages in non-Firefox engines; KB fixtures 0 Report, 0 unexplained;
- intent: at least 5 of the 6 planted intent bugs, 0 violations on controls;
- model parity ≤ 1e-9, feature parity exact.
The same planted gates run on what the npm and PyPI packages return in a fresh install (check_summary.py); there, a planted page without a Report cause is named but does not fail on its own, because those are live captures on the runner's fonts.
omnisnap-lab mutate injects one realistic cross-engine bug into a settled real page, in one engine only, measures, and reverts. The 19 operators (MutateOps): width shrink, padding, padding-left, margin-top, nudge, hide, invisible, gap, wrap-narrow, font-up, nowrap, align-self, overlap, clip, order, letter-spacing, line-height, border, ellipsis-clip. The operator is fixed by the seed, so the same page and seed always inject the same bug; when the target's class is shared by 30 elements or fewer, the whole class gets it, as a stylesheet bug would. Mutants are injected in Firefox and compared with the clean Blink captures, the same pair as the natural corpus. A mutant gets the same screenshot and probes as a clean capture (capture.Evidence), so its causes carry the same evidence.
Labels (label.go): a same-engine diff (clean versus mutated) shows what the bug changed; a cross-engine cause is positive when it sits on a changed element in the target's neighbourhood and was not already a cause in the clean diff. A mutant that moves nothing is kept as ineffective. The policy is in SPEC-ground-truth-mutant-policy.md.
-
Sites (
sites.go,tranco.go): from the Tranco list, excluding infrastructure, adult content and gambling; one site per brand; a homepage of at least 5 KB of HTML with a title, no bot challenge. -
Crawl and diff (
crawl.go): the product's capture pipeline, sharded;omnisnap-lab diffruns the CLI's analysis over each bundle and writesfindings.jsonwithsideandnodeIdon every cause, the join key for labels. -
Dataset (
dataset.go): one row per cause with triage's 82 features. Label 1 = mutation positives; label 0 = the causes of clean pages, which are natural engine differences but unlabeled (positive-unlabeled), so precision is never reported. Planted pages are never trained on. -
Training (
tools/train.py): LightGBM binary objective, 300 rounds, 15 leaves,scale_pos_weight= negatives / positives, GroupKFold by site, deterministic. It exportsgbdt.txt,gbdt.json,gbdt-meta.jsonand the parity fixturetestdata/model/parity.json. -
Fingerprints (
omnisnap-lab fingerprints): the novelty table,fingerprints.json, 300 fingerprints over 457 pages.
The model shipped on 2026-11-19 was trained on 4,693 positives and 4,644 negatives from 458 sites, and has a cross-validated ROC AUC of 0.83 (gbdt-meta.json). The gate that would let it set the tier (success criterion 5) was run on the crawl (docs/status-2026-11-19.md):
| Tier | Injected bugs caught | Natural causes reported | Per clean page | Planted |
|---|---|---|---|---|
| rules | 3038/4693 = 64.7% | 971/4644 = 20.9% | 2.12 | 24/24 |
| model at the rules' recall | 3038/4693 = 64.7% | 1022/4644 = 22.0% | 2.20 | 15/24 |
| model at 90% recall | 4224/4693 = 90.0% | 2544/4644 = 54.8% | 5.57 | 19/24 |
At the rules' recall the model is no quieter (1.05× overall, 1.36× on the pages the corpus covers, with the threshold matched per slice of pages), and it fails the planted suite: its positives are layout mutations of real pages, while the planted bugs are semantic (an element missing, an order changed, a hidden notice). An earlier headline number in its favour came from one global threshold and a novelty feature with two meanings (a class never seen scored as "occurs on no other page"; absent now means absent). So the score ranks findings and the rules keep the tier; the switch is the tier_tau key, which the shipped metadata does not carry (Triage).
The crawl's biggest result was a rule instead: 72% of the Report causes on real sites were line-box metrics around inline images, invisible to a person, and demoting that class took the rules from 13.4 to 3.8 Report causes per clean page.
-
TestPlantedGates;TestGoldenPlantedCoversTheSuite;planted_test.go(the expectations match the pages, strict fields, the server). -
mutate_test.go,label_test.go,labels_test.go,dataset_test.go,sites_test.go,crawl_test.go. - Model and feature parity in
internal/triage(Triage, tests).
-
Two stale lines in
SPEC-ground-truth.md§4. It says the frequency table "ships empty until the first crawl" (it ships 300 fingerprints) and thatgbdt.txtis "loaded byleaves" (the binary evaluatesgbdt.jsonitself; see Triage). -
tools/sites.pyis named in §3 as an alternative; it does not exist at this commit. The crawl list comes fromomnisnap-lab sites.
specs/SPEC-ground-truth.md and specs/SPEC-ground-truth-mutant-policy.md.
-
cmd/omnisnap-lab/main.go: the lab binary's commands -
cmd/omnisnap-lab/capture.go: the lab's capturer -
cmd/omnisnap-lab/diff.go: re-diffing bundles -
cmd/omnisnap-lab/fingerprints.go: building the novelty table -
cmd/omnisnap-lab/mutate.go: mutation testing -
cmd/omnisnap-lab/webkit_linux.go: the lab's WebKit on Linux -
cmd/omnisnap-lab/webkit_darwin.go: the lab's WebKit on macOS -
cmd/omnisnap-lab/webkit_other.go: the lab's WebKit elsewhere -
internal/groundtruth/planted.go: the planted suite -
internal/groundtruth/server.go: the planted server -
internal/groundtruth/mutate.go: mutant scheduling -
internal/groundtruth/inject/embed.go: mutate.js, lab only -
internal/groundtruth/label.go: labelling mutants' causes -
internal/groundtruth/labels.go: the labels file -
internal/groundtruth/crawl.go: the crawl -
internal/groundtruth/sites.go: the site list and filter -
internal/groundtruth/tranco.go: the Tranco list -
internal/groundtruth/probe.go: probing sites before a crawl -
internal/groundtruth/dataset.go: the training dataset -
internal/groundtruth/disk.go: the disk guard -
internal/groundtruth/disk_unix.go: free disk space, on Unix -
internal/groundtruth/disk_windows.go: free disk space, on Windows -
tools/train.py: trains the model -
tools/requirements.txt: the training script's Python dependencies
This wiki is published from docs/internals/ on main. Edits made here are overwritten on the next publish: change the pages there, in a pull request. The specs are normative; where a page and a spec disagree, the page says what the code does.
Start
Contracts
Capture side
Analysis side
Output
Quality