docs(01): add validation strategy

Add Nyquist validation contract for Phase 1 Foundation.
Covers test infrastructure, sampling rate, and per-task verification map.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 16:43:55 +08:00
parent c555b78d9b
commit ac578bafd0
@@ -0,0 +1,81 @@
---
phase: 01
slug: foundation
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-13
---
# Phase 1 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | pytest 7.x |
| **Config file** | pyproject.toml (Wave 0 creates) |
| **Quick run command** | `pytest tests/unit/ -q` |
| **Full suite command** | `pytest tests/ -v --cov=src` |
| **Estimated runtime** | ~15 seconds |
---
## Sampling Rate
- **After every task commit:** Run `pytest tests/unit/ -q`
- **After every plan wave:** Run `pytest tests/ -v --cov=src`
- **Before `/gsd:verify-work`:** Full suite must be green
- **Max feedback latency:** 15 seconds
---
## Per-Task Verification Map
| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| 01-01-01 | 01 | 1 | PIPE-02, REL-01 | unit | `pytest tests/unit/test_state_manager.py -v` | ❌ W0 | ⬜ pending |
| 01-01-02 | 01 | 1 | REL-02 | unit | `pytest tests/unit/test_state_manager.py::test_atomic_write -v` | ❌ W0 | ⬜ pending |
| 01-02-01 | 02 | 1 | PIPE-03, VAL-01 | unit | `pytest tests/unit/test_schema_registry.py -v` | ❌ W0 | ⬜ pending |
| 01-02-02 | 02 | 1 | PIPE-01 | unit | `pytest tests/unit/test_schema_registry.py::test_step_input_output -v` | ❌ W0 | ⬜ pending |
| 01-03-01 | 03 | 1 | REL-03, MNT-03 | unit | `pytest tests/unit/test_error_handler.py -v` | ❌ W0 | ⬜ pending |
| 01-03-02 | 03 | 1 | MNT-02 | unit | `pytest tests/unit/test_config_manager.py -v` | ❌ W0 | ⬜ pending |
*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
---
## Wave 0 Requirements
- [ ] `tests/unit/test_state_manager.py` — stubs for PIPE-02, REL-01, REL-02
- [ ] `tests/unit/test_schema_registry.py` — stubs for PIPE-01, PIPE-03, VAL-01
- [ ] `tests/unit/test_error_handler.py` — stubs for REL-03, MNT-03
- [ ] `tests/unit/test_config_manager.py` — stubs for MNT-02
- [ ] `tests/conftest.py` — shared fixtures (temp dirs, mock env)
- [ ] `pytest` + `pytest-cov` — if no framework detected
---
## Manual-Only Verifications
| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| ~/.kb_env 验证失败时退出 | MNT-02 | 需要模拟真实环境 | 1. 移除必需变量 2. 运行 kb --help 3. 确认非零退出码和错误提示 |
| 原子写入崩溃恢复 | REL-02 | 需要模拟进程终止 | 1. 在写入中途 kill 2. 检查 .bak 文件存在 3. 确认可恢复 |
---
## 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 < 15s
- [ ] `nyquist_compliant: true` set in frontmatter
**Approval:** pending