docs(08-04): 完成第 8 阶段验证约定

- 将占位符替换为可执行的快速/完整验证命令
- 添加 08-01 至 08-04 各任务的验证映射,包含需求链接与威胁链接
This commit is contained in:
肖应宇 2026-04-23 09:44:16 +08:00
parent cf36873d99
commit 3601dd2369
1 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,84 @@
---
phase: 8
slug: bg-00000-text-000000
status: ready
nyquist_compliant: true
wave_0_complete: true
created: 2026-04-23
---
# Phase 8 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | Playwright E2E + color guard script (`node`) |
| **Config file** | `frontend/playwright.config.ts` |
| **Quick run command** | `pnpm --dir frontend run guard:colors` |
| **Full suite command** | `pnpm --dir frontend run lint && pnpm --dir frontend run typecheck && pnpm --dir frontend run test:e2e -- theme-colors.spec.ts` |
| **Estimated runtime** | ~2-6 min取决于 E2E 环境与线程数据) |
---
## Sampling Rate
- **After every task commit:** Run `pnpm --dir frontend run guard:colors`
- **After every plan wave:** Run `pnpm --dir frontend run lint && pnpm --dir frontend run typecheck && pnpm --dir frontend run test:e2e -- theme-colors.spec.ts`
- **Before `/gsd-verify-work 8`:** Full suite must be green
- **Max feedback latency:** 6 min本 phase
---
## Command Matrix
| Mode | Command | Goal |
|------|---------|------|
| quick | `pnpm --dir frontend run guard:colors` | 快速阻断新增硬编码颜色回归P8-03 |
| full | `pnpm --dir frontend run lint && pnpm --dir frontend run typecheck && pnpm --dir frontend run test:e2e -- theme-colors.spec.ts` | Phase 8 完整验证链(静态检查 + 主题 E2E覆盖 P8-04 |
---
## Per-Task Verification Map
| Task ID | Plan | Wave | Requirement | Threat Ref | Secure Behavior | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|------------|-----------------|-----------|-------------------|-------------|--------|
| 8-01-01 | 01 | 1 | P8-02 | T-08-02, T-08-03 | token 注册表与 `:root/.dark/@theme` 双向覆盖、唯一性可审计 | static | `node -e "import('./frontend/src/styles/workspace-color-tokens.ts').then(m=>{const t=m.WORKSPACE_COLOR_TOKENS;const vals=Object.values(t).map(x=>x.light.toLowerCase());if(new Set(vals).size!==vals.length) throw new Error('duplicate light color mapping');console.log('ok')})"` | ✅ | ✅ green |
| 8-01-02 | 01 | 1 | P8-03 | T-08-01 | 新增 `#hex` / arbitrary color 回归可被守卫阻断 | static | `pnpm --dir frontend run guard:colors` | ✅ | ✅ green |
| 8-02-01 | 02 | 2 | P8-01 | T-08-05, T-08-06 | thread/layout/header 从硬编码迁移到 token保证 light/dark 可见性 | static | `pnpm --dir frontend run guard:colors` | ✅ | ✅ green |
| 8-02-02 | 02 | 2 | P8-01 | T-08-04 | input/suggestion/streaming 颜色迁移后保持 lint/typecheck 通过 | static | `pnpm --dir frontend run lint && pnpm --dir frontend run typecheck` | ✅ | ✅ green |
| 8-03-01 | 03 | 2 | P8-01 | T-08-07, T-08-08 | artifact list/detail 无硬编码色值回归 | static | `pnpm --dir frontend run guard:colors` | ✅ | ✅ green |
| 8-03-02 | 03 | 2 | P8-01 | T-08-09 | artifact 预览区内联变量迁移后类型与 lint 保持稳定 | static | `pnpm --dir frontend run lint && pnpm --dir frontend run typecheck` | ✅ | ✅ green |
| 8-04-01 | 04 | 3 | P8-04 | T-08-11, T-08-12 | E2E 覆盖 light/dark 关键交互并仅通过 `html` class 切换主题 | e2e | `pnpm --dir frontend exec playwright test --list tests/e2e/theme-colors.spec.ts` | ✅ | ✅ green |
| 8-04-02 | 04 | 3 | P8-03, P8-04 | T-08-10 | 验证文档命令可复制执行且无占位符残留 | static | `rg -n "\\{quick command\\}|\\{full command\\}|REQ-\\{XX\\}" .planning/phases/08-bg-00000-text-000000/08-VALIDATION.md && echo "unexpected placeholders found" && exit 1 || echo "validation doc clean"` | ✅ | ✅ green |
*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
---
## Wave 0 Requirements
Existing infrastructure covers all phase requirements.
---
## Manual-Only Verifications
All phase behaviors have automated verification.
---
## Validation Sign-Off
- [x] All tasks have `<automated>` verify or Wave 0 dependencies
- [x] Sampling continuity: no 3 consecutive tasks without automated verify
- [x] Wave 0 covers all MISSING references
- [x] No watch-mode flags
- [x] Feedback latency < 8s
- [x] `nyquist_compliant: true` set in frontmatter
**Approval:** approved 2026-04-23