---
path: /domains/veritas/bias
surface: customer
domain: veritas
auth: signed-in
source: apps/oshun/web/src/app/domains/veritas/bias/page.tsx
status: walked
last_walked: >
  2026-05-29 automated runtime walk (Playwright headless) — render, /v1 data
  (2xx), console/page-errors, expected content, screenshot verified; live
  screen-reader, touch, offline, and telemetry-delivery checks pending a manual
  AT pass. Evidence: WALKTHROUGH/results/runtime-sweep-2026-05-29.md. 2026-06-28
  Codex Bias Detector addendum — signed-in cognitive-bias filtering, keyboard
  accordion expansion, close/back, media spectrum, framing analysis, dashboard
  metrics, debiasing guidance, blind-spot quiz completion/results/reset,
  personal profile, reduced-motion chart/bar checks, standalone PWA launch,
  offline mobile use, no-horizontal-overflow checks, `/domains/veritas`
  tool-grid entry, and `/veritas` broadsheet-subnav entry are covered by the E2E
  evidence below.
---

# Bias Detector · Veritas

## Purpose

The Veritas Bias Detector — a full-screen overlay tool that explains cognitive
biases, charts a media political spectrum, compares story framing across
sources, summarizes fixture bias metrics, suggests debiasing exercises, runs a
"blind spot" diagnostic, and surfaces a personal bias profile dashboard.

## Entry points

- **`/domains/veritas`** index — secondary "More verification tools" panel →
  "Bias" button opens this detector in-place and Close returns to the domain
  home view.
- **Linked from `/veritas`** — broadsheet subnav "Bias analysis" navigates to
  `/domains/veritas/bias`; Close uses browser history to return to `/veritas`.
- **Direct URL / bookmark** — yes (auth required)

## Layout regions

`page.tsx` is a `'use client'` component that renders an `sr-only` `<h1>` ("Bias
Detector · Veritas · OSHUN") then mounts
`<VeritasBiasDetector onClose={() => router.back()} />`. The detector is a fixed
full-screen overlay.

- **Header**: title "Veritas Bias Detector", 44px-minimum Close button
  (`aria-label="Close Bias Detector"`), and responsive wrap behavior.
- **Nav tablist**: seven tabs with `role="tab"`, `aria-selected`, and stable
  `data-veritas-bias-tab` hooks.
- **Body**: focusable scrollable region labelled "Bias detector workspace";
  current view is driven by `view: BiasView`.
  - **Cognitive Biases** (`cognitive`) — default fixture list, category filter,
    and keyboardable per-bias accordion via `expandedBias`
  - **Media Spectrum** (`spectrum`) — spectrum marker buttons and keyboardable
    source detail rows via `expandedSource`
  - **Framing Analysis** (`framing`) — story cards with perspective accordions
    via `expandedFraming`
  - **Bias Score** (`dashboard`) — fixture source/count/factual-reporting
    metrics
  - **Debiasing** (`debiasing`) — profile-derived suggestions, vulnerable
    biases, and toolkit exercises
  - **Blind Spot Test** (`blindspot`) — local quiz state in `blindSpotAnswers`,
    `blindSpotIndex`, and `showBlindSpotResult`
  - **My Profile** (`profile`) — fixture reading lean, scores, top sources, and
    vulnerability bars

## States

- [x] **Loading** — overlay renders synchronously; no async fetch, skeleton, or
      spinner.
- [x] **Cognitive Biases view (default)** — list count and category filtering
      are verified against `COGNITIVE_BIASES`.
- [x] **Cognitive no-hidden state branch** — all fixture categories currently
      contain results; no empty state is implemented for category filters.
- [x] **Media Spectrum view** — all `MEDIA_SOURCES` render as source rows and
      spectrum marker buttons; source details expand.
- [x] **Framing view** — all `FRAMING_ANALYSES` render with divergence scores
      and perspective details.
- [x] **Bias Score view** — average/source/cognitive/framing counts, source
      distribution, and factual-reporting buckets render from fixture data.
- [x] **Debiasing view** — suggestions, vulnerable biases, and toolkit exercises
      render from `SAMPLE_PERSONAL_BIAS_PROFILE`.
- [x] **Blind Spot view** — all questions can be answered, results score is
      computed, result rows render, and retake resets to the first question.
- [x] **Profile view** — reading lean, diversity score, blind-spot score, top
      sources, and vulnerability bars render from the profile fixture.
- [x] **Offline** — client-only filter/detail interactions remain usable after
      `context.setOffline(true)`.
- [x] **Standalone PWA** — `/?surface=pwa` restores to `/domains/veritas/bias`
      and matches standalone display-mode.
- [x] **Reduced motion** — E2E emulates reduced motion and verifies score-ring
      arcs and chart/bar transitions are effectively zero.

## Interactions

### Header

- [x] **Close Bias Detector** (button, `aria-label="Close Bias Detector"`, X
      icon)
  - Function: keyboard Enter calls `onClose()` → `router.back()`
- [x] **`/veritas` broadsheet subnav entry** — "Bias analysis" link navigates to
      the standalone detector route and the detector Close action returns to the
      lead.
- [x] **`/domains/veritas` secondary-tools entry** — "Show tools" reveals the
      "Bias" button, which opens the detector in the domain shell and closes
      back to the domain home view.
- [x] **Nav tablist** (per `navItems`):
  - `cognitive` — `Brain` icon, label "Cognitive Biases"
  - `spectrum` — `ArrowLeftRight` icon, label "Media Spectrum"
  - `framing` — `Newspaper` icon, label "Framing Analysis"
  - `dashboard` — `BarChart3` icon, label "Bias Score"
  - `debiasing` — `Lightbulb` icon, label "Debiasing"
  - `blindspot` — `Target` icon, label "Blind Spot Test"
  - `profile` — `User` icon, label "My Profile"

### Cognitive view

- [x] **Category filter** (`biasCategory`) —
      `all | decision_making | social | memory | probability | belief`.
- [x] **Bias card** — click/Enter/Space toggles `expandedBias === bias.id`.
  - Expanded content includes definition context, example, information impact,
    and debiasing strategy.

### Spectrum view

- [x] **Spectrum marker button** — click opens/closes the associated media
      source detail via `expandedSource`.
- [x] **Source row** — click/Enter/Space toggles the detail panel.
  - Expanded detail includes source description, political spectrum bar, bias
    breakdown bars, factual-reporting badge, sample article, and linguistic
    triggers.

### Framing view

- [x] **Framing card** — click/Enter/Space toggles `expandedFraming === id`.
  - Expanded content includes source, lean, tone, bias score, headline, framing
    angle, and key phrases for each perspective.

### Bias Score view

- [x] **Metric cards** — average bias score, source count, cognitive-bias count,
      and framing-story count render fixture-derived values.
- [x] **Source distribution bars** — one bar per media source; transition is
      disabled under reduced motion.
- [x] **Factual reporting breakdown** — buckets are aggregated from
      `MEDIA_SOURCES`.

### Debiasing view

- [x] **Personalized suggestions** — fixture suggestions render in order.
- [x] **Vulnerable-bias bars** — fixture vulnerability scores render and respect
      reduced motion.
- [x] **Quick debiasing toolkit** — four static exercises render.

### Blind Spot Test view

- [x] **Answer button** — writes `blindSpotAnswers[questionId] = answerId` and
      exposes selected state.
- [x] **Previous / Next / See Results** — navigation remains disabled until the
      current question has an answer; final action shows results once every
      question is answered.
- [x] **Results** — score is computed from answers where
      `option.biasRevealed === null`; result rows include correctness and
      explanations.
- [x] **Retake Test** — clears local answers, resets `blindSpotIndex` to `0`,
      and hides results.

### Profile view

- [x] **Profile metrics** — reading lean, diversity score, and blind-spot score
      render from `SAMPLE_PERSONAL_BIAS_PROFILE`.
- [x] **Top sources** — source names, lean labels, and article counts render.
- [x] **Bias Vulnerability Profile** — one `BreakdownBar` per vulnerable bias.

## Current E2E evidence

- `apps/oshun/web/e2e/veritas-bias-detector.spec.ts` —
  `opens from the Veritas domain tool grid and returns to the domain home`
  covers signed-in `/domains/veritas` navigation, secondary-tools disclosure,
  the "Bias" tool button, detector default cognitive state, and Close returning
  to the Veritas domain home without route replacement.
- `apps/oshun/web/e2e/veritas-bias-detector.spec.ts` —
  `opens from the /veritas broadsheet subnav and browser-back closes to the lead`
  covers the `/veritas` "Bias analysis" subnav entry, navigation to
  `/domains/veritas/bias`, detector default cognitive state, and Close/browser
  history returning to the broadsheet lead.
- `apps/oshun/web/e2e/veritas-bias-detector.spec.ts` —
  `filters cognitive biases, opens a card by keyboard, and closes by keyboard`
  covers signed-in navigation from `/library`, default cognitive count, close
  target size/name, category filtering, keyboard accordion expansion,
  example/strategy detail content, and keyboard close/back behavior.
- `apps/oshun/web/e2e/veritas-bias-detector.spec.ts` —
  `audits spectrum, framing, dashboard metrics, and reduced-motion animations`
  covers media-source rows and marker buttons, keyboard source expansion, source
  trigger details, reduced-motion score/breakdown transitions, framing counts
  and keyboard expansion, dashboard metrics, source distribution, and
  factual-reporting aggregation.
- `apps/oshun/web/e2e/veritas-bias-detector.spec.ts` —
  `reviews debiasing guidance, completes the blind spot test, and opens profile`
  covers debiasing suggestions/vulnerabilities/toolkit exercises, full
  blind-spot quiz completion with correct fixture answers, score/result rows,
  retake reset, profile metrics, top-source count, and vulnerability bars.
- `apps/oshun/web/e2e/veritas-bias-detector.spec.ts` —
  `keeps the client-only detector usable offline and restores standalone without mobile overflow`
  covers standalone PWA launch restoration, offline cognitive filtering, offline
  accordion expansion, offline spectrum navigation/source expansion, mobile
  no-horizontal-overflow checks, and standalone display-mode.

## Data & contracts

- **Reads**: `COGNITIVE_BIASES`, `MEDIA_SOURCES`, `FRAMING_ANALYSES`,
  `BIAS_BLIND_SPOT_QUESTIONS`, `SAMPLE_PERSONAL_BIAS_PROFILE`, and
  `MEDIA_BIAS_LEAN_CONFIG` from `@/lib/veritas/veritas-simulation-data`.
- **Writes**: none externally; all quiz answers, filters, and expanded panels
  are local component state only.
- **Realtime**: none.
- **Caching**: not applicable.
- **Auth/role check**: shell middleware (verify).
- **Telemetry**: no `track*` imports in this file.
- **Page metadata**: not set (client component); sr-only `<h1>` reads "Bias
  Detector · Veritas · OSHUN".

## Cross-references

- Component:
  `apps/oshun/web/src/components/domains/veritas/VeritasBiasDetector.tsx`
- Type: `BiasView` — seven-option enum
- Route E2E: `apps/oshun/web/e2e/veritas-bias-detector.spec.ts`
- Sibling tools:
  - [`domains-veritas-articles.md`](./domains-veritas-articles.md),
    [`domains-veritas-fact-check.md`](./domains-veritas-fact-check.md),
    [`domains-veritas-headlines.md`](./domains-veritas-headlines.md),
    [`domains-veritas-claims.md`](./domains-veritas-claims.md)
- Customer-facing Veritas hub: [`veritas.md`](./veritas.md)
- Feature spec: [`V1/features.md`](../../../V1/features.md#veritas)

## Open questions / known gaps

- [ ] No telemetry on tab switches, source expansion, quiz answer selection, or
      test completion.
- [ ] Blind-spot answers, profile scores, source spectrum, and debiasing
      guidance are fixture/local-only; verify whether V1 intends persistence or
      a backend analysis endpoint.
- [ ] Live screen-reader and touch-device AT passes remain pending beyond the
      automated keyboard/Playwright coverage here.
