Context. surface customer · domain veritas · route /domains/veritas/nlp · auth signed-in · source apps/oshun/web/src/app/domains/veritas/nlp/page.tsx
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 NLP Tools addendum — signed-in input defaults, text-mode analysis, URL-mode analysis, disabled results tab, Samples tab, keyboard sample loading, result-section expansion/collapse, propaganda/fallacy/readability/ entity/keyword panels, reduced-motion handling, sentiment contrast, close/back, standalone PWA launch, offline mobile use, no-horizontal-overflow checks, and serious axe scan are covered by the E2E evidence below.
Purpose#
The Veritas NLP Tools — a full-screen overlay that takes raw text or a URL, runs
a local simulated NLPAnalysis, exposes fixture sample analyses, and renders
collapsible sections for sentiment, entities, readability, language complexity,
propaganda techniques, logical fallacies, and keywords.
Entry points#
/domains/veritasindex — verify the internal-namespace tool grid links here- Linked from
/domains/veritas/articles— article analysis is a sibling workflow; no direct handoff from this route is verified here - Direct URL / bookmark — yes (auth required)
Layout regions#
page.tsx is a 'use client' component that renders an sr-only <h1> ("NLP
Tools · Veritas · OSHUN") then mounts
<VeritasNLPTools onClose={() => router.back()} />. Overlay is fixed
full-screen.
- Header: title "NLP Tools", 44px-minimum Close button
(
aria-label="Close NLP Tools"), responsive wrap behavior, and tablist forinput | results | samples. - Nav tablist:
role="tab"buttons exposearia-selected; theresultstab is disabled until a result exists. - Body: focusable scrollable region labelled "NLP tools workspace"; current
view is driven by
view: NLPView.- Input (
input) — text/URL mode toggle, textarea or URL field, live word count for text mode, Analyze action, and fixture sample cards - Results (
results) — populatedNLPAnalysisoverview and collapsible analysis sections - Samples (
samples) — dedicated fixture sample library, each keyboard selectable
- Input (
State drivers: view, inputMode, textInput, urlInput, analyzing,
result, and expandedSections.
States#
- Loading — overlay renders synchronously; no async skeleton.
- Input view, text mode — default mode renders textarea, live word count, disabled Analyze action, and sample cards.
- Input view, URL mode — URL field renders, Enter starts analysis, and
result carries
inputUrl. - Analyzing — local simulated
setTimeoutsetsanalyzing=true, changes the button label to "Analyzing...", then switches to results. - Results view, populated — custom text/URL results and sample fixture
results render from
result. - Results tab disabled when no
result— verified via disabled tab state. - Samples view — dedicated sample library is reachable by tab and cards load fixture results by click/Enter/Space.
- No propaganda / no fallacy branches — factual fixture renders empty "No ... detected" states.
- Propaganda / fallacy populated branches — manipulative fixture renders
every technique and fallacy row from
SAMPLE_NLP_ANALYSES. - Offline — URL-mode analysis and Samples navigation remain usable after
context.setOffline(true)because no analysis endpoint is fetched. - Standalone PWA —
/?surface=pwarestores to/domains/veritas/nlpand matches standalone display-mode. - Reduced motion — E2E emulates reduced motion and verifies overview, metric-fill, and sentiment segment transitions/animations are effectively zero.
- Serious accessibility scan — route passes the automatic serious axe
gate; sentiment segment text now uses contrast-safe
readableInk.
Interactions#
Header#
- Close NLP Tools (button,
aria-label="Close NLP Tools", X icon)- Function: keyboard Enter calls
onClose()→router.back()
- Function: keyboard Enter calls
- Nav tablist:
input— returns to the input workspaceresults— disabled untilresultexists; then shows current resultsamples— opens the dedicated sample library
Input view#
- Input mode toggle — switches
inputModebetweentextandurl. - Text input — textarea accepts pasted text and displays a live token count.
- URL input — text input accepts a URL; pressing Enter runs analysis.
- Analyze — disabled until the active input has content; click/Enter
starts local analysis, sets
result, and switches toresults. - Input sample card — click/Enter/Space loads the fixture sample into
resultand switches toresults.
Samples view#
- Sample card — click/Enter/Space calls
handleLoadSample(sample). - Enter custom text — returns to the input workspace.
Results view#
- New Analysis — returns to
inputwithout clearing the last result. - Overview — sentiment, word/sentence count, detected language, readability grade, text preview, and overall assessment render.
- Section header — click toggles the section id in
expandedSections. - Sentiment Spectrum — negative/neutral/positive segments and compound marker render; segment contrast and reduced motion are verified.
- Entity Recognition — grouped entities render with category and confidence band labels.
- Readability Metrics — Flesch, Fog, Coleman-Liau, SMOG, ARI, grade level, average sentence length, and syllables-per-word render.
- Language Complexity — vocabulary, lexical diversity, passive voice, sentence complexity, technical terms, jargon density, nominalizations, and hedging metrics render.
- Propaganda Technique Detection — empty and populated branches are verified against fixture data.
- Logical Fallacy Identification — empty and populated branches are verified against fixture data.
- Top Keywords — one chip per fixture keyword renders with frequency and TF-IDF hooks.
Current E2E evidence#
apps/oshun/web/e2e/veritas-nlp-tools.spec.ts—renders input defaults, runs a custom text analysis, toggles sections, and closes by keyboardcovers signed-in navigation from/library, default text input state, disabled results tab, sample count, live word count, Analyze disabled/enabled states, analyzing label, populated custom result, all default-open sections, factual empty propaganda/fallacy branches, entity/keyword counts, section collapse/reopen, New Analysis, and keyboard close/back.apps/oshun/web/e2e/veritas-nlp-tools.spec.ts—loads a fixture from Samples by keyboard and verifies manipulative-language results with reduced motioncovers the dedicated Samples tab, keyboard sample loading, manipulative fixture result id, propaganda/fallacy counts and row text, reduced-motion overview/metric/sentiment transitions, and the serious axe contrast scan.apps/oshun/web/e2e/veritas-nlp-tools.spec.ts—runs URL-mode analysis while offline in standalone mobile without horizontal overflowcovers standalone PWA restoration, offline URL-mode analysis via Enter,inputUrlresult state, text preview for fetched-content placeholder, offline Samples navigation, mobile no-horizontal-overflow checks, and standalone display-mode.
Data & contracts#
- Reads:
SAMPLE_NLP_ANALYSESfrom@/lib/veritas/veritas-extended-simulation. - Writes: none externally; all analysis, sample loading, and section expansion is local component state.
- 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 "NLP Tools · Veritas · OSHUN".
Cross-references#
- Component:
apps/oshun/web/src/components/domains/veritas/VeritasNLPTools.tsx - Type:
NLPView = 'input' | 'results' | 'samples' - Route E2E:
apps/oshun/web/e2e/veritas-nlp-tools.spec.ts - Sibling tools:
domains-veritas-articles.md— full article analyzerdomains-veritas-knowledge-graph.md,domains-veritas-research.md
- Customer-facing Veritas hub:
veritas.md - Feature spec:
V1/features.md
Open questions / known gaps#
- Analysis pipeline is local/simulated; verify whether V1 wires to a Sophia or Veritas backend NLP service.
- No telemetry on mode switch, analysis submission, sample loading, or section expansion.
- Entry links from
/domains/veritas,/domains/veritas/articles, and/veritasare not covered by this route-specific E2E; keep or add coverage in their route specs. - Live screen-reader and touch-device AT passes remain pending beyond the automated keyboard/Playwright coverage here.