# evidence distiller & eval harness

- Status: `experiment`
- Track: [crawler visibility, model cutoffs & quality evals](https://aifoc.us/labs/platform-observability/)
- Layer: 8. Crawler Visibility, Model Cutoffs & Quality Evals
- Updated: 2 December 2026
- Live demo: https://evidence-distiller-eval-harness.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/evidence-distiller-eval-harness

## Inspired by

- [how might a modern lighthouse work with large language models?](https://aifoc.us/how-might-a-modern-lighthouse-work-with-llms/)
- [please mind the model gap](https://aifoc.us/please-mind-the-model-gap/)

## Why this matters

Passing raw 50–120 KB DOM dumps into automated UI evaluations overflows context budgets, while brittle CSS-selector checks are easily gamed by cosmetic workarounds—swallowing [`QuotaExceededError`](https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#exceptions) inside an empty `catch {}`, clipping overflow with `overflow-x: hidden`, or adding a blank `aria-label=""`.

## What this opens up

Grading UI quality by actual resilience under fault rather than brittle CSS selectors. Compressing live geometry clipping, [WCAG 2.1 contrast](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html), [Accessibility Tree](https://developer.mozilla.org/en-US/docs/Glossary/Accessibility_tree) names, and [`pagehide`](https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event) draft survival into a strictly capped `<= 4,096 B` JSON packet lets an isolated edge rubric distinguish genuine fixes (`strong`) from silent cheats (`hollow`) and broken regressions (`unmet`).

## How the tests work

1. Click **Run Baseline (6 Unpatched Defects)** to trigger real offline 503, FOIT, blocked-script, `QuotaExceededError`, `pagehide`, and 360px overflow/contrast/a11y faults inside `/playground/app` and watch ~65 KB of raw telemetry compress below `4,096 B`.
2. Compare **Apply Hollow Cheats (Cosmetic)** against **Apply Real Fixes (Strong)** to see the isolated edge rubric (`POST /api/evaluate`) catch silent error swallows, clipped pixels, and empty ARIA labels.
3. Click **Apply Regressive Patches (Hides UI)** or switch the distiller to **Over-Compress (`<= 512 B`)** to trigger `unmet` regressions and signal-loss blind spots.
4. Click **Submit Raw Snapshot to `/api/evaluate`** to verify the server enforces the `4,096 B` cap with `413 PACKET_BUDGET_EXCEEDED`, and inspect the wire packet and declarative principles below.


## Hypothesis

- **Claim:** Distilling live browser telemetry (DOM serialization, computed styles, geometry clipping, WCAG 2.1 contrast ratios, accessible names, storage errors, and `pagehide` persistence) into a strictly bounded `<= 4,096 B` packet enables isolated declarative outcome scoring (`strong`, `survives`, `hollow`, `baseline`, `unmet`) without hardcoded CSS-selector audit rules.
- **Confirms it:** Live measurements on the mounted 360px 6-defect playground (`/playground/app`) compress raw snapshots by `> 95%` under `4,096 B` while separating genuine behavioral fixes (`strong`) from silent-swallow or clipping cheats (`hollow`) and unpatched defects (`baseline`), and `/api/evaluate` rejects raw uploads with `413 PACKET_BUDGET_EXCEEDED`.
- **Bounds or disproves it:** Over-compressing packets (`<= 512 B` mode) strips geometry clipping, computed opacity/visibility, and read-back verification fields (producing `unmet` blind spots), and regressive patches that hide UI controls at baseline immediately surface as `unmet` regressions.


## Under the hood

[Evidence Distiller & Eval Harness](https://evidence-distiller-eval-harness.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/evidence-distiller-eval-harness)) mounts a sandboxed 360px same-origin target app (`/playground/app`) seeded with six realistic web defects: offline feed blindness (`503 /api/feed`), FOIT invisible headline text, a blocked third-party analytics script crashing checkout, a `QuotaExceededError` storage crash, unsaved draft loss across `pagehide` / `visibilitychange`, and a 360px layout combining horizontal overflow, failing WCAG AA contrast, and an unlabeled icon button.

Each defect switches live between `baseline`, `real`, `hollow`, and `regressive` modes without sending patch labels to the scorer. In the browser, `public/lib/distiller.js` inspects real `getComputedStyle()`, `getBoundingClientRect()` clipping, WCAG 2.1 luminance ratios, accessible names, and fault-pass read-backs, compares exact UTF-8 byte sizes against an `XMLSerializer` raw snapshot, and packs the distilled telemetry under `4,096 B` (or `<= 512 B` in over-compressed falsification mode). The isolated Cloudflare Edge Worker (`POST /api/evaluate` backed by `public/lib/rubric-scorer.js`) rejects un-distilled payloads with `413 PACKET_BUDGET_EXCEEDED` and grades each principle into `strong`, `survives`, `hollow`, `baseline`, or `unmet`.


## Key terms & further reading

- [WCAG 2.1 contrast (AA 4.5:1)](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html) — The minimum luminance contrast ratio between foreground text and background required for readable UI copy and controls.
- [HTML Accessibility Tree & accessible name](https://developer.mozilla.org/en-US/docs/Glossary/Accessibility_tree) — The semantic structure exposed to assistive technology; icon-only controls require a non-empty accessible name rather than a blank `aria-label=""`.
- [FOIT (Flash of Invisible Text)](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Descriptors/@font-face/font-display) — Blocking text visibility while a custom web font downloads instead of displaying fallback text via `font-display: swap`.
- [QuotaExceededError](https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#exceptions) — The DOMException thrown when `localStorage` is full or unavailable; strong fixes fall back gracefully and verify persisted state.
- [pagehide & visibilitychange events](https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event) — Lifecycle hooks used to flush unsaved user drafts reliably before a tab closes, backgrounds, or enters back-forward cache.
- [Strong vs. hollow vs. regressive patches](https://aifoc.us/how-might-a-modern-lighthouse-work-with-llms/) — Rubric classifications separating real fault resilience (`strong`) from cosmetic error-hiding cheats (`hollow`) and patches that remove or hide controls (`regressive` / `unmet`).

## Open questions to iterate on

- Which telemetry fields give the highest signal-per-byte ratio when grading multi-step user journeys under a 4 KB cap?
- How well does a hidden behavior-under-fault rubric generalize across arbitrary third-party web apps without per-site selector maintenance?

## Iteration log

- **2026-12-02:** Deployed 360px 6-defect seeded playground (`/playground/app` with per-defect `baseline`, `real`, `hollow`, and `regressive` toggles), `<= 4,096 B` structured browser evidence distiller (`public/lib/distiller.js`) with `<= 512 B` over-compression falsifier, and edge rubric evaluator (`POST /api/evaluate`) grading `strong`/`survives`/`hollow`/`baseline`/`unmet`.

## Primitives tested

- `Structured Evidence Distiller (<= 4 KB)`
- `Computed Style & Geometry Clipping Probes`
- `WCAG 2.1 Contrast Evaluator`
- `Behavior-Under-Fault Rubric Scorer`
- `pagehide / QuotaExceededError Fault Injection`

## Connected labs in other tracks

- [self-observing web fault bundler](https://aifoc.us/labs/platform-observability/self-observing-web/) — Captures live LoAF, CLS, fetch, and CSP faults inside a bounded ring buffer.
- [crawler ssr vs. spa visibility](https://aifoc.us/labs/platform-observability/crawler-ssr-vs-spa-visibility/) — Audits raw non-JS HTML visibility prior to browser execution.

---
Canonical: https://aifoc.us/labs/platform-observability/evidence-distiller-eval-harness/
