Files
pbakaus_impeccable/browser-bundle
Paul BakausandClaude Fable 5.1 b50098a477 Address review findings on the component ignore
Four gaps the review bots found in the first commit:

- **The hook dropped the waivers when the design system was off.** Both
  `design_system_options` paths returned `HookScanOptions::default()` when
  `designSystem.enabled` is false, which left `ignore_selectors` empty, so an
  opted-out component kept re-firing on every edit in exactly the projects
  that have no DESIGN.md. Component ignores are not design-system state; they
  travel either way now.
- **The in-page and extension scans never saw the key.** `BrowserConfig`
  reads `ignoreSelectors`, but the two JS adapters that build that config
  (`browser-bundle/50-scan.js` `collectConfigJson`, `60-offscreen.js`
  `configJson`) listed their keys explicitly and dropped it, so the documented
  `window.__IMPECCABLE_CONFIG__.ignoreSelectors` path did nothing. Both
  forward it now, and the bundle is regenerated.
- **Visual-contrast findings skipped the stamp.** The URL engine's visual pass
  produces its findings outside `collect_browser_findings`, so a
  `low-contrast` hit on an opted-out component was reported rather than
  waived. Each candidate carries its own selector, so the pass now resolves
  that element against the same post-reveal snapshot and stamps what the
  config waives. Page-level results (`content-hidden-at-rest`, `script-error`)
  stay unstamped: they name no element.
- **One bad entry could discard the whole page config.** `ignoreSelectors`
  used strict deserialization, so a hand-edited `{}` or `null` in the array
  failed the parse of `BrowserConfig`, which the wasm entry points answer with
  `unwrap_or_default()` — losing the design system and every other setting.
  It now filters bad entries the way `disabledValues` does.

Also: a `files` glob no longer applies to a URL scan. Globs name repo paths,
and `index.html` reaching `https://example.com/index.html` would scope an
ignore to a page the entry never named. URL scans take the unscoped entries
only, which is what the docs already promised.

Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LQBUunp8QttxZqihybNmtL
2026-09-11 12:42:24 -07:00
..

browser-bundle: the page-side JavaScript of the detector

Plain JavaScript that runs inside a page or the extension: the DOM probe the wasm rule core calls back into, the page snapshot producer, the visual-contrast sampling IO, the overlay UI, the scan API and the extension's offscreen document. Measurement and presentation only; every rule decision is a call into the wasm rule core built from crates/core (docs/ENGINE.md).

Two consumers:

  • crates/browser embeds 15-snapshot.js (the snapshot producer the URL engine injects; no WebAssembly runs in the page).
  • crates/bundle (the impeccable-bundle library) embeds every file here with include_str! and concatenates them, in filename order, with the wasm core into the in-page bundle plus the extension's extension/detector/ pieces. cargo xtask bundle is its caller inside this workspace: it writes dist/detect-antipatterns-browser.js, copies that bundle to the tracked crates/live/assets/detect-antipatterns-browser.js the engine embeds, and writes the extension pieces. A downstream crate with its own rule pack calls the library directly (docs/ENGINE.md).

Because the files are embedded, a new one here has to be added to PAGE_JS in crates/bundle/src/lib.rs (and to the order it is concatenated in); a test fails when the two lists disagree.

15-snapshot.js lists the computed-style properties the rules read; the bundle build checks that list against the core's and fails when they drift.