---
phase: 11
slug: candidate-ranking
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-16
---

# Phase 11 — Validation Strategy

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

---

## Test Infrastructure

| Property | Value |
|----------|-------|
| **Framework** | Bun test (built-in) |
| **Config file** | none — `bun test` auto-discovers `*.test.ts` |
| **Quick run command** | `bun test tests/services/thread.service.test.ts` |
| **Full suite command** | `bun test` |
| **Estimated runtime** | ~5 seconds |

---

## Sampling Rate

- **After every task commit:** Run `bun test tests/services/thread.service.test.ts`
- **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 |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| TBD | 01 | 1 | RANK-01 | unit | `bun test tests/services/thread.service.test.ts` | ❌ W0 | ⬜ pending |
| TBD | 01 | 1 | RANK-01 | integration | `bun test tests/routes/threads.test.ts` | ❌ W0 | ⬜ pending |
| TBD | 01 | 1 | RANK-04 | unit | `bun test tests/services/thread.service.test.ts` | ❌ W0 | ⬜ pending |
| TBD | 01 | 1 | RANK-05 | unit | `bun test tests/services/thread.service.test.ts` | ❌ W0 | ⬜ pending |
| TBD | 01 | 1 | RANK-05 | integration | `bun test tests/routes/threads.test.ts` | ❌ W0 | ⬜ pending |
| TBD | 02 | 1 | RANK-02 | manual | Visual inspection | N/A | ⬜ pending |

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

---

## Wave 0 Requirements

- [ ] New test cases in `tests/services/thread.service.test.ts` — covers RANK-01, RANK-04, RANK-05 service behavior
- [ ] New test cases in `tests/routes/threads.test.ts` — covers RANK-01, RANK-05 route behavior
- [ ] Update `tests/helpers/db.ts` CREATE TABLE for `thread_candidates` to add `sort_order REAL NOT NULL DEFAULT 0`

---

## Manual-Only Verifications

| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Rank badge rendering (gold/silver/bronze medal icons on top 3) | RANK-02 | No component test infrastructure; visual verification required | Open thread with 3+ candidates, verify top 3 show medal icons with correct colors |
| Drag handle visibility and interaction | RANK-01 | Visual/interaction verification | Open active thread in list view, verify grip icons visible, drag to reorder |
| Drag handle absent on resolved thread | RANK-05 | Visual verification | Open resolved thread, verify no grip icons, rank badges still visible (static) |

---

## 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
