Skip to content

Design system: dual-theme audit-grade frontend + /dashboard/kpis#16

Merged
div0rce merged 5 commits into
mainfrom
claude/serene-maxwell-54yMC
May 30, 2026
Merged

Design system: dual-theme audit-grade frontend + /dashboard/kpis#16
div0rce merged 5 commits into
mainfrom
claude/serene-maxwell-54yMC

Conversation

@div0rce

@div0rce div0rce commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

Applies the Sentinel design system (dual-theme, audit-grade) to the existing frontend/, and adds a real backend endpoint to power the dashboard KPI row. The product's real IA, react-router routes, typed API client, and Recharts are unchanged — only the visual layer changes (plus the new KPI feed). All sample data is synthetic.

Implemented from a design handoff after a plan-first review; the KPI row was explicitly scoped to a real endpoint rather than hardcoded numbers.

Backend — GET /dashboard/kpis

A new endpoint returning four operational KPIs, all derived from real rows:

  • Docs ingested — total, + count in the last 24h.
  • Auto-approved rate — share of workflow items auto-approved, with a delta in percentage points (last-24h vs preceding-24h cohort).
  • Avg confidence — mean of every per-field confidence value, with a 24h-vs-prior delta.
  • SLA at risk — items past the threshold over the needs-review total (reuses /sla).

24h deltas are emitted only when a comparison window has data (otherwise null/flat) — no fabricated numbers or deltas, per the project's no-fabrication rule. generated_at is a real UTC timestamp so the dashboard footnote shows an honest refresh time. The endpoint server-formats display/delta_display strings (UI renders verbatim) and also exposes raw value/delta for stable assertions.

Frontend — design system

  • Token layer lifted into styles.css: :root (dark, default) + [data-theme="light"]. Every surface/text role is a CSS variable, so switching theme only remaps tokens.
  • Theme toggle persisted to localStorage["sentinel-theme"], with an inline pre-paint script in index.html to avoid a flash. Default dark.
  • IBM Plex Sans/Mono self-hosted via @fontsource (latin subset → offline-safe, CI-friendly); lucide-react for the small fixed icon set.
  • Header / Query / Review / Dashboard restyled to the kit specs (themed wordmark, icon nav as router links, citation rails, cited/refused result cards, code-chip review rows with an audit-id flash, KPI grid + footnote).
  • Recharts kept and restyled with token var() fills + per-bar <Cell> colors (confidence by bucket, SLA by age band), so charts re-theme live with the toggle.

Data-honesty notes

  • The Review row renders only fields the /review payload returns. The prototype's schema.field/value/confidence are extraction-level details absent from the queue API, so they're not invented.
  • The refusal card surfaces the API's real reason instead of a hardcoded threshold string.

Test impact

  • Backend: +4 KPI tests (empty corpus, value/formatting, auto-approved delta, threshold validation) and an extended frontend-contract shape test.
  • Frontend: Query heading matchers relaxed to substrings (headings now lead with a status badge); App test gains a /dashboard/kpis fetch-stub branch; Review test asserts the audit-event id surfaces in the flash.

Verification

make check is green locally:

  • Backend: 201 pytest passed; ruff + mypy clean.
  • Frontend: 7 Vitest passed; tsc -b --noEmit clean; vite build succeeds. Dashboard stays lazy-loaded (Recharts in its own vendor chunk).

Notes / out of scope

  • No changes to retrieval, extraction, workflow, audit, or deploy surfaces.
  • Backend logic unchanged except the additive KPI endpoint.

All sample and benchmark data is synthetic.

https://claude.ai/code/session_01Q6uP1XdiuNcMiHmtXCJfed


Generated by Claude Code

claude added 5 commits May 30, 2026 11:25
Four operational KPIs (docs ingested, auto-approved rate, avg confidence, SLA-at-risk) derived entirely from real rows. 24h-vs-prior deltas are emitted only when a comparison window has data, otherwise null/flat — no fabricated numbers. Server-formats display/delta strings so the UI renders verbatim, and exposes raw value/delta for tests. Adds 4 tests + extends the frontend-contract shape test.

https://claude.ai/code/session_01Q6uP1XdiuNcMiHmtXCJfed
Replace the flat light-only theme with the audit-grade token layer (:root dark default + [data-theme="light"]). Self-host IBM Plex Sans/Mono via @fontsource (latin subset, offline-safe), add lucide-react, and a useTheme hook persisting localStorage["sentinel-theme"]. An inline pre-paint script in index.html sets data-theme before first paint to avoid a flash. Brand wordmarks/mark added under public/brand.

https://claude.ai/code/session_01Q6uP1XdiuNcMiHmtXCJfed
Header shell (themed wordmark, icon nav as router links, theme toggle), Query (eyebrow/card/chips, cited|refused result cards with citation rails), Review (queue bar, code-chip rows, approve/reject, audit-id flash, empty state), and Dashboard (KPI grid + footnote). Recharts kept and restyled with token var() fills + per-bar <Cell> colors (confidence by bucket, SLA by age band) so charts re-theme live. api.ts gains the typed getKpis client.

https://claude.ai/code/session_01Q6uP1XdiuNcMiHmtXCJfed
Query: heading matchers relaxed to substrings (headings now lead with a status badge). App: add a /dashboard/kpis fetch-stub branch for the new endpoint. Review: assert the real audit-event id surfaces in the decision flash.

https://claude.ai/code/session_01Q6uP1XdiuNcMiHmtXCJfed
@div0rce div0rce marked this pull request as ready for review May 30, 2026 11:29
@div0rce

div0rce commented May 30, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@div0rce div0rce merged commit f4ba21d into main May 30, 2026
3 checks passed
@div0rce div0rce deleted the claude/serene-maxwell-54yMC branch May 30, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants