Repository navigation
Extending Omnisnap
Recipes for the changes people make most often: which files to touch, which tests must pass, and which spec to update. The rules behind them are in CONTRIBUTING.md and specs/CONVENTIONS.md: anything that contradicts a spec changes that spec in the same contribution, and some changes need approval first (the injected scripts, capture discipline constants, thresholds, new dependencies, public flags).
One trap applies to every analysis change. The tree model's input is a fixed list of 82 features (features.go): cause kinds, consequences, KB ids, mechanisms, perceptual events, consensus verdicts, roles and engines. If a change adds a value to one of those lists, the shipped model no longer matches this binary's features. Compatible then refuses it, and every score becomes null, hidden rather than guessed. Either keep the new value out of the feature lists, or retrain the model and regenerate its parity fixture (Ground truth and the model).
An expected engine difference that should be explained away (or, like K5, named with its fix).
- Add the matcher to
Matchininternal/triage/kb.go: the signature, and aKB{ID, Title, Explanation, Fix, Expected}. Order matters: the first entry that matches wins. - Add a planted
kbfixture page that triggers it (below) and expect it to be explained. - Add a unit test next to
kb_test.go. Mutation-test the bound if it could explain a real bug away (that is how K4's bound was found). - Decide the feature question: adding the id to
FeatureKBmeans retraining. - Update the table in
SPEC-triage.md§1, and the Triage page.
- Emit it in
Analyze(or in its own pass, liketables.go), with the cause-versus-effect rule that keeps it from repeating on every child. - Give it a consequence in
consequencesif a person can see it, and decide whether that consequence is hard. - Give it a title in triage and a severity weight in
severity.go. - Tests: a hand-built tree in
align_test.go; golden parity must still pass (TestGoldenAlignParity); the planted gates must still pass. - The feature question:
FeatureKinds. - Update
SPEC-layout-diff.md§4, the README's "What it detects", and the Layout diff page.
- Write the check as a function of the walker in
checks.go, add it tochecksin reporting order, and name its threshold inaudit.go. - Start it at
info; promoting a check toreportneeds approval and crawl evidence (median findings per page at most 2). - Tests: a unit test in
audit_test.go, a planted page it fires on and a control it does not (TestPlantedAuditPagesintest/e2e/audit_test.go);TestAuditIsFastmust stay under 50 ms. - Add its human name to
auditCheckNamein the viewer'sapp.js. - Update
SPEC-dom-audit.mdand the DOM audit page.
A browser of an existing family (another Blink browser, say):
- Add it to the catalog with every name it goes by, and to the per-OS sources that should find it (the Windows catalog, the macOS bundle ids).
- Add a fixture for each OS source (a
reg querydump, anInfo.plist) and a test in that OS's discovery test file. - If it blocks requests itself, it is a branded browser: see Branded browsers.
- Update
SPEC-discovery.md.
A new engine family or protocol is a larger change across five modules:
- discovery: the family and protocol;
-
process: a
Start…with its launch flags, isolation and cleanup tests; -
drivers: a
drivers.Sessionimplementation, honestCapabilities, and a harness in the conformance suite; -
canDriveandlaunchininternal/cli/env.go; - the lane it belongs to in
lanes.
It needs a spec change in each module first.
The planted suite is generated from the spike, so the Go fixtures are never edited by hand:
- Add the page to
spikes/layout-diff/planted/pages.mjs: the base page, its.ffrule that plants exactly one divergence in Firefox, its kind (planted,control,kb,native) and its expected answer (expect,maxFindings,intent). - Export:
node spikes/layout-diff/tools/export-planted.mjswritestestdata/planted/<slug>.htmlandexpectations.json(export-planted.mjs). CI runs it with--checkand fails if the fixtures drift. - Capture its golden captures with the spike and export them (
export-golden.mjs), so the gates and parity tests cover it (testdata/golden/README.md). - Tests that must pass:
TestLoadPlantedMatchesTheSuite,TestGoldenPlantedCoversTheSuite, andTestPlantedGates(recall stays at or above 90%; controls stay at 0 Report). - Update the list in
SPEC-ground-truth.md§1.
-
CONTRIBUTING.md: the contribution rules -
specs/CONVENTIONS.md: the spec conventions -
spikes/layout-diff/planted/pages.mjs: the planted suite's source -
spikes/layout-diff/tools/export-planted.mjs: exports the planted fixtures
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