Skip to content

The design language that makes your AI harness better at design.

JavaScript

Contract: which logos and bars count as the brand

Paul Bakaus00650393e0e2
diff --git a/docs/CLI-CONTRACT.md b/docs/CLI-CONTRACT.md
index eb16e769e..c74addf59 100644
--- a/docs/CLI-CONTRACT.md
+++ b/docs/CLI-CONTRACT.md
@@ -341,7 +341,7 @@ Optional keys added later by engines (appended after the above): `ignoreValue` (
- **One throw, one report.** Deduping compares messages with the `(in promise)` marker read as a plain `Uncaught`, so a throw that surfaces both synchronously and as an unhandled rejection (a consent manager's patched `document.createElement` called from a script and from a promise) reports once, with the first report's text and source. Messages that differ in anything else stay separate. The three-error cap applies after deduping, and after classing (next item): counted errors and advisory ad-tech errors are capped at three each, in arrival order, so ad-tech errors never take a slot a counted error needs. Three failing ad scripts ahead of the site's own broken bundle still leave the bundle's error reported as `error`; a scan reports at most six script errors.
- **Ad-tech script errors are advisory and name the vendor** (corpus decision r3-31-script-error-ad-tech). A script error thrown from a known ad-tech script (its source URL contains `anymind360.com` (AnyMind), a script file name beginning `prebid`, wherever it is hosted (Prebid), `connect.facebook.net` (Meta Pixel), `googletagmanager.com` (Google Tag Manager), `cookielaw.org` (OneTrust, the consent layer that holds ad tags back), or `googlesyndication.com` / `doubleclick.net` / `googleadservices.com` (Google Ads)), or whose message names an ad API (`browsingTopics`, `joinAdInterestGroup`, `runAdAuction` (vendor `ad tech`), `adsbygoogle` (Google Ads)), reports with `severity: 'advisory'`, its snippet ends ` (third-party: <vendor>)`, and it carries `thirdParty: "<vendor>"` after `ignoreValue`. The source is checked first. Product analytics and a site's own bundles and chunks (ad code served from the site's own host included) are not on the list and stay `error`. The list lives in `crates/core/src/third_party.rs` and holds only vendors the corpus has evidence for.
- **Findings on third-party widget markup name the vendor** (corpus decision r4-p24-third-party-widget-markup). A finding whose element is a known widget vendor's markup keeps its severity; its snippet ends ` (third-party: <vendor>)` and it carries `thirdParty: "<vendor>"` (after `selector`). Taboola owns its whole feed: an element with an id starting `taboola-` or `internal_trc_`, a class starting `trc_rbox`, or the class `trc_related_container`, and everything under it. Swiper owns only its structural elements: the element itself has the class `swiper`, `swiper-container`, `swiper-wrapper` or `swiper-slide`, or an id starting `swiper-wrapper-`; the site's content inside a slide is the site's. The rule pass tags in `serialize_findings` (so the in-page bundle and the extension see it too), the visual-contrast pass by its selector's first match. Page-level findings are never tagged. The static engine does not tag.
- - **Purple headings in the brand hue** (corpus decision r3-23-ai-color-palette-brand-hue). The heading forms of `ai-color-palette` (a snippet ending ` on heading`) do not report when the heading's computed `color` is within 12 degrees of hue of a brand surface on the same page: the solid `background-color` (alpha at least 0.9, chroma at least 50, no gradient painted over it) of the logo (an element whose `id`, `class`, `alt` or `aria-label` contains `logo`; its text colour too when it has text of its own), the nav bar (`nav`, `header`, `role=navigation|banner`, at least half the viewport wide), or a band across the page (at least 90% of the viewport's width) covering a fifth of the viewport's area or more. Headings are never brand surfaces, and the gradient and neon forms keep reporting: purple that shows up only in headings and gradients is the tell. URL engine only (the static engine has no rendered page to read surfaces from).
+ - **Purple headings in the brand hue** (corpus decision r3-23-ai-color-palette-brand-hue). The heading forms of `ai-color-palette` (a snippet ending ` on heading`) do not report when the heading's computed `color` is within 12 degrees of hue of a brand surface on the same page: the solid `background-color` (alpha at least 0.9, chroma at least 50, no gradient painted over it) of the logo (an element whose `id`, `class`, `alt` or `aria-label` contains `logo`; its text colour too, read from the first element in it with text of its own, so a type logo set in a child `span` counts), the nav bar (`nav`, `header`, `role=navigation|banner`, at least half the viewport wide), neither inside `main` or an `article` (an article's own header, a pagination nav and a row of partner logos are local chrome), or a band across the page (at least 90% of the viewport's width) covering a fifth of the viewport's area or more. Headings are never brand surfaces, and the gradient and neon forms keep reporting: purple that shows up only in headings and gradients is the tell. URL engine only (the static engine has no rendered page to read surfaces from).
- **Contrast ratios in snippets.** Every `low-contrast` producer (the element text path shared by both engines, which covers links, spans and placeholders, the static engine's `:hover state`, and the URL engine's `browser contrast` sampling and `pixel contrast` passes, verdict and median) prints a ratio against its threshold: one decimal; two when one decimal would round a failing ratio up to the threshold; and those two cut, not rounded, when rounding them would reach it too. A ratio under the bar never prints as the bar: `4.49:1 (need 4.5:1)`, never `4.5:1` or `4.50:1`. A ratio at or above the threshold, such as a median over it, prints one decimal.
- **Page validity gate.** After `goto` (and settle), before injecting anything, the engine classifies the page (`crates/browser/src/validity.rs`) from the main document's final CDP response and an in-page probe (title, visible text length, final URL, challenge-widget markers). Challenge: an `x-amzn-waf-action` header, `cf-mitigated: challenge`, a final URL on a challenge-only host (`perfdrive.com`, `captcha-delivery.com`), or, on a page with at most 3000 characters of visible text, a challenge title prefix ("Just a moment", "Attention Required! | Cloudflare", "Human Verification", "Access Denied", "Radware Bot Manager", "Captcha", ...) or a full-page widget marker (Cloudflare challenge form, PerimeterX, DataDome, Imperva, Akamai, AWS WAF, slider captchas). HTTP error: a final status >= 400 with no challenge signal. A blocked page throws `the page is a bot challenge, not the site (<signals>). Findings would describe the challenge page, so none are reported.` or `the page returned an error (HTTP <status>). Findings would describe the error page, so none are reported.`, which the CLI prints as `Error: ...` and counts as an operational failure (exit 1). A `file://` load has no response, so only the probe signals apply.
- **What the visual pass refuses to read.** The JS reported whatever its sampling produced; the engine says nothing where the reading is not the text's own background. The candidate collector applies the element pass's text gates before a candidate takes one of the `maxCandidates` slots, is sampled, or is scrolled into view: text with no letter and no digit (`◯`, `{ }`, `/`) as well as emoji-only text; a disabled control (`[disabled]`, `[aria-disabled="true"]`); a computed font size under 1px; a `color` at alpha 0.02 or less, or a transparent `-webkit-text-fill-color`, unless the element clips its own background to its text; and an element the painted-at-capture predicate (`crates/core/src/browser/painted.rs`, text gate) says is not painted, such as a tab-strip cell past its clipping edge or a carousel slide parked beside the page. A background image read as a surface has to be under the text: an image drawn `no-repeat` (from the computed `background` shorthand's first layer) whose painted rect, at a `background-size` the capture can place (pixels, percentages, `cover`, or any size once the image's intrinsic size is loaded), covers neither the candidate's text box nor its own box (`body` and `html` are asked only about the text) ends the walk `background image does not cover the text` (`stop`), whether or not the pass could load the file. An icon sprite framing a count and a mark beside a button label are refused this way; a repeating tile and a placement the capture cannot state are read as before. In the stack walk (`impeccable_core::browser::visual`): a translucent surface no longer restarts the walk at its own parent (which re-entered the stack above the node it came from and composited that surface over itself until its alpha read as opaque, and which skipped siblings painted between the surface and that parent) — the walk keeps descending the one `elementsFromPoint` stack, collecting translucent surfaces until an opaque one grounds them, then composites them back in order (topmost surface still names the method, `...+alpha`); a walk that reaches the end of the stack with nothing opaque is unresolved rather than reporting the last translucent color as a surface. A gradient answers analytically only when its stops agree: any stop below 0.95 alpha (a scrim, a glow, a `from-x/10` wash composites differently at every point of the box) or two opaque stops more than 2× apart in contrast make it `gradient stops disagree`, and an `svg` in the stack makes it `<tag> paint`; both end the walk (`stop`) rather than letting the nodes under them answer for the text, so the candidate falls to the screenshot pass. In the screenshot flow: a candidate whose reasons include `background-clip text`, `filter`, or `backdrop filter` is refused before the two screenshots are taken; the verdict is the median over the *glyph cores* (channel delta ≥ 90% of the strongest delta in the box, ≥ 8 of them; when fewer than 8 pixels reach 90%, as on small or thin text, the pixels from 75% up) rather than the tenth percentile over every changed pixel, which antialiased edges drive to 1:1; and the pass reports nothing when the diff is not a glyph over its background — more than 55% of the clip changed (the page repainted), more than a quarter of the changed pixels moved the opposite way from the rest (text mid-animation leaves its old position and its new one in the same diff), most fully painted pixels are not the color the text declares (`preferRenderedForeground` aside, where the painted value *is* the claim), the surface under the glyphs stands 2:1 or further from the surface beside them in the same box (the page paints its own text twice, so hiding one copy leaves the other where the glyphs were), or the median of every measured pixel is more than 3× the verdict (the sample is two populations, not one surface). The snippet shape is unchanged. `median` in it is the median over the same glyph cores the verdict reads, so it prints the verdict's number and never reads below it (it used to be the median over every changed pixel, edges included, which printed verdicts above their own median such as `pixel contrast 3.5:1 median 1.7:1`). The median over every changed pixel still decides the bimodal refusal above, but it is not printed.