---
phase: 16
slug: multi-user-data-model
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-04-05
---

# Phase 16 — Validation Strategy

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

---

## Test Infrastructure

| Property | Value |
|----------|-------|
| **Framework** | Bun test runner (built-in) |
| **Config file** | none (Bun built-in) |
| **Quick run command** | `bun test tests/services/item.service.test.ts` |
| **Full suite command** | `bun test` |
| **Estimated runtime** | ~30 seconds (individual files) |

---

## Sampling Rate

- **After every task commit:** Run `bun test` (affected file)
- **After every plan wave:** Run `bun test` (full suite)
- **Before `/gsd:verify-work`:** Full suite must be green
- **Max feedback latency:** 30 seconds

---

## Per-Task Verification Map

| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| 16-01-01 | 01 | 1 | MULTI-01 | unit | `bun test tests/services/item.service.test.ts` | ✅ (needs update) | ⬜ pending |
| 16-01-02 | 01 | 1 | MULTI-03 | unit | `bun test tests/services/category.service.test.ts` | ✅ (needs update) | ⬜ pending |
| 16-02-01 | 02 | 2 | MULTI-02 | unit | `bun test tests/services/item.service.test.ts` | ❌ W0 (new isolation test) | ⬜ pending |
| 16-02-02 | 02 | 2 | MULTI-05 | unit | `bun test tests/mcp/tools.test.ts` | ✅ (needs update) | ⬜ pending |
| 16-02-03 | 02 | 2 | MULTI-06 | unit | `bun test tests/routes/settings.test.ts` | ✅ (needs update) | ⬜ pending |
| 16-03-01 | 03 | 3 | MULTI-04 | integration | Migration verification | ❌ W0 | ⬜ pending |

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

---

## Wave 0 Requirements

- [ ] Update `createTestDb()` to return `{ db, userId }` with seeded user
- [ ] Add cross-user isolation tests (create as user A, verify user B can't see)
- [ ] Update all service tests to pass userId parameter
- [ ] Update all route tests to set userId in context
- [ ] Update MCP tool tests to pass userId

---

## Manual-Only Verifications

| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Existing data migrated to first user | MULTI-04 | Requires real migration against existing DB | Run migration on dev DB, verify all items/categories/threads/setups have userId = 1 |

---

## 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 < 30s
- [ ] `nyquist_compliant: true` set in frontmatter

**Approval:** pending
