# 验证矩阵

**功能**:
**任务 ID**:
**生成时间**:

| 检查项 | 命令 / 证据 | 必需 | 退出码 / 结论 | 报告路径 |
| --- | --- | --- | --- | --- |
| 验收 / 示例 | `ACCEPTANCE_EXAMPLES.md` + `ACCEPTANCE_CRITERIA.md` | P0/P1 必需 | | |
| 追溯 | `TRACEABILITY_MATRIX.md` | P0/P1 必需 | | |
| 静态检查 | `git diff --check` | 必需 | | |
| 类型检查 | | 项目相关 | | |
| Lint | | 项目相关 | | |
| 开发验证 | affected tests / unit / component / local contract / typecheck / lint | 代码变更时必需 | | |
| 单元 | | 代码变更时必需 | | |
| 组件 | | UI 变更时必需 | | |
| 契约 | | API / 数据变更时必需 | | |
| API 集成 | | 后端变更时必需 | | |
| Oracle 审查 | `TEST_STRATEGY.md` + `test-matrix.md` | P0/P1 / 高风险必需 | | |
| 副作用断言 | DB diff / cache / event / audit / file evidence | 写操作、状态流转、异步必需 | | |
| 状态唯一来源检查 | `frontend-architecture.md` 状态表 + CURRENT_TASK 状态决策 | UI / 表单 / 查询状态变更时必需 | | |
| 缓存失效检查 | cache key / invalidate 证据 / refetch 结果 | 远程数据、列表、详情、统计变更时必需 | | |
| 权限无副作用 | denied response + unchanged data + no leak | 权限 / 多租户必需 | | |
| 输入校验检查 | schema / validator + invalid payload response | API / 表单 / 文件上传时必需 | | |
| 敏感信息脱敏检查 | response/log/trace redaction evidence | 涉及账号、支付、PII、密钥时必需 | | |
| 风控 / 限流检查 | rate limit / captcha / idempotency evidence | 登录、注册、验证码、支付、上传等高风险入口必需 | | |
| 假测试检测 | Stage 2 review | 测试改动时必需 | | |
| 受影响测试 | changed-code-related tests | 业务逻辑变更时必需 | | |
| 用户验收链路 | story entry + action + business Oracle + side effect / no-side-effect evidence | feature_impl 完成前必需 | | |
| E2E | | P0/P1 主流程变更时必需 | | |
| P0 回归 | 核心 P0 场景 | 发布前必需 | | |
| 发布候选验证 | cross-story flow + P0/P1 regression + contract/API + E2E/visual as applicable | release 完成前必需 | | |
| 失败态验收 | negative path / denied path / invalid state / downstream failure evidence | P0/P1 / 高风险必需 | | |
| 视觉一致性 | `visual-parity-review.md` | UI 变更时必需 | | |
| 覆盖率 | `coverage-summary.json` | 如策略适用 | | |
| PKG-LAYER-P5-MIGRATE-APPLY 自然语言用例 | `docs/testing/NATURAL_LANGUAGE_TEST_CASES.md` 中 `TC-PKG-LAYER-P5-APPLY-001..006` | P1 必需 | planned | `traces/`, `tools/harness/tests/test-install-modes.ps1` |
| PKG-LAYER-P5-MIGRATE-APPLY TDD RED/GREEN/REFACTOR | `tools/harness/tests/test-install-modes.ps1` 先补迁移执行失败断言，再实现通过 | P1 必需 | planned | `traces/` |
| PKG-LAYER-P5-MIGRATE-APPLY 验收链路 | clean legacy full、drift、unknown、missing vendor、manual-review、thin no-op smoke | P1 必需 | planned | `traces/`, doctor 输出, refresh CheckOnly 输出 |
| PKG-LAYER-P6-READINESS 自然语言用例 | `TC-PKG-LAYER-P6-READINESS-001..005` 覆盖 thin clean、missing user package、legacy residue、vendor、no config | P1 必需 | verified | `traces/LAYERING-P6-READINESS-001/`, doctor/test-install-modes 输出 |
| PKG-LAYER-P6-READINESS 测试数据矩阵 | `docs/testing/TEST_DATA_MATRIX.md` 中 `readiness-thin-clean`、`readiness-missing-user-package`、`readiness-legacy-residue`、`readiness-vendor-lock`、`readiness-no-config` | P1 必需 | verified | `traces/LAYERING-P6-READINESS-001/`, `tools/harness/tests/test-install-modes.ps1` |
| PKG-LAYER-P7-DEFAULT-THIN 自然语言用例 | `TC-PKG-LAYER-P7-DEFAULT-THIN-001..006` 覆盖默认 thin、显式 legacy full、project/vendor/user scope、thin plan 和 legacy plan | P1 必需 | verified | `traces/LAYERING-P7-DEFAULT-THIN-001/`, test-install-modes 输出 |
| PKG-LAYER-P7-DEFAULT-THIN 测试数据矩阵 | `docs/testing/TEST_DATA_MATRIX.md` 中 `p7-default-thin-install`、`p7-legacy-full-install`、`p7-scope-project-install`、`p7-scope-vendor-install`、`p7-scope-user-install`、`p7-install-plan-profiles` | P1 必需 | verified | `traces/LAYERING-P7-DEFAULT-THIN-001/`, `tools/harness/tests/test-install-modes.ps1` |
| PKG-LAYER-P8-CLI-ALIAS 自然语言用例 | `TC-PKG-LAYER-P8-CLI-ALIAS-001..003` 覆盖等价入口、install-user wrapper、init-project wrapper 和 no-double-implementation 风险 | P1 必需 | planned | `traces/LAYERING-P8-CLI-ALIAS-001/`, docs/harness/new-project-usage.md |
| PKG-LAYER-P8-CLI-ALIAS 测试数据矩阵 | `docs/testing/TEST_DATA_MATRIX.md` 中 `p8-install-user-wrapper`、`p8-init-project-wrapper`、`p8-wrapper-no-double-implementation` | P1 必需 | planned | `traces/LAYERING-P8-CLI-ALIAS-001/`, `tools/harness/tests/test-install-modes.ps1` |

## 最终规则

最终交付要求每一行必需项都有 fresh evidence，或提供明确的 BLOCKED / exemption 记录并获得 owner 批准。
开发验证和验收验证是两类独立证据：单元、组件、局部 smoke、类型检查、lint 或 affected tests 不能替代用户验收链路；各子任务局部测试通过也不能替代发布候选验证。
用户验收链路、发布候选验证和失败态验收必须在实现完成后以当前变更集重新运行，证据需要能回溯到 Requirement ID、入口、测试数据、Oracle 和证据路径。
Stage 17 只应确认新鲜度与回归状态；缺失的验收示例或首次测试范围定义不应在这里补写。
