nexus/.planning/phases/21-chat-foundation/21-VALIDATION.md

92 lines
4.3 KiB
Markdown

---
phase: 21
slug: chat-foundation
status: draft
nyquist_compliant: true
wave_0_complete: false
created: 2026-04-01
---
# Phase 21 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | vitest |
| **Server test dir** | `server/src/__tests__/` |
| **UI test colocation** | `ui/src/components/*.test.tsx` |
| **Quick run (server)** | `pnpm vitest run server/src/__tests__/chat-service.test.ts server/src/__tests__/chat-routes.test.ts` |
| **Quick run (UI)** | `pnpm vitest run ui/src/components/ChatMarkdownMessage.test.tsx ui/src/components/ChatInput.test.tsx` |
| **Full suite command** | `pnpm test:run` |
| **Estimated runtime** | ~15 seconds |
---
## Sampling Rate
- **After every task commit:** Run relevant test file(s) per task verify command
- **After every plan wave:** Run `pnpm test:run`
- **Before `/gsd:verify-work`:** Full suite must be green
- **Max feedback latency:** 15 seconds
---
## Per-Task Verification Map
| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| 21-00-01 | 00 | 0 | (scaffolds) | stub | `pnpm vitest run server/src/__tests__/chat-service.test.ts server/src/__tests__/chat-routes.test.ts` | Created in W0 | pending |
| 21-00-02 | 00 | 0 | (scaffolds) | stub | `pnpm vitest run ui/src/components/ChatMarkdownMessage.test.tsx ui/src/components/ChatInput.test.tsx` | Created in W0 | pending |
| 21-01-01 | 01 | 1 | HIST-01, HIST-06 | schema | grep + migration file check | N/A | pending |
| 21-01-02 | 01 | 1 | HIST-01 | types | import check | N/A | pending |
| 21-02-01 | 02 | 1 | CHAT-02, CHAT-03, THEME-02 | unit | `pnpm vitest run ui/src/components/ChatMarkdownMessage.test.tsx` | Wave 0 | pending |
| 21-03-01 | 03 | 2 | CHAT-04, CHAT-05, CHAT-06, HIST-05 | unit | `pnpm vitest run server/src/__tests__/chat-service.test.ts` | Wave 0 | pending |
| 21-03-02 | 03 | 2 | CHAT-04, CHAT-05, CHAT-06, HIST-05 | unit | `pnpm vitest run server/src/__tests__/chat-routes.test.ts` | Wave 0 | pending |
| 21-04-01 | 04 | 2 | INPUT-01, INPUT-07, THEME-01 | unit | `pnpm vitest run ui/src/components/ChatInput.test.tsx` | Wave 0 | pending |
| 21-05-01 | 05 | 3 | HIST-02, HIST-03 | tsc | `pnpm --filter @paperclipai/ui exec -- tsc --noEmit` | N/A | pending |
| 21-05-02 | 05 | 3 | HIST-02, HIST-03 | tsc | `pnpm --filter @paperclipai/ui exec -- tsc --noEmit` | N/A | pending |
| 21-05-03 | 05 | 3 | (all) | visual | manual | N/A | pending |
*Status: pending / green / red / flaky*
---
## Wave 0 Requirements
Plan 21-00 creates these four test stubs:
- [x] `server/src/__tests__/chat-service.test.ts` — covers HIST-01, CHAT-04, CHAT-05, CHAT-06
- [x] `server/src/__tests__/chat-routes.test.ts` — covers route-level integration (POST conversation, GET list, POST message)
- [x] `ui/src/components/ChatMarkdownMessage.test.tsx` — covers CHAT-02/03 (code block render + copy button)
- [x] `ui/src/components/ChatInput.test.tsx` — covers INPUT-07 keyboard shortcuts
*Test stubs are created by Plan 21-00 (Wave 0). Plans 01-04 fill in real test implementations.*
---
## Manual-Only Verifications
| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Theme visual correctness | THEME-01, THEME-02 | Visual appearance cannot be tested with unit tests | Switch between Catppuccin Mocha, Tokyo Night, and Catppuccin Latte; verify code block highlighting matches active theme |
| Markdown rendering fidelity | CHAT-02 | Complex rendering output hard to unit test fully | Send messages with code blocks, tables, lists, headings, links, inline images; verify each renders correctly |
| Infinite scroll behavior | HIST-03 | Requires browser scroll events | Create 30+ conversations, scroll to bottom of list, verify more load |
| Full end-to-end flow | All | Integration across all plans | Plan 05 Task 3 checkpoint covers this |
---
## Validation Sign-Off
- [x] All tasks have `<automated>` verify or Wave 0 dependencies
- [x] Sampling continuity: no 3 consecutive tasks without automated verify
- [x] Wave 0 covers all MISSING references
- [x] No watch-mode flags
- [x] Feedback latency < 15s
- [x] `nyquist_compliant: true` set in frontmatter
**Approval:** approved