---
phase: 20
slug: offline-mode-hardening
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-04-10
---

# Phase 20 — Validation Strategy

> Per-phase validation contract for feedback sampling during execution.

---

## Test Infrastructure

| Property | Value |
|----------|-------|
| **Framework** | Rust built-in `#[test]` + rusqlite in-memory |
| **Config file** | none — inline `#[cfg(test)]` modules |
| **Quick run command** | `cargo test --package app -- pending` |
| **Full suite command** | `cargo test --package app && cargo test --package service` |
| **Estimated runtime** | ~30 seconds |

---

## Sampling Rate

- **After every task commit:** Run `cargo test --package app && cargo test --package service`
- **After every plan wave:** Run `cargo test --package app && cargo test --package service`
- **Before `/gsd-verify-work`:** Full suite must be green
- **Max feedback latency:** 30 seconds

---

## Per-Task Verification Map

| Task ID | Plan | Wave | Requirement | Threat Ref | Secure Behavior | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|------------|-----------------|-----------|-------------------|-------------|--------|
| 20-01-01 | 01 | 1 | OFFLINE-01 | — | N/A | unit | `cargo test --package app -- fetch_card_snapshots` | Partial | pending |
| 20-01-02 | 01 | 1 | OFFLINE-02 | — | N/A | unit | `cargo test --package app -- pending_edit` | Partial | pending |
| 20-01-03 | 01 | 1 | OFFLINE-02 | — | N/A | unit | `cargo test --package service -- count_active_pending` | NO — W0 | pending |
| 20-01-04 | 01 | 1 | OFFLINE-03 | — | N/A | unit | `cargo test --package app -- conflict_avoidance` | NO — W0 | pending |
| 20-01-05 | 01 | 1 | OFFLINE-03 | — | N/A | unit | `cargo test --package service -- has_pending_edits` | NO — W0 | pending |

*Status: pending / green / red / flaky*

---

## Wave 0 Requirements

- [ ] `crates/service/src/db/sqlite.rs` — test for `count_active_pending_edits()` method
- [ ] `crates/service/src/db/sqlite.rs` — test for `has_pending_edits_for_entity()` method
- [ ] `crates/app/src/live_client.rs` — test for conflict avoidance: insert pending edit + run partial sync + verify upsert skipped
- [ ] `crates/app/src/dashboard/pending_edit_flusher.rs` — test that `pending-edit-count` is set after flush pass

---

## Manual-Only Verifications

| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Breathing green dot animation | OFFLINE-02 | Slint visual animation requires running app | Build with `cargo build`, verify green dot pulses when pending edits exist |
| Connection-status indicator updates | OFFLINE-01 | Requires network state change | Disconnect network, verify red dot appears, reconnect, verify green returns |

---

## 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
