V1 Web PWA · Surface walkthrough

NLP Tools · Veritas

A per-surface walkthrough of the V1 Web PWA customer surface: layout, states, interactions, data, and cross-references.

walked
9sections5 minread

On this page

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/veritas index — 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 for input | results | samples.
  • Nav tablist: role="tab" buttons expose aria-selected; the results tab 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) — populated NLPAnalysis overview and collapsible analysis sections
    • Samples (samples) — dedicated fixture sample library, each keyboard selectable

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 setTimeout sets analyzing=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=pwa restores to /domains/veritas/nlp and 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#

  • Close NLP Tools (button, aria-label="Close NLP Tools", X icon)
    • Function: keyboard Enter calls onClose()router.back()
  • Nav tablist:
    • input — returns to the input workspace
    • results — disabled until result exists; then shows current result
    • samples — opens the dedicated sample library

Input view#

  • Input mode toggle — switches inputMode between text and url.
  • 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 to results.
  • Input sample card — click/Enter/Space loads the fixture sample into result and switches to results.

Samples view#

  • Sample card — click/Enter/Space calls handleLoadSample(sample).
  • Enter custom text — returns to the input workspace.

Results view#

  • New Analysis — returns to input without 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.tsrenders input defaults, runs a custom text analysis, toggles sections, and closes by keyboard covers 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.tsloads a fixture from Samples by keyboard and verifies manipulative-language results with reduced motion covers 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.tsruns URL-mode analysis while offline in standalone mobile without horizontal overflow covers standalone PWA restoration, offline URL-mode analysis via Enter, inputUrl result state, text preview for fetched-content placeholder, offline Samples navigation, mobile no-horizontal-overflow checks, and standalone display-mode.

Data & contracts#

  • Reads: SAMPLE_NLP_ANALYSES from @/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#

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 /veritas are 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.