The design language that makes your AI harness better at design.
JavaScript
URL scans hide product tours, stuck preloaders and two more consent layers
Paul Bakaus440f70b3b3a0
diff --git a/crates/browser/src/consent.rs b/crates/browser/src/consent.rsindex bc572d0dc..dd9d6caad 100644--- a/crates/browser/src/consent.rs+++ b/crates/browser/src/consent.rs@@ -27,6 +27,17 @@//! `.cc-window[aria-label="cookieconsent"]`) and Google's consent messages//! (ynet.co.il, `.fc-ccpa-root`). The other vendors are listed from their//! published markup and have no corpus capture yet.+//!+//! Run 35 added two. consentmanager.net on letour.fr: `div#cmpbox` with+//! `role=dialog`, rendered in the open shadow root of `div#cmpwrapper`, a+//! fixed bar over the lower 28 to 36% of the first screen. And Borlabs Cookie+//! 3 on fischundfang.de, already listed by `#BorlabsCookieBox`, left three+//! things behind once the box was hidden: its floating reopen button+//! (`#BorlabsCookieWidget`, a fixed 48px shield at the left edge), the inline+//! `overflow: hidden` on `<body>` its modal sets behind+//! `#BorlabsDialogBackdrop` (it stopped the reveal sweep from scrolling), and+//! `aria-hidden="true"` on the page wrapper (`#td-outer-wrap`) and its+//! siblings, each marked `data-borlabs-cookie-aria-hidden`.use serde_json::{json, Value};@@ -42,6 +53,11 @@ pub struct ConsentManager {pub html_lock_classes: &'static [&'static str],/// Classes the manager puts on `<body>` to stop the page scrolling.pub body_lock_classes: &'static [&'static str],+ /// Attributes the manager sets beside the `aria-hidden="true"` it puts on+ /// the page while its dialog is open, as its own record of which elements+ /// it hid. The hide step removes `aria-hidden` from exactly those+ /// elements, since the rules treat aria-hidden text as not the page's.+ pub aria_hidden_marks: &'static [&'static str],}/// Every known consent manager, in the order a report names them.@@ -52,6 +68,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[".onetrust-pc-dark-filter"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Cookiebot",@@ -59,6 +76,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &["#CybotCookiebotDialogBodyUnderlay"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Usercentrics",@@ -66,6 +84,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "TrustArc",@@ -73,6 +92,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[".truste_overlay"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Didomi",@@ -80,6 +100,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &["didomi-popup-open"],+ aria_hidden_marks: &[],},ConsentManager {name: "Quantcast Choice",@@ -87,6 +108,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Sourcepoint",@@ -94,6 +116,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &["sp-message-open"],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Osano",@@ -101,6 +124,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Cookie Consent",@@ -108,6 +132,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "CookieYes",@@ -115,6 +140,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[".cky-overlay", ".cli-modal-backdrop"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Complianz",@@ -122,6 +148,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[".cmplz-soft-cookiewall"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "iubenda",@@ -129,6 +156,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Termly",@@ -136,6 +164,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Axeptio",@@ -143,13 +172,15 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &["#axeptio_overlay"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Borlabs Cookie",- roots: &["#BorlabsCookieBox", "#BorlabsCookieBoxWrap"],- backdrops: &[],+ roots: &["#BorlabsCookieBox", "#BorlabsCookieBoxWrap", "#BorlabsCookieWidget"],+ backdrops: &["#BorlabsDialogBackdrop"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &["data-borlabs-cookie-aria-hidden"],},ConsentManager {name: "Klaro",@@ -157,6 +188,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Cookie Notice",@@ -164,6 +196,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Shopify",@@ -171,6 +204,18 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],+ },+ ConsentManager {+ name: "consentmanager",+ // Current builds render the box inside an open shadow root on+ // `#cmpwrapper`, out of reach of a document selector, so the host is+ // what is hidden; `#cmpbox` covers builds that render it in the page.+ roots: &["#cmpwrapper", "#cmpbox"],+ backdrops: &[],+ html_lock_classes: &[],+ body_lock_classes: &[],+ aria_hidden_marks: &[],},ConsentManager {name: "Google Funding Choices",@@ -178,6 +223,7 @@ pub const CONSENT_MANAGERS: &[ConsentManager] = &[backdrops: &[".fc-dialog-overlay"],html_lock_classes: &[],body_lock_classes: &[],+ aria_hidden_marks: &[],},];@@ -195,6 +241,7 @@ fn managers_json() -> Value {"backdrops": m.backdrops,"htmlLock": m.html_lock_classes,"bodyLock": m.body_lock_classes,+ "ariaMarks": m.aria_hidden_marks,})}).collect(),@@ -339,6 +386,15 @@ pub fn hide_js() -> String {if (!out.hidden.includes(m.name)) continue;for (const c of m.htmlLock) if (html.classList.contains(c)) {{ html.classList.remove(c); out.unlocked.push('html.' + c); }}if (body) for (const c of m.bodyLock) if (body.classList.contains(c)) {{ body.classList.remove(c); out.unlocked.push('body.' + c); }}+ // The aria-hidden the manager put on the page behind its dialog, read off+ // the manager's own mark, so an aria-hidden the site set stays.+ for (const mark of m.ariaMarks) {{+ let n = 0;+ for (const el of q('[' + mark + ']')) {{+ if (el.getAttribute('aria-hidden') === 'true') {{ el.removeAttribute('aria-hidden'); n++; }}+ }}+ if (n && !out.unlocked.includes('aria-hidden [' + mark + ']')) out.unlocked.push('aria-hidden [' + mark + ']');+ }}}}// An app shell locks <body> itself and scrolls an inner container that// fills the viewport. That lock is the site's, whatever the manager did,@@ -454,7 +510,7 @@ mod tests {for name in ["OneTrust", "Cookiebot", "Usercentrics", "TrustArc", "Didomi", "Quantcast Choice", "Sourcepoint","Osano", "CookieYes", "Complianz", "iubenda", "Termly", "Axeptio", "Borlabs Cookie", "Klaro",- "Cookie Notice", "Shopify",+ "Cookie Notice", "Shopify", "consentmanager",] {assert!(CONSENT_MANAGERS.iter().any(|m| m.name == name), "{name}");}diff --git a/crates/browser/src/lib.rs b/crates/browser/src/lib.rsindex 4db4399e8..b385cc01b 100644--- a/crates/browser/src/lib.rs+++ b/crates/browser/src/lib.rs@@ -18,8 +18,10 @@//! Before any rule runs, the loaded page is classified ([`validity`]): a bot//! challenge, an HTTP error page, or a page that is only a consent wall is//! refused with an error instead of being scanned and reported clean. Then-//! the banners of known consent managers are hidden ([`consent`]), so every-//! pass and the screenshot see the page a visitor sees once they dismiss it.+//! the banners of known consent managers are hidden ([`consent`]), and so are+//! known product tours and preloaders still covering the page+//! ([`overlays`]), so every pass and the screenshot see the page a visitor+//! sees once they dismiss them.//!//! Two entry points serve measurement work rather than the CLI.//! [`detect_url_evidence`] runs the same scan and also returns what a@@ -30,6 +32,7 @@pub mod cdp;pub mod consent;+pub mod overlays;pub mod response_capture;pub mod html_snapshot;pub mod discovery;@@ -55,6 +58,7 @@ use serde_json::{json, Map, Value};use cdp::{Browser, CdpError, Page, Viewport};use consent::ConsentReport;+use overlays::OverlayReport;pub use fullpage::ElementShot;use validity::{DocumentResponse, PageProbe, PageValidity};@@ -346,6 +350,11 @@ pub struct Evidence {/// that matched and the scroll locks undone. `None` when hiding was off/// ([`ScanOptions::keep_consent_banners`]) or the page was blocked.pub consent: Option<ConsentReport>,+ /// The product tours and preloaders the scan hid ([`overlays`]), the+ /// selectors that matched, what was undone, and how long the scan waited+ /// for a preloader. `None` when hiding was off+ /// ([`ScanOptions::keep_overlays`]) or the page was blocked.+ pub overlays: Option<OverlayReport>,}/// A full-page screenshot taken after the scan. Its pixels line up with@@ -517,8 +526,18 @@ fn detect_url_impl(};let mut consent = ConsentReport::default();+ let mut overlays = OverlayReport::default();let scanned = scan_on_browser(- browser, url, credentials, options, wait_until, settle_ms, profile, None, &mut consent,+ browser,+ url,+ credentials,+ options,+ wait_until,+ settle_ms,+ profile,+ None,+ &mut consent,+ &mut overlays,);// finally: close page (inside scan_page) and the browser when owned.if owns_browser {@@ -535,6 +554,13 @@ fn detect_url_impl(}notes.push(consent_note(url, &consent.hidden));}+ if !overlays.hidden.is_empty() {+ let hidden = overlays.hidden_value();+ for f in findings.iter_mut() {+ f.extras.insert("overlaysHidden".into(), hidden.clone());+ }+ notes.push(overlay_note(url, &overlays));+ }Ok(UrlScan { findings, notes })}@@ -548,6 +574,25 @@ fn consent_note(url: &str, hidden: &[String]) -> String {format!("Hid the {names} consent {noun} on {url} before scanning. Pass --no-consent-hiding to scan it.")}+/// The text-mode note for a scan that hid tours or preloaders.+fn overlay_note(url: &str, report: &OverlayReport) -> String {+ let parts: Vec<String> = report+ .hidden+ .iter()+ .map(|h| match h.kind.as_str() {+ "tour" => format!("the {} tour", h.name),+ "preloader" => format!("the preloader {}", h.name),+ other => format!("the {other} {}", h.name),+ })+ .collect();+ let list = match parts.as_slice() {+ [one] => one.clone(),+ [rest @ .., last] => format!("{} and {last}", rest.join(", ")),+ [] => String::new(),+ };+ format!("Hid {list} on {url} before scanning. Pass --no-overlay-hiding to scan it.")+}+/// Run the URL engine's scan on a browser the caller owns and also return/// the [`Evidence`] a reviewer needs to check each finding. The findings are/// the ones `impeccable detect --json <url>` prints for the same page and@@ -564,6 +609,7 @@ pub fn detect_url_evidence(let (url, credentials) = split_scan_url(url);let mut evidence = Evidence::default();let mut consent = ConsentReport::default();+ let mut overlays = OverlayReport::default();let results = scan_on_browser(browser,&url,@@ -574,11 +620,15 @@ pub fn detect_url_evidence(options.profile.as_deref(),Some((&mut evidence, request)),&mut consent,+ &mut overlays,);let blocked = evidence.validity.as_ref().is_some_and(PageValidity::is_blocked);if !options.keep_consent_banners && !blocked {evidence.consent = Some(consent);}+ if !options.keep_overlays && !blocked {+ evidence.overlays = Some(overlays);+ }let results = results?;let (findings, origins) = results_to_findings(&url, results, options.design_system.as_deref())?;evidence.origins = origins;@@ -778,6 +828,7 @@ fn scan_on_browser(profile: Option<&DetectorProfile>,evidence: Option<(&mut Evidence, &EvidenceRequest)>,consent: &mut ConsentReport,+ overlays: &mut OverlayReport,) -> Result<Vec<RawResult>, EngineError> {let (vw, vh) = options.viewport.unwrap_or((1280, 800));let viewport = Viewport {@@ -787,7 +838,7 @@ fn scan_on_browser(let page = step(profile, "load", "new-page", url, || browser.new_page()).map_err(cdp_err);match page {Ok(page) => scan_page(- page, url, credentials, options, wait_until, settle_ms, viewport, profile, evidence, consent,+ page, url, credentials, options, wait_until, settle_ms, viewport, profile, evidence, consent, overlays,),Err(e) => Err(e),}@@ -806,6 +857,7 @@ fn scan_page(profile: Option<&DetectorProfile>,evidence: Option<(&mut Evidence, &EvidenceRequest)>,consent: &mut ConsentReport,+ overlays: &mut OverlayReport,) -> Result<Vec<RawResult>, EngineError> {let outcome = scan_page_inner(&mut page,@@ -818,6 +870,7 @@ fn scan_page(profile,evidence,consent,+ overlays,);step(profile, "load", "close-page", url, || page.close());outcome@@ -858,6 +911,7 @@ fn scan_page_inner(profile: Option<&DetectorProfile>,mut evidence: Option<(&mut Evidence, &EvidenceRequest)>,consent: &mut ConsentReport,+ overlays: &mut OverlayReport,) -> Result<Vec<RawResult>, EngineError> {step(profile, "load", "set-viewport", url, || {page.set_viewport(viewport)@@ -911,6 +965,13 @@ fn scan_page_inner(if hide_consent {step(profile, "load", "hide-consent", url, || hide_consent_banners(page, consent));}+ // Then tours and preloaders ([`overlays`]), the same way. A preloader+ // still covering the page gets a bounded wait to go on its own first.+ let hide_overlays = !options.keep_overlays;+ if hide_overlays {+ overlays.waited_ms = step(profile, "load", "wait-preloader", url, || wait_for_preloaders(page));+ step(profile, "load", "hide-overlays", url, || hide_page_overlays(page, overlays));+ }// Inject the plain-JS snapshot producer (no WebAssembly runs in the page).step(profile, "scan", "inject-snapshot-script", url, || {@@ -935,6 +996,9 @@ fn scan_page_inner(if hide_consent {step(profile, "scan", "hide-consent", url, || hide_consent_banners(page, consent));}+ if hide_overlays {+ step(profile, "scan", "hide-overlays", url, || hide_page_overlays(page, overlays));+ }// The one capture every pass below reads: the rule pass, the hidden-text// measure, and the visual pass share this DOM, so a hit test any of them@@ -945,7 +1009,11 @@ fn scan_page_inner(// A banner that arrived around the capture is hidden, and the page// captured again, so the capture, the live hit tests and the pixel reads// all see the page without it.- if hide_consent && step(profile, "scan", "hide-consent", url, || hide_consent_banners(page, consent)) {+ let consent_changed =+ hide_consent && step(profile, "scan", "hide-consent", url, || hide_consent_banners(page, consent));+ let overlays_changed =+ hide_overlays && step(profile, "scan", "hide-overlays", url, || hide_page_overlays(page, overlays));+ if consent_changed || overlays_changed {base_json = snapshot_engine::capture_snapshot_json(page).map_err(cdp_err)?;}let base = snapshot_engine::parse_snapshot(&base_json).map_err(cdp_err)?;@@ -1058,6 +1126,9 @@ fn scan_page_inner(if hide_consent {let _ = hide_consent_banners(page, consent);}+ if hide_overlays {+ let _ = hide_page_overlays(page, overlays);+ }let mut selectors: Vec<String> = Vec::new();for r in &results {if let Some(s) = &r.selector {@@ -1337,6 +1408,38 @@ fn hide_consent_banners(page: &mut Page<'_>, report: &mut ConsentReport) -> bool}}+/// Run the overlay hide step ([`overlays::hide_js`]) and fold what it hid+/// into `report`. Idempotent and best-effort, like [`hide_consent_banners`].+/// Returns whether this run changed the page.+fn hide_page_overlays(page: &mut Page<'_>, report: &mut OverlayReport) -> bool {+ match page.evaluate_value(&overlays::hide_js()) {+ Ok(v) => {+ report.merge(&v);+ v.get("changed").and_then(Value::as_bool).unwrap_or(false)+ }+ Err(_) => false,+ }+}++/// Wait up to [`overlays::PRELOADER_WAIT_MS`] for every preloader covering+/// the page to go on its own. Returns how long it waited: 0 when none was+/// covering the page, the full budget when one is still there (the hide step+/// then hides it). A failed probe ends the wait.+fn wait_for_preloaders(page: &mut Page<'_>) -> u64 {+ let js = overlays::preloader_probe_js();+ let started = Instant::now();+ let budget = Duration::from_millis(overlays::PRELOADER_WAIT_MS);+ let mut waited = false;+ loop {+ let covering = matches!(page.evaluate_value(&js), Ok(Value::Array(a)) if !a.is_empty());+ if !covering || started.elapsed() >= budget {+ return if waited { started.elapsed().as_millis() as u64 } else { 0 };+ }+ std::thread::sleep(Duration::from_millis(overlays::PRELOADER_POLL_MS));+ waited = true;+ }+}+/// The `measureContentHiddenAfterReveal` reveal sweep: scroll the page top to/// bottom (revealing lazy / on-scroll content), then back to the top and/// settle. The hidden-text measure then runs natively over a fresh capture.diff --git a/crates/browser/src/overlays.rs b/crates/browser/src/overlays.rsnew file mode 100644index 000000000..4e1b86812--- /dev/null+++ b/crates/browser/src/overlays.rs@@ -0,0 +1,406 @@+//! Overlays that are not the page, other than consent managers: product tours+//! a script starts on load, and preloaders still covering the page when it is+//! captured. Like [`crate::consent`], the URL engine hides them before the+//! reveal sweep and again around the capture, with an injected style or an+//! inline `display: none`; nothing is clicked and no tour state is saved.+//!+//! Each kind is recognized only where the markup leaves no doubt, and a page+//! that matches neither is scanned exactly as before:+//!+//! - **Tours** by the library's own markup ([`TOUR_LIBRARIES`]). Corpus run 35+//! found one: gamer.com.tw starts a five-step driver.js 1.3.1 tour on every+//! load, a full-screen `svg.driver-overlay` dimming the first screen and a+//! `div.driver-popover` (`role=dialog`) over the header, with+//! `driver-active` on `<body>`. driver.js's stylesheet sets+//! `pointer-events: none` on everything under `.driver-active` but the+//! highlighted element, which also takes the page out of every hit test, so+//! the body classes go too. No other tour library (Shepherd, Intro.js,+//! Appcues, UserGuiding, Pendo guides, Chameleon, React Joyride, Userpilot)+//! showed its markup in any of the corpus's 8,800 captures, and their+//! markup could not be confirmed here, so none is listed.+//! - **Preloaders** by structure ([`preloader_js`]): a `position: fixed`+//! layer, not `html` or `body`, that covers at least 90% of the first+//! screen, is on top of it at the center and the four inset points the+//! engine probes, paints an opaque fill (alpha 0.9 or more) on itself or on+//! a descendant that covers the same area, carries at most 60 characters of+//! text and no link, button, form control, frame or dialog role, and whose+//! own id or one of its classes names a loader ([`LOADER_WORDS`]:+//! `preloader`, `pre-loader`, `page_loader_bg`, `loader-wrapper`,+//! `is-loading`, `spinner`; not `lazyloading`). The engine first waits up to [`PRELOADER_WAIT_MS`] for such a+//! layer to go on its own, and hides it only if it is still there. Corpus+//! run 35: epcco.com.sa's `div#preloader` (fixed, 100% by 100%, white,+//! `z-index: 9999999`, a spinner and no text) never cleared on its home+//! page, so three of six captures were a white first screen.+//!+//! Left alone on purpose: a gate the visitor has to answer (a state or+//! region picker, an age gate, a sign-in wall) and a site's own interstitial+//! (a welcome dialog, a newsletter modal) carry text and controls, so no+//! structural test here matches them, and the Pristine rule that reports an+//! interstitial at load still sees them.++use serde_json::{json, Value};++/// One product-tour library: the elements to hide and the classes it puts on+/// the page while a tour runs.+#[derive(Debug, Clone, Copy)]+pub struct TourLibrary {+ pub name: &'static str,+ /// The tour's popover or step roots.+ pub roots: &'static [&'static str],+ /// The dimming layer behind the popover.+ pub backdrops: &'static [&'static str],+ /// Classes the library puts on `<body>` while a tour runs.+ pub body_classes: &'static [&'static str],+ /// Classes the library puts on the highlighted element.+ pub highlight_classes: &'static [&'static str],+ /// `aria-controls` value the library puts on the highlighted element,+ /// beside `aria-haspopup` and `aria-expanded`; those three are removed+ /// from an element that carries exactly this value.+ pub highlight_aria_controls: Option<&'static str>,+}++/// Every known tour library, in the order a report names them.+pub const TOUR_LIBRARIES: &[TourLibrary] = &[TourLibrary {+ name: "driver.js",+ roots: &[".driver-popover"],+ backdrops: &["svg.driver-overlay"],+ body_classes: &["driver-active", "driver-fade", "driver-simple"],+ highlight_classes: &["driver-active-element", "driver-no-interaction"],+ highlight_aria_controls: Some("driver-popover-content"),+}];++/// The id of the style element the tour hide step injects.+pub const HIDE_STYLE_ID: &str = "impeccable-overlay-hide";++/// The attribute the preloader hide step puts on a layer it hid, naming it,+/// so a later pass reports it again without hiding twice.+pub const PRELOADER_MARK: &str = "data-impeccable-hidden";++/// How long the engine waits for a preloader to go on its own before hiding+/// it, and how often it looks.+pub const PRELOADER_WAIT_MS: u64 = 5000;+pub const PRELOADER_POLL_MS: u64 = 250;++/// Id and class words that name a loader: an id or class token names one+/// when, after any trailing [`WRAPPER_WORDS`], its last hyphen- or+/// underscore-separated word is one of these (`preloader`, `pre-loader`,+/// `page_loader_bg`, `loader-wrapper`, `is-loading`; not `lazyloading`).+pub const LOADER_WORDS: &[&str] =+ &["preloader", "preload", "preloading", "loader", "loading", "pageloader", "siteloader", "loadingscreen", "spinner"];+pub const WRAPPER_WORDS: &[&str] = &[+ "wrap", "wrapper", "container", "overlay", "screen", "area", "bg", "background", "mask", "page", "box",+ "holder", "inner", "outer", "layer", "main",+];++/// Most visible characters a preloader may carry ("Loading...", "75%", a+/// brand word).+pub const PRELOADER_MAX_TEXT: usize = 60;+/// Least share of the first screen a preloader covers.+pub const PRELOADER_MIN_COVER: f64 = 0.9;++/// Page JS that defines `preloaders()`: the layers that pass every test in+/// the module doc, each as `{ el, name }`.+pub fn preloader_js() -> String {+ format!(+ r#"const loaderWords = {words};+ const wrapperWords = {wrappers};+ // A token names a loader when, after any trailing wrapper words+ // (`-wrapper`, `_bg`), its last word is a loader word: `preloader`,+ // `pre-loader`, `page_loader_bg`, `loader-wrapper`, `is-loading`.+ const namesLoader = token => {{+ const parts = String(token).toLowerCase().split(/[-_]+/).filter(Boolean);+ while (parts.length > 1 && wrapperWords.includes(parts[parts.length - 1])) parts.pop();+ return parts.length > 0 && loaderWords.includes(parts[parts.length - 1]);+ }};+ const alpha = c => {{+ const m = /rgba?\(([^)]*)\)/.exec(c || '');+ if (!m) return 0;+ const p = m[1].split(/[\s,/]+/).filter(Boolean);+ return p.length >= 4 ? parseFloat(p[3]) : 1;+ }};+ const preloaders = () => {{+ const vw = window.innerWidth || 0, vh = window.innerHeight || 0;+ if (!vw || !vh) return [];+ const covers = r => {{+ const w = Math.max(0, Math.min(r.right, vw) - Math.max(r.left, 0));+ const h = Math.max(0, Math.min(r.bottom, vh) - Math.max(r.top, 0));+ return (w * h) / (vw * vh) >= {cover};+ }};+ const points = [[0.5, 0.5], [0.2, 0.2], [0.8, 0.2], [0.2, 0.8], [0.8, 0.8]].map(([x, y]) => [Math.floor(vw * x), Math.floor(vh * y)]);+ const found = [];+ const all = document.body ? document.body.querySelectorAll('*') : [];+ for (let i = 0; i < all.length && i < 20000; i++) {{+ const el = all[i];+ const tokens = [el.id].concat(Array.from(el.classList || [])).filter(Boolean);+ if (!tokens.some(namesLoader)) continue;+ let cs;+ try {{ cs = getComputedStyle(el); }} catch (e) {{ continue; }}+ if (cs.position !== 'fixed' || cs.display === 'none' || cs.visibility !== 'visible' || parseFloat(cs.opacity) <= 0.05) continue;+ try {{ if (el.checkVisibility && !el.checkVisibility({{ opacityProperty: true, visibilityProperty: true }})) continue; }} catch (e) {{}}+ if (!covers(el.getBoundingClientRect())) continue;+ // Opaque on itself, or on a descendant that covers the screen too.+ let opaque = alpha(cs.backgroundColor) >= 0.9;+ if (!opaque) {{+ const kids = el.querySelectorAll('*');+ for (let k = 0; k < kids.length && k < 200 && !opaque; k++) {{+ try {{ opaque = alpha(getComputedStyle(kids[k]).backgroundColor) >= 0.9 && covers(kids[k].getBoundingClientRect()); }} catch (e) {{}}+ }}+ }}+ if (!opaque) continue;+ // On top: every probe point lands on the layer or inside it.+ if (!points.every(([x, y]) => {{ const hit = document.elementFromPoint(x, y); return !!hit && (hit === el || el.contains(hit)); }})) continue;+ // Not a gate or a dialog: no control, link, frame or dialog inside.+ if (el.matches('[role=dialog], [role=alertdialog], [aria-modal=true], dialog')) continue;+ if (el.querySelector('a[href], button, input:not([type=hidden]), select, textarea, iframe, [role=button], [role=dialog], [role=alertdialog], [aria-modal=true], dialog, [contenteditable=""], [contenteditable=true]')) continue;+ if ((el.innerText || '').replace(/\s+/g, ' ').trim().length > {max_text}) continue;+ // The outermost match stands for the ones inside it.+ if (found.some(f => f.el.contains(el))) continue;+ const cls = Array.from(el.classList || []).find(namesLoader);+ const name = el.tagName.toLowerCase() + (el.id && namesLoader(el.id) ? '#' + el.id : cls ? '.' + cls : el.id ? '#' + el.id : '');+ found.push({{ el, name }});+ }}+ return found;+ }};"#,+ words = json!(LOADER_WORDS),+ wrappers = json!(WRAPPER_WORDS),+ cover = PRELOADER_MIN_COVER,+ max_text = PRELOADER_MAX_TEXT,+ )+}++/// The wait probe: the names of the preloaders covering the page now.+pub fn preloader_probe_js() -> String {+ format!("(() => {{\n {}\n return preloaders().map(p => p.name);\n}})()", preloader_js())+}++fn tours_json() -> Value {+ Value::Array(+ TOUR_LIBRARIES+ .iter()+ .map(|t| {+ json!({+ "name": t.name,+ "roots": t.roots,+ "backdrops": t.backdrops,+ "bodyClasses": t.body_classes,+ "highlightClasses": t.highlight_classes,+ "ariaControls": t.highlight_aria_controls,+ })+ })+ .collect(),+ )+}++/// The hide step. Idempotent, like [`crate::consent::hide_js`]. Returns+/// `{ hidden: [{ kind, name }], matched: { name: [selector] }, unlocked:+/// [what], changed }` for the tours and preloaders it found showing this+/// time.+pub fn hide_js() -> String {+ format!(+ r#"(() => {{+ const tours = {tours};+ const STYLE_ID = {style_id};+ const MARK = {mark};+ const q = s => {{ try {{ return Array.from(document.querySelectorAll(s)); }} catch (e) {{ return []; }} }};+ const boxShows = el => {{+ try {{+ if (el.checkVisibility && !el.checkVisibility({{ opacityProperty: true, visibilityProperty: true }})) return false;+ const r = el.getBoundingClientRect();+ return r.width >= 1 && r.height >= 1;+ }} catch (e) {{ return false; }}+ }};+ {preloader}+ const out = {{ hidden: [], matched: {{}}, unlocked: [], changed: false }};+ const body = document.body;+ // Tours: the library's own roots and backdrops, measured with the hide+ // rule off so a tour already hidden is still reported.+ const present = [];+ for (const t of tours) {{+ const sels = t.roots.concat(t.backdrops).filter(s => q(s).length > 0);+ if (sels.length) present.push({{ t, sels }});+ }}+ let style = document.getElementById(STYLE_ID);+ if (present.length) {{+ if (style) style.disabled = true;+ for (const {{ t, sels }} of present) {{+ const on = sels.filter(s => q(s).some(boxShows));+ if (on.length) {{ out.hidden.push({{ kind: 'tour', name: t.name }}); out.matched[t.name] = on; }}+ }}+ if (!style) {{+ style = document.createElement('style');+ style.id = STYLE_ID;+ (document.head || document.documentElement).appendChild(style);+ }}+ style.disabled = false;+ const text = present.flatMap(({{ sels }}) => sels.map(s => s + ' {{ display: none !important; }}')).join('\n');+ if (style.textContent !== text) {{ style.textContent = text; out.changed = true; }}+ for (const {{ t }} of present) {{+ if (!out.hidden.some(h => h.name === t.name)) continue;+ if (body) for (const c of t.bodyClasses) if (body.classList.contains(c)) {{ body.classList.remove(c); out.unlocked.push('body.' + c); }}+ for (const c of t.highlightClasses) for (const el of q('.' + c)) {{+ el.classList.remove(c);+ if (!out.unlocked.includes('highlight .' + c)) out.unlocked.push('highlight .' + c);+ }}+ if (t.ariaControls) for (const el of q('[aria-controls="' + t.ariaControls + '"]')) {{+ for (const a of ['aria-controls', 'aria-haspopup', 'aria-expanded']) el.removeAttribute(a);+ if (!out.unlocked.includes('highlight aria')) out.unlocked.push('highlight aria');+ }}+ }}+ }}+ // Preloaders: hidden ones (marked) are reported again; new ones hidden.+ for (const el of q('[' + MARK + ']')) {{+ const name = el.getAttribute(MARK);+ if (name && !out.hidden.some(h => h.kind === 'preloader' && h.name === name)) out.hidden.push({{ kind: 'preloader', name }});+ }}+ for (const {{ el, name }} of preloaders()) {{+ el.setAttribute(MARK, name);+ el.style.setProperty('display', 'none', 'important');+ out.changed = true;+ if (!out.hidden.some(h => h.kind === 'preloader' && h.name === name)) out.hidden.push({{ kind: 'preloader', name }});+ }}+ if (out.unlocked.length) out.changed = true;+ return out;+}})()"#,+ tours = tours_json(),+ style_id = json!(HIDE_STYLE_ID),+ mark = json!(PRELOADER_MARK),+ preloader = preloader_js(),+ )+}++/// One overlay the scan hid.+#[derive(Debug, Clone, PartialEq, Eq)]+pub struct HiddenOverlay {+ /// `tour` or `preloader`.+ pub kind: String,+ /// The library (`driver.js`) for a tour; the layer's tag and the id or+ /// class that names it (`div#preloader`) for a preloader.+ pub name: String,+}++impl HiddenOverlay {+ pub fn to_value(&self) -> Value {+ json!({ "kind": self.kind, "name": self.name })+ }+}++/// What the overlay hide step did over a scan.+#[derive(Debug, Clone, Default, PartialEq)]+pub struct OverlayReport {+ /// Tours and preloaders that were showing and were hidden, tours first,+ /// each in first-seen order.+ pub hidden: Vec<HiddenOverlay>,+ /// Per hidden tour, the selectors that matched a showing element.+ pub matched: Vec<(String, Vec<String>)>,+ /// What was undone on the page (`body.driver-active`,+ /// `highlight .driver-active-element`, `highlight aria`).+ pub unlocked: Vec<String>,+ /// How long the scan waited for a preloader to go on its own; 0 when none+ /// was covering the page.+ pub waited_ms: u64,+}++impl OverlayReport {+ /// Fold one hide-step result into the report.+ pub fn merge(&mut self, v: &Value) {+ let strs = |v: Option<&Value>| -> Vec<String> {+ v.and_then(Value::as_array)+ .map(|a| a.iter().filter_map(Value::as_str).map(String::from).collect())+ .unwrap_or_default()+ };+ for h in v.get("hidden").and_then(Value::as_array).into_iter().flatten() {+ let (Some(kind), Some(name)) = (h.get("kind").and_then(Value::as_str), h.get("name").and_then(Value::as_str))+ else {+ continue;+ };+ let item = HiddenOverlay { kind: kind.to_string(), name: name.to_string() };+ if !self.hidden.contains(&item) {+ self.hidden.push(item);+ }+ if kind == "tour" {+ let sels = strs(v.get("matched").and_then(|m| m.get(name)));+ match self.matched.iter_mut().find(|(n, _)| n == name) {+ Some((_, have)) => {+ for s in sels {+ if !have.contains(&s) {+ have.push(s);+ }+ }+ }+ None => self.matched.push((name.to_string(), sels)),+ }+ }+ }+ for u in strs(v.get("unlocked")) {+ if !self.unlocked.contains(&u) {+ self.unlocked.push(u);+ }+ }+ // Tours before preloaders, a stable sort keeping first-seen order.+ self.hidden.sort_by_key(|h| if h.kind == "tour" { 0 } else { 1 });+ }++ /// The `overlaysHidden` value findings carry.+ pub fn hidden_value(&self) -> Value {+ Value::Array(self.hidden.iter().map(HiddenOverlay::to_value).collect())+ }++ pub fn to_value(&self) -> Value {+ let matched: serde_json::Map<String, Value> =+ self.matched.iter().map(|(n, s)| (n.clone(), json!(s))).collect();+ json!({+ "hidden": self.hidden_value(),+ "matched": matched,+ "unlocked": self.unlocked,+ "waitedMs": self.waited_ms,+ })+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn tour_selectors_name_their_library() {+ for t in TOUR_LIBRARIES {+ for s in t.roots.iter().chain(t.backdrops) {+ assert!(s.contains("driver-"), "{}: {s}", t.name);+ }+ }+ }++ #[test]+ fn report_merges_and_orders_tours_first() {+ let mut r = OverlayReport::default();+ r.merge(&json!({ "hidden": [{ "kind": "preloader", "name": "div#preloader" }], "matched": {}, "unlocked": [] }));+ r.merge(&json!({+ "hidden": [{ "kind": "tour", "name": "driver.js" }, { "kind": "preloader", "name": "div#preloader" }],+ "matched": { "driver.js": [".driver-popover", "svg.driver-overlay"] },+ "unlocked": ["body.driver-active"],+ }));+ assert_eq!(+ r.to_value(),+ json!({+ "hidden": [{ "kind": "tour", "name": "driver.js" }, { "kind": "preloader", "name": "div#preloader" }],+ "matched": { "driver.js": [".driver-popover", "svg.driver-overlay"] },+ "unlocked": ["body.driver-active"],+ "waitedMs": 0,+ })+ );+ }++ #[test]+ fn scripts_embed_every_selector_and_word() {+ let hide = hide_js();+ for t in TOUR_LIBRARIES {+ for s in t.roots.iter().chain(t.backdrops) {+ assert!(hide.contains(&serde_json::to_string(s).unwrap()), "{s}");+ }+ }+ let probe = preloader_probe_js();+ for w in LOADER_WORDS {+ assert!(probe.contains(&serde_json::to_string(w).unwrap()), "{w}");+ }+ }+}diff --git a/crates/browser/tests/consent_hiding.rs b/crates/browser/tests/consent_hiding.rsindex 510366bae..08e3a9c31 100644--- a/crates/browser/tests/consent_hiding.rs+++ b/crates/browser/tests/consent_hiding.rs@@ -90,6 +90,7 @@ const KEEP: ScanOptions = ScanOptions {profile: None,rule_pack: None,keep_consent_banners: true,+ keep_overlays: false,};#[test]@@ -231,3 +232,49 @@ fn an_app_shells_own_body_lock_stays() {let snapshot = evidence.scan_snapshot.as_deref().unwrap();assert!(snapshot.contains("overflow: hidden"), "the body keeps its own lock");}++#[test]+fn a_consentmanager_box_in_a_shadow_root_is_hidden() {+ let Some(engine) = engine() else { return };+ let port = serve();+ let url = format!("http://127.0.0.1:{port}/consentmanager.html");+ let scan = engine.detect_url_scan(&url, &ScanOptions::default()).expect("scan");+ let found = flagged(&scan.findings);+ assert!(has(&found, "low-contrast", "#covered-copy"), "{found:#?}");+ assert!(has(&found, "low-contrast", "#covered-cta"), "{found:#?}");+ for f in &scan.findings {+ assert_eq!(f.extras.get("consentHidden"), Some(&serde_json::json!(["consentmanager"])), "{f:?}");+ }+ let kept = engine.detect_url_scan(&url, &KEEP).expect("scan");+ assert!(kept.findings.iter().all(|f| f.extras.get("consentHidden").is_none()));+ assert!(kept.notes.is_empty());+}++#[test]+fn borlabs_leaves_no_scroll_lock_and_no_aria_hidden_behind() {+ let Some(engine) = engine() else { return };+ let port = serve();+ let url = format!("http://127.0.0.1:{port}/borlabs.html");+ let mut browser = engine.launch().expect("launch");+ let (_, evidence) =+ detect_url_evidence(&mut browser, &url, &ScanOptions::default(), "load", 100, &EvidenceRequest::default())+ .expect("scan");+ browser.close();+ let consent = evidence.consent.as_ref().expect("consent report");+ assert_eq!(consent.hidden, vec!["Borlabs Cookie"]);+ assert_eq!(+ consent.matched[0].1,+ vec!["#BorlabsCookieBox", "#BorlabsCookieWidget", "#BorlabsDialogBackdrop"],+ "{:?}",+ consent.matched+ );+ assert_eq!(+ consent.unlocked,+ vec!["aria-hidden [data-borlabs-cookie-aria-hidden]", "body style overflow"]+ );+ let snapshot = evidence.scan_snapshot.as_deref().unwrap();+ // The wrapper Borlabs marked is back in the page; the site's own+ // aria-hidden icon keeps its attribute.+ assert!(!snapshot.contains(r#"["aria-hidden","true"],["data-borlabs-cookie-aria-hidden""#), "wrapper unhidden");+ assert!(snapshot.contains(r#"["id","site-icon"],["aria-hidden","true"]"#), "site icon keeps aria-hidden");+}diff --git a/crates/browser/tests/overlay_hiding.rs b/crates/browser/tests/overlay_hiding.rsnew file mode 100644index 000000000..99b70b27b--- /dev/null+++ b/crates/browser/tests/overlay_hiding.rs@@ -0,0 +1,203 @@+//! Product tours and preloaders are hidden before the rule pass, against an+//! installed browser. Skips cleanly when there is none.+//!+//! - A driver.js-shaped tour at load: with hiding (the default) the copy+//! under its popover reports and the popover's own text does not, every+//! finding carries `overlaysHidden`, and the body classes that took the page+//! out of hit tests are removed; with `keep_overlays` (the CLI's+//! `--no-overlay-hiding`) the tour stays and its popover text is scored.+//! - A preloader that never clears is waited for, then hidden and recorded.+//! - A preloader that clears on its own is waited for and nothing is hidden.+//! - A routing gate on a full-screen opaque layer named like a loader stays:+//! it holds controls, so it is not a preloader.++use std::collections::HashMap;+use std::io::{Read, Write};+use std::net::{TcpListener, TcpStream};+use std::path::{Path, PathBuf};++use impeccable_browser::overlays::HiddenOverlay;+use impeccable_browser::{detect_url_evidence, BrowserEngine, EvidenceRequest};+use impeccable_core::findings::Finding;+use impeccable_detect::engines::{ScanOptions, UrlEngine};++fn fixtures_dir() -> PathBuf {+ Path::new(env!("CARGO_MANIFEST_DIR")).join("../../tests/fixtures/overlays")+}++fn serve() -> u16 {+ let listener = TcpListener::bind("127.0.0.1:0").expect("bind");+ let port = listener.local_addr().unwrap().port();+ std::thread::spawn(move || {+ for stream in listener.incoming().flatten() {+ std::thread::spawn(move || handle(stream));+ }+ });+ port+}++fn handle(mut stream: TcpStream) {+ let mut buf = [0u8; 8192];+ let n = stream.read(&mut buf).unwrap_or(0);+ let request = String::from_utf8_lossy(&buf[..n]);+ let path = request+ .lines()+ .next()+ .and_then(|l| l.split_whitespace().nth(1))+ .unwrap_or("/")+ .to_string();+ let body = std::fs::read(fixtures_dir().join(path.trim_start_matches('/'))).unwrap_or_default();+ let head = format!(+ "HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: {}\r\nConnection: close\r\n\r\n",+ body.len()+ );+ let _ = stream.write_all(head.as_bytes());+ let _ = stream.write_all(&body);+}++fn engine() -> Option<BrowserEngine> {+ let env: HashMap<String, String> = std::env::vars().collect();+ if impeccable_browser::discovery::find_browser(&env).is_err() {+ eprintln!("skip: no installed browser found");+ return None;+ }+ Some(BrowserEngine::new(env))+}++fn flagged(findings: &[Finding]) -> Vec<(String, String)> {+ findings+ .iter()+ .map(|f| {+ (+ f.antipattern.clone(),+ f.extras.get("selector").and_then(|v| v.as_str()).unwrap_or("").to_string(),+ )+ })+ .collect()+}++fn has(flagged: &[(String, String)], rule: &str, selector: &str) -> bool {+ flagged.iter().any(|(r, s)| r == rule && s == selector)+}++fn hidden(kind: &str, name: &str) -> HiddenOverlay {+ HiddenOverlay { kind: kind.into(), name: name.into() }+}++const KEEP: ScanOptions = ScanOptions {+ inline_ignores: false,+ design_system: None,+ viewport: None,+ profile: None,+ rule_pack: None,+ keep_consent_banners: false,+ keep_overlays: true,+};++#[test]+fn a_driver_tour_is_hidden_and_the_page_under_it_scored() {+ let Some(engine) = engine() else { return };+ let port = serve();+ let url = format!("http://127.0.0.1:{port}/driver-tour.html");++ let scan = engine.detect_url_scan(&url, &ScanOptions::default()).expect("scan");+ let found = flagged(&scan.findings);+ assert!(has(&found, "low-contrast", "#covered-copy"), "{found:#?}");+ assert!(has(&found, "low-contrast", "#covered-cta"), "{found:#?}");+ assert!(!has(&found, "low-contrast", "#driver-popover-description"), "{found:#?}");+ for f in &scan.findings {+ assert_eq!(+ f.extras.get("overlaysHidden"),+ Some(&serde_json::json!([{ "kind": "tour", "name": "driver.js" }])),+ "{f:?}"+ );+ assert!(f.extras.get("consentHidden").is_none());+ }+ assert_eq!(+ scan.notes,+ vec![format!("Hid the driver.js tour on {url} before scanning. Pass --no-overlay-hiding to scan it.")]+ );++ let mut browser = engine.launch().expect("launch");+ let (_, evidence) =+ detect_url_evidence(&mut browser, &url, &ScanOptions::default(), "load", 100, &EvidenceRequest::default())+ .expect("scan");+ let (kept, kept_evidence) =+ detect_url_evidence(&mut browser, &url, &KEEP, "load", 100, &EvidenceRequest::default()).expect("scan");+ browser.close();+ let report = evidence.overlays.as_ref().expect("overlay report");+ assert_eq!(report.hidden, vec![hidden("tour", "driver.js")]);+ assert_eq!(+ report.matched,+ vec![("driver.js".to_string(), vec![".driver-popover".to_string(), "svg.driver-overlay".to_string()])]+ );+ assert_eq!(+ report.unlocked,+ vec![+ "body.driver-active",+ "body.driver-fade",+ "highlight .driver-active-element",+ "highlight .driver-no-interaction",+ "highlight aria"+ ]+ );+ assert_eq!(report.waited_ms, 0);+ let snapshot = evidence.scan_snapshot.as_deref().unwrap();+ assert!(snapshot.contains("impeccable-overlay-hide"));+ assert!(!snapshot.contains(r#"["aria-controls","driver-popover-content"]"#), "highlight aria removed");+ assert!(!snapshot.contains(r#"["class","driver-active driver-fade"]"#), "body classes removed");++ // Opted out, the tour stays and its popover is scored as the page.+ let shown = flagged(&kept);+ assert!(has(&shown, "low-contrast", "#driver-popover-description"), "{shown:#?}");+ assert!(kept_evidence.overlays.is_none());+}++#[test]+fn a_stuck_preloader_is_waited_for_then_hidden() {+ let Some(engine) = engine() else { return };+ let port = serve();+ let url = format!("http://127.0.0.1:{port}/preloader-stuck.html");+ let mut browser = engine.launch().expect("launch");+ let (findings, evidence) =+ detect_url_evidence(&mut browser, &url, &ScanOptions::default(), "load", 100, &EvidenceRequest::default())+ .expect("scan");+ let (kept, _) = detect_url_evidence(&mut browser, &url, &KEEP, "load", 100, &EvidenceRequest::default()).expect("scan");+ browser.close();+ let found = flagged(&findings);+ assert!(has(&found, "low-contrast", "#covered-copy"), "{found:#?}");+ let report = evidence.overlays.as_ref().expect("overlay report");+ assert_eq!(report.hidden, vec![hidden("preloader", "div#preloader")]);+ assert!(report.waited_ms >= impeccable_browser::overlays::PRELOADER_WAIT_MS, "{}", report.waited_ms);+ assert!(evidence.scan_snapshot.as_deref().unwrap().contains("data-impeccable-hidden"));+ // Kept, the white layer covers the copy and it is not scored.+ assert!(!has(&flagged(&kept), "low-contrast", "#covered-copy"), "{kept:#?}");+}++#[test]+fn a_preloader_that_clears_is_waited_for_and_nothing_hidden() {+ let Some(engine) = engine() else { return };+ let port = serve();+ let url = format!("http://127.0.0.1:{port}/preloader-clears.html");+ let mut browser = engine.launch().expect("launch");+ let (findings, evidence) =+ detect_url_evidence(&mut browser, &url, &ScanOptions::default(), "load", 100, &EvidenceRequest::default())+ .expect("scan");+ browser.close();+ assert!(has(&flagged(&findings), "low-contrast", "#covered-copy"), "{findings:#?}");+ let report = evidence.overlays.as_ref().expect("overlay report");+ assert!(report.hidden.is_empty(), "{report:?}");+ assert!(report.waited_ms > 0 && report.waited_ms < impeccable_browser::overlays::PRELOADER_WAIT_MS, "{}", report.waited_ms);+}++#[test]+fn a_routing_gate_named_like_a_loader_stays() {+ let Some(engine) = engine() else { return };+ let port = serve();+ let url = format!("http://127.0.0.1:{port}/gate.html");+ let scan = engine.detect_url_scan(&url, &ScanOptions::default()).expect("scan");+ let found = flagged(&scan.findings);+ assert!(has(&found, "low-contrast", "#gate-hint"), "{found:#?}");+ assert!(scan.findings.iter().all(|f| f.extras.get("overlaysHidden").is_none()));+ assert!(scan.notes.is_empty(), "{:?}", scan.notes);+}diff --git a/crates/detect/src/cli.rs b/crates/detect/src/cli.rsindex fc786f4ae..564181a09 100644--- a/crates/detect/src/cli.rs+++ b/crates/detect/src/cli.rs@@ -40,6 +40,9 @@ Options:--no-consent-hiding URL scans: keep known consent managers' banners(OneTrust, Cookiebot, ...) on the page instead of hidingthem before the scan+ --no-overlay-hiding URL scans: keep product tours (driver.js) and+ preloaders still covering the page instead of hiding+ them before the scan--help Show this help messageAdvisory findings:@@ -525,6 +528,7 @@ fn detect_cli(args_in: &[String], io: &mut Io, engines: &Engines) -> Result<i32,// does sets this before handing the options to an engine.rule_pack: None,keep_consent_banners: has(&args, "--no-consent-hiding"),+ keep_overlays: has(&args, "--no-overlay-hiding"),};let targets: Vec<String> = expand_joined_url_targets(args.iter()diff --git a/crates/detect/src/engines.rs b/crates/detect/src/engines.rsindex 0379c8eaa..3fa941909 100644--- a/crates/detect/src/engines.rs+++ b/crates/detect/src/engines.rs@@ -31,10 +31,15 @@ pub struct ScanOptions {/// (`--no-consent-hiding`). By default the browser engine hides them/// before the rule pass.pub keep_consent_banners: bool,+ /// URL scans only: leave product tours and preloaders on the page+ /// (`--no-overlay-hiding`). By default the browser engine waits briefly+ /// for a preloader and hides what is left, and hides known tours, before+ /// the rule pass.+ pub keep_overlays: bool,}/// A URL scan's findings plus the notes the CLI prints about how the page-/// was scanned (a consent banner the engine hid, say).+/// was scanned (a consent banner or a preloader the engine hid, say).#[derive(Debug, Default)]pub struct UrlScan {pub findings: Vec<Finding>,diff --git a/crates/hook/src/hook_lib.rs b/crates/hook/src/hook_lib.rsindex a655df691..c397c7865 100644--- a/crates/hook/src/hook_lib.rs+++ b/crates/hook/src/hook_lib.rs@@ -1632,6 +1632,7 @@ impl HookScanOptions {profile: None,rule_pack: None,keep_consent_banners: false,+ keep_overlays: false,}}}diff --git a/docs/CLI-CONTRACT.md b/docs/CLI-CONTRACT.mdindex e2520eb8e..e7801d1db 100644--- a/docs/CLI-CONTRACT.md+++ b/docs/CLI-CONTRACT.md@@ -97,6 +97,7 @@ Notation: `stdout>` / `stderr>` are literal writes; `exit N`; template strings u| `--help` | print usage (stdout) and `exit 0` — evaluated *after* scope/viewport parsing (so a bad `--scope` still errors first) || `--no-advisory` | drop findings with `advisory === true` before output/exit-code || `--no-consent-hiding` | URL scans only (Rust engine): leave known consent managers' banners on the page instead of hiding them before the scan (see **Consent banners** under URL scans). No effect on file scans |+| `--no-overlay-hiding` | URL scans only (Rust engine): leave product tours and preloaders on the page, and skip the preloader wait (see **Tours and preloaders** under URL scans). No effect on file scans || `--fast` | deprecated, ignored; `stderr> Note: --fast is deprecated and ignored. The full scan is fast now and runs every rule.\n` || `--gpt`, `--gemini` | deprecated, ignored; `stderr> Note: --gpt and --gemini are deprecated and ignored. Generated-UI tells now run by default.\n` || `--no-config` | `configEnabled=false`: detectionConfig = `{ignoreRules:[],ignoreFiles:[],ignoreValues:[]}`; also disables design system and inline ignores |@@ -127,6 +128,9 @@ Options:--no-consent-hiding URL scans: keep known consent managers' banners(OneTrust, Cookiebot, ...) on the page instead of hidingthem before the scan+ --no-overlay-hiding URL scans: keep product tours (driver.js) and+ preloaders still covering the page instead of hiding+ them before the scan--help Show this help messageAdvisory findings:@@ -210,7 +214,7 @@ reports no findings and prints `stderr> Error: the page is ...`.- text: `stderr> formatFindings(all,false) + '\n'`.- `exit(hadOperationalFailure ? 1 : (primary.length > 0 ? 2 : 0))`.- no findings: json → `stdout> []\n`; text/quiet → nothing. `exit(hadOperationalFailure ? 1 : 0)`.-- Text mode (not `--json`, not `--quiet`) prints scan notes after the findings, or alone when there are none, one line each in first-seen order: the DESIGN.md purple note, and for a URL scan that hid consent banners `Hid the <names> consent banner(s) on <url> before scanning. Pass --no-consent-hiding to scan it.` (`<names>` joined `A, B and C`).+- Text mode (not `--json`, not `--quiet`) prints scan notes after the findings, or alone when there are none, one line each in first-seen order: the DESIGN.md purple note, and for a URL scan that hid consent banners `Hid the <names> consent banner(s) on <url> before scanning. Pass --no-consent-hiding to scan it.` (`<names>` joined `A, B and C`), and for one that hid tours or preloaders `Hid <items> on <url> before scanning. Pass --no-overlay-hiding to scan it.`, each item `the <library> tour` or `the preloader <name>`, joined the same way.- Exit 1 takes precedence over exit 2: findings from the targets that did scando not turn a partial scan into a complete one (#711).- Any other exit: `1` for arg errors above; uncaught exceptions propagate to `cli.js` catch (`exit 1`).@@ -253,7 +257,7 @@ Example (non-TTY):{ antipattern: id, name: ap.name, description: ap.description, severity: ap.severity || 'warning', category: ap.category || null, file: filePath, line, snippet }// plus, only when the effective severity is 'advisory': advisory: true```-Optional keys added later by engines (appended after the above): `ignoreValue` (design-system rules; browser findings with a value), `importedBy` (dir scans), `selector`, `thirdParty` and `consentHidden` (URL scans, below), `severity` may be overwritten by per-finding promotion (browser & html-patterns, e.g. pulsing dot in a header). Design-system findings are `{...finding(...), ...extras}` where extras = `{ ignoreValue }`. Static-HTML and browser findings have `line: 0`; regex findings have 1-based lines. `severity` values in registry: `'warning'` (default), `'advisory'` (many generated-UI tells and design-system-color/radius/font-size, numbered-section-labels, blinking-cursor, shape-assembled-illustration, layout-transition, bounce-easing), `'error'` (`script-error`, `content-hidden-at-rest`). Per-finding demotions to `'advisory'` in the Rust engine: `flat-type-hierarchy` when weight separates the roles (below), a `script-error` an ad-tech script threw, and a `script-error` that is one of React's recoverable hydration errors (URL scans). `severity` is the canonical advisory field (#709): `deriveAdvisoryFlag` stamps `advisory: true` when and only when the effective severity is `'advisory'`, so a per-finding promotion or demotion carries the flag with it, and every `severity:'advisory'` rule is partitioned out of the failure count and the exit code. `isAdvisory` accepts either `finding.advisory === true` or `finding.severity === 'advisory'`.+Optional keys added later by engines (appended after the above): `ignoreValue` (design-system rules; browser findings with a value), `importedBy` (dir scans), `selector`, `thirdParty`, `consentHidden` and `overlaysHidden` (URL scans, below), `severity` may be overwritten by per-finding promotion (browser & html-patterns, e.g. pulsing dot in a header). Design-system findings are `{...finding(...), ...extras}` where extras = `{ ignoreValue }`. Static-HTML and browser findings have `line: 0`; regex findings have 1-based lines. `severity` values in registry: `'warning'` (default), `'advisory'` (many generated-UI tells and design-system-color/radius/font-size, numbered-section-labels, blinking-cursor, shape-assembled-illustration, layout-transition, bounce-easing), `'error'` (`script-error`, `content-hidden-at-rest`). Per-finding demotions to `'advisory'` in the Rust engine: `flat-type-hierarchy` when weight separates the roles (below), a `script-error` an ad-tech script threw, and a `script-error` that is one of React's recoverable hydration errors (URL scans). `severity` is the canonical advisory field (#709): `deriveAdvisoryFlag` stamps `advisory: true` when and only when the effective severity is `'advisory'`, so a per-finding promotion or demotion carries the flag with it, and every `severity:'advisory'` rule is partitioned out of the failure count and the exit code. `isAdvisory` accepts either `finding.advisory === true` or `finding.severity === 'advisory'`.**Categories**: `category` is `'slop'` (AI tells) or `'quality'`. Category has **no effect on output**, ordering, or exit codes; it is only carried in the finding and used by `getRulesForCategory`. Registry (58 ids, in order): side-tab, border-accent-on-rounded, overused-font, flat-type-hierarchy, gradient-text, ai-color-palette, cream-palette, nested-cards, monotonous-spacing, bounce-easing, pulsing-dot, blinking-cursor, shape-assembled-illustration, dark-glow, radial-halo, radial-spotlight-glow, marquee, icon-tile-stack, italic-serif-display, hero-eyebrow-chip, kicker-above-heading, numbered-section-labels, em-dash-overuse, marketing-buzzword, aphoristic-cadence, oversized-h1, extreme-negative-tracking, broken-image, script-error, content-hidden-at-rest, edge-flush-cards, text-occlusion, first-viewport-column-overflow, gray-on-color, low-contrast, layout-transition, line-length, cramped-padding, body-text-viewport-edge, tight-leading, skipped-heading, heading-rhythm, justified-text, tiny-text, undersized-ui-text, all-caps-body, wide-tracking, text-overflow, repeated-container-text, clipped-overflow-container, design-system-font, design-system-color, design-system-radius, design-system-font-size, gpt-thin-border-wide-shadow, repeating-stripes-gradient, codex-grid-background, theater-slop-phrase. Scopes: `type` = overused-font, flat-type-hierarchy, italic-serif-display, hero-eyebrow-chip, kicker-above-heading, numbered-section-labels, oversized-h1, extreme-negative-tracking, line-length, tight-leading, skipped-heading, heading-rhythm, justified-text, tiny-text, undersized-ui-text, all-caps-body, wide-tracking, design-system-font, design-system-font-size; `layout` = nested-cards, monotonous-spacing, icon-tile-stack, content-hidden-at-rest, edge-flush-cards, text-occlusion, first-viewport-column-overflow, line-length, cramped-padding, body-text-viewport-edge, heading-rhythm, text-overflow, clipped-overflow-container. `RULE_ENGINE_SUPPORT = { regex: Set['source','page-analyzer'], 'static-html': Set['element','page'], browser: Set['element','page','layout'], visual: Set['visual-contrast'] }`.@@ -356,7 +360,8 @@ Optional keys added later by engines (appended after the above): `ignoreValue` (- **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). On a page of any size, a bot manager's challenge sheet laid over the rendered page is a challenge too: HUMAN Security's (PerimeterX's) "Press & hold" check, `#px-captcha-modal` or `#px-captcha-wrapper`, while it is showing (not `display: none`, not `visibility: hidden`, opacity over 0.02) and covers at least half the viewport; the signal reads `overlay human-press-and-hold`, and the probe records `overlays` only when one shows. 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.Consent wall: a page with at most 3000 characters of visible text where a known consent manager (next item) is showing, hiding it would leave next to nothing (fewer than 20 visible characters outside its roots, and no visible form control (`input` other than hidden, `select`, `textarea`, `button`) and no `img`, `svg`, `video`, `canvas`, `iframe`, `object` or `embed` of 10,000 square pixels or more outside them), and the manager holds at least 100 characters. It throws `the page is a consent wall, not the site (consent manager <names>, <n> of <total> visible characters outside it, no control or image outside it). Findings would describe the consent dialog, so none are reported.` A short page under an ordinary banner (a sign-in form, a splash page with a button, an image-first page) is scanned. The probe runs before any banner is hidden. With `--no-consent-hiding` the gate is off and the page is scanned with its banner, which is what that flag asks for. The probe object (evidence) carries `consent` (the names of the managers showing), `consentChars` (visible characters inside them) and `consentOutside` (visible controls and sizable media outside them, counted up to 20).- - **Consent banners** (Rust engine). A consent banner covers copy a visitor reads once they dismiss it: text under it was skipped as covered or scored against the banner, and the banner's own text was scored as the site's. After the validity gate, again after the reveal sweep (so a banner injected after load or on the first scroll is caught before the capture), and once more right after the capture (when that pass changes the page, the page is captured again, so the capture, the live hit tests and the pixel reads agree), the engine hides the roots and backdrops of the consent managers in `crates/browser/src/consent.rs`: OneTrust, Cookiebot, Usercentrics, TrustArc, Didomi, Quantcast Choice, Sourcepoint, Osano, the open-source Cookie Consent library, CookieYes, Complianz, iubenda, Termly, Axeptio, Borlabs Cookie, Klaro, Cookie Notice, Shopify's privacy banner, and Google Funding Choices. Selectors are the vendor's own ids and classes, never a generic word, so a notice a site wrote for itself stays on the page and is scanned. Hiding is one injected `<style id="impeccable-consent-hide">` of `display: none !important` rules (plus an inline `display: none !important` on a matched element whose own inline style outranks the rule); nothing is clicked and no cookie or consent state is set. The scroll lock is undone only where the manager applied it: its own lock classes on `<html>` / `<body>` (Didomi `didomi-popup-open`, Sourcepoint `sp-message-open`) are removed, and an inline `overflow` / `overflow-y: hidden` on `<html>` or `<body>` is removed only while that manager's backdrop was showing and the page is not an app shell (an element outside the managers at least half the viewport tall that scrolls itself with `overflow-y: auto` / `scroll`, whose body lock is the site's own). Every hide pass is best-effort: one that fails hides nothing and does not fail the scan. Every pass, the hit tests, and the evidence screenshot see the page without the banner (a last hide runs before the screenshot). Findings from a scan that hid a showing banner carry `consentHidden: ["<name>", ...]` (after `thirdParty`), and text mode prints the note above. `--no-consent-hiding` turns all of it off. The evidence API (`detect_url_evidence`) leaves the findings untagged, so they replay equal, and records `Evidence.consent`: `{ hidden, matched: { <name>: [selectors] }, unlocked }`. The static (file) engine is unaffected.+ - **Consent banners** (Rust engine). A consent banner covers copy a visitor reads once they dismiss it: text under it was skipped as covered or scored against the banner, and the banner's own text was scored as the site's. After the validity gate, again after the reveal sweep (so a banner injected after load or on the first scroll is caught before the capture), and once more right after the capture (when that pass changes the page, the page is captured again, so the capture, the live hit tests and the pixel reads agree), the engine hides the roots and backdrops of the consent managers in `crates/browser/src/consent.rs`: OneTrust, Cookiebot, Usercentrics, TrustArc, Didomi, Quantcast Choice, Sourcepoint, Osano, the open-source Cookie Consent library, CookieYes, Complianz, iubenda, Termly, Axeptio, Borlabs Cookie (its box, its floating `#BorlabsCookieWidget` and its `#BorlabsDialogBackdrop`), Klaro, Cookie Notice, Shopify's privacy banner, consentmanager (`#cmpwrapper`, the host of the open shadow root its box renders in, and `#cmpbox`), and Google Funding Choices. Selectors are the vendor's own ids and classes, never a generic word, so a notice a site wrote for itself stays on the page and is scanned. Hiding is one injected `<style id="impeccable-consent-hide">` of `display: none !important` rules (plus an inline `display: none !important` on a matched element whose own inline style outranks the rule); nothing is clicked and no cookie or consent state is set. The scroll lock is undone only where the manager applied it: its own lock classes on `<html>` / `<body>` (Didomi `didomi-popup-open`, Sourcepoint `sp-message-open`) are removed, the `aria-hidden="true"` a manager put on the page behind its dialog is removed from exactly the elements it marked (Borlabs Cookie marks them `data-borlabs-cookie-aria-hidden`; reported in `unlocked` as `aria-hidden [<mark>]`), and an inline `overflow` / `overflow-y: hidden` on `<html>` or `<body>` is removed only while that manager's backdrop was showing and the page is not an app shell (an element outside the managers at least half the viewport tall that scrolls itself with `overflow-y: auto` / `scroll`, whose body lock is the site's own). Every hide pass is best-effort: one that fails hides nothing and does not fail the scan. Every pass, the hit tests, and the evidence screenshot see the page without the banner (a last hide runs before the screenshot). Findings from a scan that hid a showing banner carry `consentHidden: ["<name>", ...]` (after `thirdParty`), and text mode prints the note above. `--no-consent-hiding` turns all of it off. The evidence API (`detect_url_evidence`) leaves the findings untagged, so they replay equal, and records `Evidence.consent`: `{ hidden, matched: { <name>: [selectors] }, unlocked }`. The static (file) engine is unaffected.+ - **Tours and preloaders** (Rust engine, `crates/browser/src/overlays.rs`). Right after the consent hide following the validity gate, the engine looks for a preloader still covering the page: a `position: fixed` layer other than `html` / `body` that covers at least 90% of the viewport, is what `elementFromPoint` returns (or contains it) at the center and at 20% / 80% of each axis, paints an opaque fill (alpha 0.9 or more) on itself or on a descendant covering as much, has at most 60 visible characters and no `a[href]`, `button`, visible `input`, `select`, `textarea`, `iframe`, `[role=button]`, dialog role, `aria-modal=true`, `dialog` or editable descendant, is not itself a dialog, and whose id or one of its classes names a loader (after trailing wrapper words such as `wrapper`, `overlay`, `screen`, `bg`, its last `-` / `_` word is `preloader`, `preload`, `preloading`, `loader`, `loading`, `pageloader`, `siteloader`, `loadingscreen` or `spinner`). If one is there the engine polls every 250ms for up to 5s for it to go on its own, then hides whatever is left with an inline `display: none !important` and marks it `data-impeccable-hidden="<name>"` (`<name>` is the tag plus the naming id or class, `div#preloader`). Known product tours are hidden by their library's own markup with one injected `<style id="impeccable-overlay-hide">`: driver.js 1.x (`.driver-popover`, `svg.driver-overlay`), whose `driver-active` / `driver-fade` / `driver-simple` body classes (its stylesheet sets `pointer-events: none` under `.driver-active`, which hides the page from hit tests), highlight classes (`driver-active-element`, `driver-no-interaction`) and highlight aria (`aria-controls="driver-popover-content"` with `aria-haspopup` and `aria-expanded`) are removed too. The hide runs at the same points as the consent hide (after the validity gate, after the reveal sweep, after the capture with a recapture when it changed the page, before the screenshot) and is as best-effort. A gate the visitor answers, a site's own dialog, and any layer with controls or more text are left on the page. Findings from a scan that hid any carry `overlaysHidden: [{ "kind": "tour" | "preloader", "name": "<name>" }, ...]` (tours first, after `consentHidden`), and text mode prints the note above. `consentHidden` is unchanged and lists consent managers only. `--no-overlay-hiding` turns all of it off, the wait included. The evidence API leaves the findings untagged and records `Evidence.overlays`: `{ hidden: [{ kind, name }], matched: { <library>: [selectors] }, unlocked, waitedMs }` (`waitedMs` is 0 when no preloader was covering the page).- **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.- **Viewport edges and overflow.** `body-text-viewport-edge` reports a gutter under 16px, or under 12px when `innerWidth` is 480px or less. A paragraph whose measured text runs past a side of the viewport (the distance rounds below 0) reports no gutter on that side; it still reports a gutter from 0px to the floor on the other side (`(left 8px)`). Those paragraphs, through the same gates plus the Text paint gate and inline ignores, report once per page instead: one `body-text-viewport-edge` finding attributed to the page (`selector` `body`, in `pageLevel`) on the side the furthest text reaches. The message follows what the page does. It reads `text runs past the <side> edge of the <vw>px viewport and is cut off: <name> reaches <d>px past it, with text in <n> block(s)` when the text is cut off: the viewport clips x overflow (the root's `overflow-x`, or body's when the root's is `visible`, at `hidden` or `clip`), the side is not the one the page scrolls to (right, or left under `direction: rtl`), the root's recorded `scrollWidth` does not exceed its `clientWidth` by more than 1px, or for every paragraph on that side a box at `overflow-x: hidden` or `clip` (the paragraph or an ancestor below the body, with its own edge on that side inside the viewport) is passed by the text. `<name>` is then the box reaching furthest among the paragraphs and their ancestors. Otherwise it reads `page scrolls sideways at <vw>px: <name> reaches <d>px past the <side> edge, and text in <n> block(s) runs past it`, where `<name>` is the box reaching furthest past that side among those no ancestor below the root clips or scrolls on x and not `position: fixed`, and no further than the page scrolls (ties go to the outer box). When the engine cannot tell (nothing it can see clips the text and the root recorded no `scrollWidth`) the sideways wording stands and `<name>` is the box reaching furthest among the paragraphs and their ancestors. In both wordings the paragraph itself is named when its text reaches further than any such box. `<name>` is the element's `class_selector`, except that a `div` with no class is named `div#<id>`, else `div in <tag>#<id>` or `div in <tag>.<class>` (at most three classes) after its nearest ancestor below the body with an id or a class, else `div ("<text>")` with up to 40 characters of its text, cut at a word and ended with `…` when cut, double quotes in the text written as `'`. `text-overflow` reports a spill only when it does harm: a box at `overflow-x: hidden` or `clip` (the element itself or an ancestor below the body, with area) is passed by the spill's reach, the spill reaches within a quarter em of the viewport's side or past it, or the spilled part comes within a quarter em of another element's text or painted box on the element's lines (not an ancestor or descendant, not a box that holds the element's whole box, and not a decoration layer: an absolutely or fixed positioned box with no text, other than a replaced element or an `svg`, that is 2px thick or less or paints only a plain fill, with no background image or border, at alpha times opacity under 0.25). The reach is the painted extent, or the scroll extent where that is taken as read; text that runs past its box into free space reports nothing.- **Round 7 recall and gates** (corpus run 28). `line-length` and `body-text-viewport-edge` (its element and page-level forms) also measure prose written straight into a generic block: a `div`, `section`, `article`, `aside` or `main` laid out as `block` or `flow-root`, with more than 10 characters of its own text, only phrasing inside it, not set `white-space: pre*`, and outside any link, button, label, summary, select, textarea, button-, link-, tab-, menuitem- or option-role element and editable field; it is measured on its text runs only (where those cannot be measured it is not taken for a paragraph), and the edge snippet names it (`<div> with 228-char body ...`). The label collectors read the element that holds a label's text: its own text, else the one child whose text is not empty, at most three levels down, so a chip with an icon beside its text span is read through the span; `hero-eyebrow-chip` reads its sibling that way too, and its tracked-caps floor is 1.6px or 0.08em of the label's size; under 1.6px a label that is or holds a `time` element, or that names a year (1900 to 2099 as a word), is a dated meta line and not tracked caps (the recorded JS vectors pin the fixed floor alone). `kicker-above-heading` hands a label over a 48px-or-larger h1 to the hero rule at 1.6px, or, when the label is the h1's own previous sibling at 14px or less, at 0.08em where `hero-eyebrow-chip` reports that label (it does not read small-caps as capitals and passes over a dated line, so such a label stays a kicker; the static engine: at 14px or less). A card-context ancestor (`article`, `li`, `a`, `button`, ...) more than two viewports tall holds the page and is not a card for the kicker and numbered-label collectors. `icon-tile-stack` anchors on a card title set on a `div` or `span` too: laid out as a block, with no element children, 2 to 80 characters of its own text, weight 600 or more at 16px or more, outside any heading, link, button or label; it reads an `oklab()` or other modern tile fill. `tiny-text` skips a label typed in capitals (all its letters capitals, at most 40 letters, one line) and a run in a monospace face with `white-space: pre*`. `wide-tracking` counts a caps label's letters, not its characters, toward its 40-letter gate, and skips a one-line link or button label of at most 40 letters. The element contrast pass scores a box under 10px tall when it holds a line of its own text at 8px or more and is at least 0.9 of the font size tall. `ai-color-palette`'s gradient form skips a box whose gradient, sampled at nine points over the box from its computed size and position, shows one colour (every sample within 12 levels on each channel); an element reports the rule once: the computed gradient form stands for the utility-class gradient form, the computed purple-heading form for the class form (`text-purple-600 on heading`), and `gradient-text` on the element for both gradient forms. `gradient-text` skips a ramp whose strongest stop, times the element's own opacity, is under 0.15, and its stylesheet form does not stand when every element computing a clipped gradient is unpainted or under that floor. `gpt-thin-border-wide-shadow` reads, under one gradient ancestor with no picture, each of its stops composited over the fills below: a halo that shows over at most half of them does not count. `dark-glow`'s surface lift counts only layers carrying at least half the strength floor (1.5px of light), and its stylesheet form with no selector does not stand when an element's computed shadow carries the declaration: the element form read that element.diff --git a/tests/fixtures/consent/borlabs.html b/tests/fixtures/consent/borlabs.htmlnew file mode 100644index 000000000..f59c22438--- /dev/null+++ b/tests/fixtures/consent/borlabs.html@@ -0,0 +1,47 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Consent hiding: a Borlabs Cookie 3-shaped dialog</title>+ <style>+ /* A Borlabs Cookie 3-shaped dialog (its ids and marks, not its script),+ as fischundfang.de serves it: `#BorlabsCookieBox` holding the dialog+ and `#BorlabsDialogBackdrop`, the floating `#BorlabsCookieWidget`+ shield, an inline `overflow: hidden` on <body>, and+ `aria-hidden="true"` on the page wrapper, which Borlabs marks+ `data-borlabs-cookie-aria-hidden`. The site's own aria-hidden icon has+ no mark and keeps its aria-hidden. Pinned by+ crates/browser/tests/consent_hiding.rs. */+ * { box-sizing: border-box; }+ body { font: 16px/1.5 system-ui, sans-serif; margin: 0; padding: 40px; color: #111; background: #fff; }+ .section { height: 900px; }+ #BorlabsDialogBackdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 999998; }+ .brlbs-cmpnt-dialog { position: fixed; top: 160px; left: 50%; width: 600px; margin-left: -300px; padding: 28px;+ background: #fff; border-radius: 8px; z-index: 999999; }+ .brlbs-cmpnt-dialog p { margin: 0 0 16px; font-size: 14px; color: #b0b0b0; }+ #BorlabsCookieWidget svg { position: fixed; left: 20px; bottom: 20px; width: 48px; height: 48px; z-index: 999997; }+ </style>+</head>+<body style="overflow: hidden;">+ <div id="page-wrap" aria-hidden="true" data-borlabs-cookie-aria-hidden="true">+ <h1>A page behind a Borlabs dialog</h1>+ <p id="copy">The page copy. Borlabs marks this wrapper aria-hidden while its dialog is open.</p>+ <span id="site-icon" aria-hidden="true">*</span>+ <div class="section"></div>+ <div class="section"></div>+ </div>+ <div id="BorlabsCookieBox" data-borlabs-cookie-consent-required="true">+ <div class="vue-focus-loop">+ <div class="brlbs-cmpnt-dialog" role="dialog" aria-modal="true">+ <p id="brlbs-text">Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell.</p>+ <button type="button">Alle akzeptieren</button>+ </div>+ <div class="brlbs-fixed"><div id="BorlabsDialogBackdrop" class="brlbs-cmpnt-dialog-backdrop"></div></div>+ </div>+ </div>+ <div id="BorlabsCookieWidget" class="brlbs-cmpnt-container">+ <svg viewBox="0 0 48 48" role="presentation" aria-hidden="true"><circle cx="24" cy="24" r="22" fill="#444"></circle></svg>+ </div>+</body>+</html>diff --git a/tests/fixtures/consent/consentmanager.html b/tests/fixtures/consent/consentmanager.htmlnew file mode 100644index 000000000..643e76b30--- /dev/null+++ b/tests/fixtures/consent/consentmanager.html@@ -0,0 +1,37 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Consent hiding: a consentmanager-shaped box in a shadow root</title>+ <style>+ /* A consentmanager.net-shaped box (its ids and classes, not its script):+ `div#cmpbox` with role=dialog, fixed over the lower part of the first+ screen, rendered inside the open shadow root of `div#cmpwrapper`, as+ letour.fr serves it. Under it sit a faint line of copy and a CTA, real+ contrast failures; inside it, the box's own faint text. The URL engine+ hides the host before the rule pass. Pinned by+ crates/browser/tests/consent_hiding.rs. */+ * { box-sizing: border-box; }+ body { font: 16px/1.5 system-ui, sans-serif; margin: 0; padding: 40px; color: #111; background: #fff; }+ .faint { position: absolute; top: 640px; left: 80px; width: 520px; margin: 0; font-size: 14px; line-height: 28px; color: #aaaaaa; }+ .cta { position: absolute; top: 700px; left: 80px; display: inline-block; padding: 8px 16px; border-radius: 6px;+ background: #ff7145; color: #ffffff; font-size: 15px; font-weight: 500; text-decoration: none; }+ </style>+</head>+<body>+ <h1>A page under a consentmanager box</h1>+ <p>The copy near the top of the page is readable and nothing covers it.</p>+ <p class="faint" id="covered-copy">Faint copy the consent box covers at load.</p>+ <a href="#" class="cta" id="covered-cta">Read the route</a>+ <div id="cmpwrapper" class="cmpwrapper"></div>+ <script>+ const host = document.getElementById('cmpwrapper');+ const root = host.attachShadow({ mode: 'open' });+ root.innerHTML = '<style>#cmpbox { position: fixed; left: 0; right: 0; top: 580px; height: 220px; padding: 20px 40px; background: #ffffff; border-top: 1px solid #ddd; z-index: 2147483640; } .cmpboxtxt { margin: 0; max-width: 700px; font-size: 14px; color: #b0b0b0; }</style>'+ + '<div id="cmpbox" class="cmpbox cmpstyleroot" role="dialog" aria-modal="true" aria-label="Privacy settings" style="display: block;">'+ + '<div class="cmpboxinner"><div id="cmpboxcontent"><div class="cmpboxtxt cmptxt_txt">We, our providers and partners, deposit cookies and similar technologies to store and access information on your device.</div></div>'+ + '<a class="cmpboxbtn cmpboxbtnyes" role="button" href="#">Accept All Cookies</a></div></div>';+ </script>+</body>+</html>diff --git a/tests/fixtures/overlays/driver-tour.html b/tests/fixtures/overlays/driver-tour.htmlnew file mode 100644index 000000000..365718953--- /dev/null+++ b/tests/fixtures/overlays/driver-tour.html@@ -0,0 +1,48 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Overlay hiding: a driver.js-shaped tour at load</title>+ <style>+ /* A driver.js 1.x-shaped tour (its classes and the rules its stylesheet+ ships, not its script), as gamer.com.tw starts it on every load: a+ full-screen `svg.driver-overlay` dimming the page, a+ `div.driver-popover` dialog, `driver-active driver-fade` on <body>, and+ the highlighted element's classes and aria. Under the popover sit a+ faint line of copy and a CTA, real contrast failures; inside it, the+ popover's own faint text. The URL engine hides the tour before the+ rule pass. Pinned by crates/browser/tests/overlay_hiding.rs. */+ * { box-sizing: border-box; }+ body { font: 16px/1.5 system-ui, sans-serif; margin: 0; padding: 40px; color: #111; background: #fff; }+ nav { height: 44px; background: #f4f4f4; }+ .faint { position: absolute; top: 260px; left: 820px; width: 380px; margin: 0; font-size: 14px; line-height: 28px; color: #aaaaaa; }+ .cta { position: absolute; top: 320px; left: 820px; display: inline-block; padding: 8px 16px; border-radius: 6px;+ background: #ff7145; color: #ffffff; font-size: 15px; font-weight: 500; text-decoration: none; }+ /* From driver.js 1.3.1's stylesheet. */+ .driver-active .driver-overlay, .driver-active * { pointer-events: none; }+ .driver-active .driver-active-element, .driver-active .driver-active-element *, .driver-popover, .driver-popover * { pointer-events: auto; }+ .driver-popover { all: unset; box-sizing: border-box; color: #2d2d2d; margin: 0; padding: 15px; border-radius: 5px;+ min-width: 250px; max-width: 300px; box-shadow: 0 1px 10px #0006; z-index: 1000000000; position: fixed; top: 0; right: 0; background-color: #fff; }+ .driver-popover-title { font: 19px/normal sans-serif; font-weight: 700; display: block; margin: 0 0 12px; }+ .driver-popover-description { font-size: 14px; color: #b5b5b5; display: block; }+ </style>+</head>+<body class="driver-active driver-fade">+ <nav class="main-nav driver-no-interaction driver-active-element" aria-haspopup="dialog" aria-expanded="true" aria-controls="driver-popover-content">Site navigation</nav>+ <h1>A page under a product tour</h1>+ <p>The copy near the top of the page is readable.</p>+ <p class="faint" id="covered-copy">Faint copy the tour popover covers at load.</p>+ <a href="#" class="cta" id="covered-cta">Open the store</a>+ <div class="driver-popover" id="driver-popover-content" role="dialog" aria-labelledby="driver-popover-title"+ style="display: block; top: 220px; left: 800px; width: 440px; max-width: 440px; height: 200px;">+ <header id="driver-popover-title" class="driver-popover-title">Sign in to search and get notifications</header>+ <div id="driver-popover-description" class="driver-popover-description">Step one of five: the top bar holds your menu and your messages.</div>+ <footer class="driver-popover-footer"><button type="button" class="driver-popover-next-btn">Next</button></footer>+ </div>+ <svg class="driver-overlay driver-overlay-animated" viewBox="0 0 1280 800" preserveAspectRatio="xMinYMin slice"+ style="fill-rule: evenodd; clip-rule: evenodd; z-index: 10000; position: fixed; top: 0; left: 0; width: 100%; height: 100%;">+ <path d="M1280,0L0,0L0,800L1280,800L1280,0Z M0,0 L1280,0 L1280,44 L0,44 Z" style="fill: rgb(0, 0, 0); opacity: 0.7; pointer-events: auto; cursor: auto;"></path>+ </svg>+</body>+</html>diff --git a/tests/fixtures/overlays/gate.html b/tests/fixtures/overlays/gate.htmlnew file mode 100644index 000000000..478dd203f--- /dev/null+++ b/tests/fixtures/overlays/gate.html@@ -0,0 +1,28 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Overlay hiding: a routing gate named like a loader</title>+ <style>+ /* A state picker shaped like bankofamerica.com's "Select Your State",+ on a fixed, full-screen, opaque layer whose class even names a loader.+ It holds a select and a button, so it is a gate the visitor answers,+ not a preloader: the URL engine leaves it, and its own faint text is+ scored. Pinned by crates/browser/tests/overlay_hiding.rs. */+ * { box-sizing: border-box; }+ body { font: 16px/1.5 system-ui, sans-serif; margin: 0; padding: 40px; color: #111; background: #fff; }+ .page-loading-overlay { position: fixed; inset: 0; z-index: 9999; background: #ffffff; padding: 120px; }+ #gate-hint { margin: 0 0 12px; font-size: 14px; color: #b0b0b0; }+ </style>+</head>+<body>+ <h1>A page behind a state picker</h1>+ <p id="page-copy">The page under the gate.</p>+ <div class="page-loading-overlay" role="dialog" aria-label="Select your state">+ <p id="gate-hint">Select your state to see the products offered where you live.</p>+ <select aria-label="State"><option>California</option><option>Texas</option></select>+ <button type="button">Go</button>+ </div>+</body>+</html>diff --git a/tests/fixtures/overlays/preloader-clears.html b/tests/fixtures/overlays/preloader-clears.htmlnew file mode 100644index 000000000..356aafe25--- /dev/null+++ b/tests/fixtures/overlays/preloader-clears.html@@ -0,0 +1,26 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Overlay hiding: a preloader that clears on its own</title>+ <style>+ /* A preloader the site removes about a second after load. The URL engine+ waits for it and has nothing to hide. Pinned by+ crates/browser/tests/overlay_hiding.rs. */+ * { box-sizing: border-box; }+ body { font: 16px/1.5 system-ui, sans-serif; margin: 0; padding: 40px; color: #111; background: #fff; }+ .loader-wrapper { position: fixed; inset: 0; z-index: 9999; background: #0b5c63; color: #fff;+ display: flex; align-items: center; justify-content: center; font-size: 14px; }+ .faint { margin: 0; font-size: 14px; line-height: 28px; color: #aaaaaa; }+ </style>+</head>+<body>+ <div class="loader-wrapper"><span>Loading...</span></div>+ <h1>A page with a preloader that clears</h1>+ <p class="faint" id="covered-copy">Faint copy the preloader covers for a second.</p>+ <script>+ window.addEventListener('load', () => setTimeout(() => document.querySelector('.loader-wrapper').remove(), 1000));+ </script>+</body>+</html>diff --git a/tests/fixtures/overlays/preloader-stuck.html b/tests/fixtures/overlays/preloader-stuck.htmlnew file mode 100644index 000000000..8c09611e4--- /dev/null+++ b/tests/fixtures/overlays/preloader-stuck.html@@ -0,0 +1,25 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Overlay hiding: a preloader that never clears</title>+ <style>+ /* An epcco.com.sa-shaped preloader: `div#preloader`, fixed, 100% by+ 100%, white, a spinner and no text, which the site never removes. The+ URL engine waits for it, then hides it, so the page under it is+ scored. Pinned by crates/browser/tests/overlay_hiding.rs. */+ * { box-sizing: border-box; }+ body { font: 16px/1.5 system-ui, sans-serif; margin: 0; padding: 40px; color: #111; background: #fff; }+ #preloader { width: 100%; height: 100%; position: fixed; top: 0; left: 0; z-index: 9999999; background: #fff; }+ .sk-circle { width: 80px; height: 80px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);+ border: 6px solid #0b5c63; border-right-color: transparent; border-radius: 50%; }+ .faint { margin: 0; font-size: 14px; line-height: 28px; color: #aaaaaa; }+ </style>+</head>+<body>+ <div id="preloader"><div class="sk-circle"></div></div>+ <h1>A page under a stuck preloader</h1>+ <p class="faint" id="covered-copy">Faint copy the preloader covers.</p>+</body>+</html>diff --git a/tests/oracle/golden/detect-help.json b/tests/oracle/golden/detect-help.jsonindex 65fe63e23..8d1c1abdd 100644--- a/tests/oracle/golden/detect-help.json+++ b/tests/oracle/golden/detect-help.json@@ -1,5 +1,5 @@{- "stdout": "Usage: impeccable detect [options] [file-or-dir-or-url...]\n\nScan files or URLs for UI anti-patterns and design quality issues.\n\nOptions:\n --json Output results as JSON\n --quiet In text mode, only print the final findings count\n --scope <name> Only report rules in the given design domain\n (type, layout). Comma-separated.\n --viewport <WxH> Browser viewport for URL scans (default 1280x800),\n e.g. --viewport 390x844 for a mobile-width pass\n --no-config Do not apply project config, detector ignores, inline\n ignore comments, or DESIGN.md\n --no-inline-ignores Do not honor in-file impeccable-disable* ignore comments\n --no-design-system Do not load local DESIGN.md / .impeccable/design.json context\n --no-advisory Suppress advisory findings entirely (e.g. em-dash overuse)\n --no-consent-hiding URL scans: keep known consent managers' banners\n (OneTrust, Cookiebot, ...) on the page instead of hiding\n them before the scan\n --help Show this help message\n\nAdvisory findings:\n Some rules are advisory: detected and listed in a separate section, but never\n counted as failures and never changing the exit code. They stay out of the\n failure count so they never block automation. --no-advisory hides them.\n\nOutput streams:\n Human-readable findings go to stderr so stdout stays available for structured\n output. Use --json for JSON on stdout, or redirect text with 2> findings.txt.\n\nExit status:\n 0 Scan completed with no primary findings (advisories may still be listed)\n 1 At least one requested target could not be scanned\n 2 Scan completed with primary findings\n Operational failure takes precedence when a multi-target scan is partial.\n\nProject config:\n Respects .impeccable/config.json and .impeccable/config.local.json detector\n settings: detector.ignoreRules, detector.ignoreFiles, detector.ignoreValues,\n and detector.designSystem.enabled.\n\nInline ignores:\n In-file comments waive a finding where it lives and travel with the file:\n <!-- impeccable-disable overused-font -- exported brand doc -->\n .brand { font-family: Inter } /* impeccable-disable-line overused-font */\n // impeccable-disable-next-line bounce-easing: intentional bounce\n impeccable-disable applies to the whole file; -line / -next-line are scoped.\n List one or more rule ids (comma-separated), or omit them / use * for all.\n\nDetection modes:\n HTML files Static HTML/CSS analysis (default, catches linked CSS)\n Non-HTML files Regex pattern matching (CSS, JSX, TSX, etc.)\n URLs Puppeteer full browser rendering (auto-detected;\n http(s):// and file:// URLs; accessible linked CSS included)\n\nExamples:\n impeccable detect src/\n impeccable detect index.html\n impeccable detect https://example.com\n impeccable detect --json .\n impeccable detect --no-config src/\n",+ "stdout": "Usage: impeccable detect [options] [file-or-dir-or-url...]\n\nScan files or URLs for UI anti-patterns and design quality issues.\n\nOptions:\n --json Output results as JSON\n --quiet In text mode, only print the final findings count\n --scope <name> Only report rules in the given design domain\n (type, layout). Comma-separated.\n --viewport <WxH> Browser viewport for URL scans (default 1280x800),\n e.g. --viewport 390x844 for a mobile-width pass\n --no-config Do not apply project config, detector ignores, inline\n ignore comments, or DESIGN.md\n --no-inline-ignores Do not honor in-file impeccable-disable* ignore comments\n --no-design-system Do not load local DESIGN.md / .impeccable/design.json context\n --no-advisory Suppress advisory findings entirely (e.g. em-dash overuse)\n --no-consent-hiding URL scans: keep known consent managers' banners\n (OneTrust, Cookiebot, ...) on the page instead of hiding\n them before the scan\n --no-overlay-hiding URL scans: keep product tours (driver.js) and\n preloaders still covering the page instead of hiding\n them before the scan\n --help Show this help message\n\nAdvisory findings:\n Some rules are advisory: detected and listed in a separate section, but never\n counted as failures and never changing the exit code. They stay out of the\n failure count so they never block automation. --no-advisory hides them.\n\nOutput streams:\n Human-readable findings go to stderr so stdout stays available for structured\n output. Use --json for JSON on stdout, or redirect text with 2> findings.txt.\n\nExit status:\n 0 Scan completed with no primary findings (advisories may still be listed)\n 1 At least one requested target could not be scanned\n 2 Scan completed with primary findings\n Operational failure takes precedence when a multi-target scan is partial.\n\nProject config:\n Respects .impeccable/config.json and .impeccable/config.local.json detector\n settings: detector.ignoreRules, detector.ignoreFiles, detector.ignoreValues,\n and detector.designSystem.enabled.\n\nInline ignores:\n In-file comments waive a finding where it lives and travel with the file:\n <!-- impeccable-disable overused-font -- exported brand doc -->\n .brand { font-family: Inter } /* impeccable-disable-line overused-font */\n // impeccable-disable-next-line bounce-easing: intentional bounce\n impeccable-disable applies to the whole file; -line / -next-line are scoped.\n List one or more rule ids (comma-separated), or omit them / use * for all.\n\nDetection modes:\n HTML files Static HTML/CSS analysis (default, catches linked CSS)\n Non-HTML files Regex pattern matching (CSS, JSX, TSX, etc.)\n URLs Puppeteer full browser rendering (auto-detected;\n http(s):// and file:// URLs; accessible linked CSS included)\n\nExamples:\n impeccable detect src/\n impeccable detect index.html\n impeccable detect https://example.com\n impeccable detect --json .\n impeccable detect --no-config src/\n","stderr": "","exit": 0,"signal": null,