---
phase: 41
slug: diagrams-icons-theme-engine
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-04-04
---

# Phase 41 — Validation Strategy

> Per-phase validation contract for feedback sampling during execution.

---

## Test Infrastructure

| Property | Value |
|----------|-------|
| **Framework** | vitest |
| **Config file** | vitest.config.ts |
| **Quick run command** | `pnpm test --run` |
| **Full suite command** | `pnpm test --run` |
| **Estimated runtime** | ~45 seconds |

---

## Sampling Rate

- **After every task commit:** Run `pnpm test --run`
- **After every plan wave:** Run `pnpm test --run`
- **Before `/gsd:verify-work`:** Full suite must be green
- **Max feedback latency:** 45 seconds

---

## Per-Task Verification Map

| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| 41-02-01 | 02 | 2 | DIAG-01, DIAG-02 | unit | `npx vitest run server/src/services/renderers/__tests__/diagram-renderer.test.ts` | ❌ W0 | ⬜ pending |
| 41-02-02 | 02 | 2 | ICON-01, ICON-02, ICON-03 | unit | `npx vitest run server/src/services/renderers/__tests__/icon-renderer.test.ts` | ❌ W0 | ⬜ pending |
| 41-03-01 | 03 | 2 | THEME-01, THEME-02, THEME-03 | unit | `npx vitest run server/src/services/renderers/__tests__/theme-engine.test.ts` | ❌ W0 | ⬜ pending |
| 41-04-01 | 04 | 3 | DIAG-03, DIAG-04, DIAG-05 | unit | `npx vitest run ui/src/components/DiagramSourcePanel.test.tsx` | ❌ W0 | ⬜ pending |
| 41-05-01 | 05 | 3 | THEME-04, THEME-05, THEME-06, THEME-07 | unit | `npx vitest run ui/src/components/ThemePreviewPanel.test.tsx` | ❌ W0 | ⬜ pending |
| 41-06-01 | 06 | 4 | ALL | integration | `pnpm test --run` | ❌ W0 | ⬜ pending |

*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*

---

## Wave 0 Requirements

- [ ] Test stubs for diagram renderer (Mermaid + DOMPurify + LLM synthesis)
- [ ] Test stubs for icon renderer (LLM SVG + SVGO)
- [ ] Test stubs for OKLCH palette engine (culori + wcag-contrast)
- [ ] Test stubs for DiagramSourcePanel (collapsible, copy, re-render)
- [ ] Test stubs for ThemePreviewPanel (scoped CSS injection)

---

## Manual-Only Verifications

| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Mermaid diagram renders visually correct | DIAG-01 | Requires visual inspection | Submit diagram prompt, verify rendered SVG looks correct |
| Icon set is visually cohesive | ICON-01 | Subjective visual quality | Generate icon set, verify icons look consistent |
| Theme live preview in Nexus UI | THEME-04 | Requires browser interaction | Pick seed color, verify CSS vars apply in preview container |
| WCAG AA contrast visible | THEME-03 | Requires visual contrast check | Generate palette, verify PASS/FAIL badges match computed contrast |

---

## Validation Sign-Off

- [ ] All tasks have `<automated>` verify or Wave 0 dependencies
- [ ] Sampling continuity: no 3 consecutive tasks without automated verify
- [ ] Wave 0 covers all MISSING references
- [ ] No watch-mode flags
- [ ] Feedback latency < 45s
- [ ] `nyquist_compliant: true` set in frontmatter

**Approval:** pending
