---
phase: 7
slug: weight-unit-selection
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-16
---

# Phase 7 — Validation Strategy

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

---

## Test Infrastructure

| Property | Value |
|----------|-------|
| **Framework** | Bun test runner (built-in) |
| **Config file** | None (uses bun defaults) |
| **Quick run command** | `bun test` |
| **Full suite command** | `bun test` |
| **Estimated runtime** | ~5 seconds |

---

## Sampling Rate

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

---

## Per-Task Verification Map

| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| 07-01-01 | 01 | 1 | UNIT-01 | unit | `bun test tests/routes/settings.test.ts` | No — Wave 0 | ⬜ pending |
| 07-01-02 | 01 | 1 | UNIT-02 | unit | `bun test tests/lib/formatters.test.ts` | No — Wave 0 | ⬜ pending |
| 07-01-03 | 01 | 1 | UNIT-03 | unit | `bun test tests/routes/settings.test.ts` | No — Wave 0 | ⬜ pending |

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

---

## Wave 0 Requirements

- [ ] `tests/lib/formatters.test.ts` — formatWeight with all 4 units, null handling, precision
- [ ] `tests/routes/settings.test.ts` — settings API for weightUnit key (GET/PUT)

*Existing test infrastructure (bun test, helpers/db.ts) covers framework setup.*

---

## Manual-Only Verifications

| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Unit toggle renders in TotalsBar | UNIT-01 | UI component rendering | Open app, verify g/oz/lb/kg toggle visible in TotalsBar |
| All weight displays update on unit change | UNIT-02 | Visual verification across 8 components | Switch unit, check ItemCard, CandidateCard, CategoryHeader, SetupCard, setup detail, collection route |
| Setting persists across browser refresh | UNIT-03 | Browser session state | Select "oz", refresh page, verify still shows "oz" |

---

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

**Approval:** pending
