Skip to content

feat(ai): admin Shadow + Models tabs (Phase 12, AI-076 slice 2)#367

Merged
mrviduus merged 1 commit into
mainfrom
phase12-shadow-admin-ui
Jun 18, 2026
Merged

feat(ai): admin Shadow + Models tabs (Phase 12, AI-076 slice 2)#367
mrviduus merged 1 commit into
mainfrom
phase12-shadow-admin-ui

Conversation

@mrviduus

Copy link
Copy Markdown
Owner

Phase 12 (RLOps) — slice 2: make shadow data visible

Two read-only tabs on the admin AI-quality page (/ai-quality), surfacing the shadow_runs + models data shipped in slice 1 (#366).

Shadow tab

  • shadow_runs rolled up per (feature, primary-model, shadow-model) via a single PostgreSQL GROUP BY (no N+1): percentile_cont p50 latency, SQL-side lexical agreement (exact-match rate + avg length-ratio + both-present rate, over rows where both responses exist).
  • Shadow-minus-primary latency/cost/token deltas + a window-normalized projected monthly cost delta, computed in a pure, unit-tested ToPairDto helper.
  • Row → modal with paged side-by-side primary-vs-shadow response samples (redacted at write-time; limit clamped 1..50).
  • Caption: agreement is lexical, not a quality verdict — semantic judge scoring is a later slice.
  • Empty state explains shadow is OFF by default + how to enable (Ai:Shadow:Routes:{feature} + a sample rate).

Models tab

Flat view of the seeded models registry (feature, provider, model, status) — status color-coded Primary/Shadow/Retired.

Backend

3 endpoints under /admin/ai-quality (GET /shadow/summary, /shadow/samples, /models), DTOs appended to the Ai-quality contract, admin-auth inherited. Strictly read-only — promote/rollback + table-driven routing is the next slice.

Verification

700 unit tests green (9 new on the delta/projection math); admin tsc --noEmit + vite build clean; integration tests (summary empty/auth-401/400/models-seeded) run in CI. Browser-check deferred to owner (admin JWT + needs shadow enabled for non-empty data).

Architect → backend + frontend (parallel, locked contract). Files: AdminAiQualityEndpoints.cs, AiQualityDtos.cs, AiQualityPage.tsx, api/client.ts.

🤖 Generated with Claude Code

Read-only visualization of the slice-1 shadow data on /ai-quality.

- Shadow tab: shadow_runs rolled up per (feature, primary, shadow) via one
  GROUP BY (no N+1) — p50 latency (percentile_cont), SQL-side lexical
  agreement (exact-match rate, avg length-ratio, both-present rate),
  shadow-minus-primary latency/cost/token deltas + projected monthly cost
  delta (pure unit-tested ToPairDto helper). Row -> modal with paged
  side-by-side primary-vs-shadow response samples (limit 1..50). Caption:
  agreement is lexical, NOT a quality verdict (judge scoring = later slice).
  Empty state explains shadow is OFF by default + how to enable.
- Models tab: flat view of seeded models registry, status color-coded.
- 3 read-only endpoints under /admin/ai-quality (shadow/summary,
  shadow/samples, models), admin-auth inherited. NO mutation — promote/
  rollback + table-driven routing is the next slice.

700 unit tests green (9 new); admin tsc + build clean; integration tests
(empty/auth/400/seeded) run in CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mrviduus mrviduus merged commit 413f2b7 into main Jun 18, 2026
5 checks passed
@mrviduus mrviduus deleted the phase12-shadow-admin-ui branch June 18, 2026 14:31
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.

1 participant