# 测试矩阵

**功能**:
**会话**:
**最后更新**:

| Requirement ID | 优先级 | 来源 / 风险 | 页面 / 组件 | 状态 | API / 契约 | 测试层级 | 测试用例 ID | Oracle | 测试数据 | 负责人 | 证据路径 | 状态 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| REQ-001 | P0 | PRD / business_rule | | 默认 | | T5 E2E | E2E-001 | response + db | seed/default | 测试 | | planned |
| PKG-LAYER-P5-MIGRATE-CONTRACT | P1 | `docs/agent-package-redesign/migration-plan.md` / 迁移安全边界 | docs / install manifest governance | Phase 5 contract | `-MigratePlan` / `-MigrateApply` 契约 | doc + package sync | `LAYERING-P5-CONTRACT-001` | 文档契约一致；禁止自动删除、自动覆盖和默认 thin 切换 | root docs、agent docs、package templates、ai-sync metadata | harness | `traces/LAYERING-P5-CONTRACT-001/`, refresh CheckOnly 输出 | done |
| PKG-LAYER-P5-MIGRATE-APPLY | P1 | `docs/agent-package-redesign/migration-plan.md` / legacy vendor 迁移写入风险 | CLI / PowerShell installer | legacy full / drift / unknown / missing / manual-review / thin no-op | `-MigrateApply`, `-Confirm`, `.codex-harness/locks/package.lock.json` | integration | `TC-PKG-LAYER-P5-APPLY-001..006` | command output + lock hash/managedFiles + no-side-effect filesystem evidence | full install fixture、drift file、unknown file、missing vendor file、legacy docs、thin project fixture | harness | `traces/LAYERING-P5-APPLY-001/`, `tools/harness/tests/test-install-modes.ps1` 输出, doctor 输出, refresh CheckOnly 输出 | verified |
| PKG-LAYER-P6-READINESS | P1 | `docs/agent-package-redesign/migration-plan.md` / 默认切换前 readiness 风险 | CLI / doctor | thin clean / legacy residue / missing user package / vendor / no config | `tools/harness/doctor.ps1`, `.codex-harness/state/config.json`, package lock | integration | `TC-PKG-LAYER-P6-READINESS-001..005` | doctor output + unchanged files + actionable remediation hints | thin project fixture、vendor fixture、legacy residue fixture、missing user package fixture、no config fixture | harness | `traces/LAYERING-P6-READINESS-001/`, doctor 输出, test-install-modes 输出 | verified |
| PKG-LAYER-P7-DEFAULT-THIN | P1 | `docs/agent-package-redesign/target-layering-standard.md` / 默认安装兼容风险 | CLI / installer | default thin / explicit legacy full / vendor / user/project scope / thin plan / legacy plan | default install, `-Mode full`, `-Scope project`, `-Scope vendor`, `-Scope user`, `-Plan` | integration | `TC-PKG-LAYER-P7-DEFAULT-THIN-001..006` | required/forbidden path assertions + plan output + package lock/config + doctor output | empty temp project、user package fixture、legacy full fixture、vendor fixture、plan fixtures | harness | `traces/LAYERING-P7-DEFAULT-THIN-001/`, test-install-modes 输出, doctor 输出, verify 输出 | verified |
| PKG-LAYER-P8-CLI-ALIAS | P1 | `docs/harness/new-project-usage.md` / 双实现风险 | CLI / docs | wrapper path / documented equivalent / no double implementation | install-user/init-project wrapper or documented `tools/install/install-agent.ps1 -Scope` equivalent | integration / doc check | `TC-PKG-LAYER-P8-CLI-ALIAS-001..003` | wrapper command output or doc assertion + smoke equivalence + no copied install logic | `p8-install-user-wrapper`, `p8-init-project-wrapper`, `p8-wrapper-no-double-implementation` | harness | `traces/LAYERING-P8-CLI-ALIAS-001/`, `docs/harness/new-project-usage.md`, refresh CheckOnly 输出 | planned |
| PKG-LAYER-P9-RELEASE-VERIFY | P1 | `docs/agent-package-redesign/README.md` / 发布收口风险 | release verification | default install / compatibility / migration / docs state | smoke、doctor、refresh CheckOnly、`tools/harness/verify.ps1` | release | `LAYERING-P9-RELEASE-VERIFY-001` | fresh release evidence; 文档状态与实现一致；future work 边界明确 | 当前 PR 分支、traces、package surface、release docs | harness | `traces/LAYERING-P9-RELEASE-VERIFY-001/`, smoke 输出, doctor 输出, verify 输出 | planned |

## 覆盖规则

- 每条 P0/P1 需求都必须出现在这个矩阵中。
- 每条 P0/P1 行都必须指向一个验收示例或场景 ID。
- 每个必需 UI 状态都必须映射到 story、组件、E2E、视觉一致性，或给出明确豁免。
- API / 数据变更必须映射到契约和 API 集成证据。
- 计划中的实现任务应能够从这个矩阵推导出 affected tests。
- 每个测试用例都必须声明来源和 Oracle，不能只声明测试层级。
- POST / PUT / PATCH / DELETE、状态流转、权限和异步场景必须声明副作用或无副作用证据。
- `planned` 或 `blocked` 的 P0/P1 行在最终 Verify 前必须给出解释。
