docs(01): add validation strategy

This commit is contained in:
admin committed 2026-06-05 17:11:23 +02:00
1 parent dbc002c492
commit be93b6c56d
1 file changed
+89
@@ -0,0 +1,89 @@
---
phase: 1
slug: foundation
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-06-05
---
# Phase 1 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | Vitest 2.x |
| **Config file** | `vitest.config.ts` — Wave 0 installs |
| **Quick run command** | `pnpm vitest run --reporter=dot` |
| **Full suite command** | `pnpm vitest run` |
| **Estimated runtime** | ~15 seconds |
---
## Sampling Rate
- **After every task commit:** Run `pnpm vitest run --reporter=dot`
- **After every plan wave:** Run `pnpm vitest run`
- **Before `/gsd-verify-work`:** Full suite must be green
- **Max feedback latency:** 20 seconds
---
## Per-Task Verification Map
| Task ID | Plan | Wave | Requirement | Threat Ref | Secure Behavior | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|------------|-----------------|-----------|-------------------|-------------|--------|
| 1-01-01 | 01 | 0 | AUTH-01 | T-1-01 | Signup creates owner row with Clerk ID; password never stored in app DB | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
| 1-01-02 | 01 | 0 | AUTH-02 | T-1-01 | Email verification status readable from Clerk session | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
| 1-01-03 | 01 | 1 | AUTH-03 | T-1-01 | Password reset triggers Clerk email; no token stored in app DB | manual | — | — | ⬜ pending |
| 1-01-04 | 01 | 1 | AUTH-04 | T-1-01 | Session cookie set as httpOnly; persists across refresh | manual | — | — | ⬜ pending |
| 1-02-01 | 02 | 1 | PET-01 | T-1-02 | Pet row includes owner_id FK; create enforces ownership | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
| 1-02-02 | 02 | 1 | PET-02 | T-1-02 | Edit validates owner_id === ctx.userId before update | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
| 1-02-03 | 02 | 1 | PET-03 | T-1-02 | Delete validates owner_id === ctx.userId; cascades media records | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
| 1-02-04 | 02 | 1 | PET-04 | — | Active pet switch updates localStorage; RSC fallback uses first pet | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
| 1-02-05 | 02 | 1 | PET-05 | — | Adoption origin story field persists to DB; readable on profile | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
| 1-03-01 | 03 | 2 | PET-01 | T-1-03 | Presigned URL generated server-side; raw bytes never reach API | unit | `pnpm vitest run` | ❌ W0 | ⬜ pending |
*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
---
## Wave 0 Requirements
- [ ] `src/__tests__/auth.test.ts` — stubs for AUTH-01, AUTH-02
- [ ] `src/__tests__/pet-profile.test.ts` — stubs for PET-01, PET-02, PET-03, PET-04, PET-05
- [ ] `src/__tests__/media-upload.test.ts` — stubs for presigned R2 upload (PET-01 avatar)
- [ ] `vitest.config.ts` — Vitest config with jsdom environment
- [ ] `vitest` + `@vitest/coverage-v8` installed as devDependencies
*Wave 0 must complete before implementation tasks in Wave 1.*
---
## Manual-Only Verifications
| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Email verification email received | AUTH-02 | Requires live Clerk project + real email | Sign up → check inbox → click verification link → confirm `emailVerified: true` in Clerk dashboard |
| Password reset email received | AUTH-03 | Requires live Clerk project + real email | Trigger reset → check inbox → follow link → confirm new password works |
| Session persists across refresh | AUTH-04 | Browser state; cannot be unit-tested | Log in → close tab → reopen URL → confirm still logged in |
| Active pet persists in sidebar | PET-04 | Browser localStorage; cannot be unit-tested | Switch active pet → hard refresh → confirm same pet is active |
| Avatar served from CDN (not API) | PET-01 | Network inspector needed | Upload avatar → open DevTools Network tab → confirm request goes to `*.r2.cloudflarestorage.com` or Cloudflare CDN domain, not app API |
---
## 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 < 20s
- [ ] `nyquist_compliant: true` set in frontmatter
**Approval:** pending