deerflow2/.planning/phases/06-/06-03-PLAN.md

166 lines
7.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
phase: 06-
plan: 03
type: execute
wave: 3
depends_on:
- 06-01
- 06-02
files_modified:
- frontend/tests/e2e/input-and-compose.spec.ts
- frontend/tests/e2e/support/chat-helpers.ts
- frontend/src/core/threads/hooks.test.ts
- .planning/phases/06-/06-VALIDATION.md
- .planning/phases/06-/06-COMMIT-GUIDE.md
autonomous: true
requirements:
- ATREF-04
must_haves:
truths:
- "@ 引用主流程有自动化测试覆盖候选、chip、上限、软失败。"
- "Phase 6 提交分组按 style / logic / tests / docs 顺序可直接执行。"
- "Validation 文档的 Wave 0 缺口被关闭或显式替换为可执行命令。"
artifacts:
- path: "frontend/tests/e2e/input-and-compose.spec.ts"
provides: "@ 引用交互 E2E 回归"
- path: "frontend/src/core/threads/hooks.test.ts"
provides: "提交 envelope 与软失败单测"
- path: ".planning/phases/06-/06-COMMIT-GUIDE.md"
provides: "按关注点提交分组与执行顺序"
key_links:
- from: "frontend/tests/e2e/input-and-compose.spec.ts"
to: "frontend/src/components/workspace/input-box.tsx"
via: "@ 引用交互断言"
pattern: "@引用|chip|失效引用|上限"
- from: ".planning/phases/06-/06-COMMIT-GUIDE.md"
to: "git history"
via: "concern-based commit order"
pattern: "style -> logic -> tests -> docs"
---
<objective>
补齐 Phase 6 的自动化验证与提交卫生,使本阶段可审计、可回归、可合并。
Purpose: 避免“功能上线但无测试与提交策略”的交付风险。
Output: E2E/单测、更新后的验证矩阵、以及可执行的 commit 分组计划。
</objective>
<execution_context>
@/home/mt/.codex/get-shit-done/workflows/execute-plan.md
@/home/mt/.codex/get-shit-done/templates/summary.md
</execution_context>
<context>
@.planning/ROADMAP.md
@.planning/phases/06-/06-VALIDATION.md
@.planning/phases/06-/06-CONTEXT.md
@frontend/tests/e2e/input-and-compose.spec.ts
@frontend/tests/e2e/support/chat-helpers.ts
@frontend/src/core/threads/hooks.test.ts
</context>
<tasks>
<task type="auto" tdd="true">
<name>Task 1: 增加 @ 引用 E2E 与 hooks 单测覆盖 D-01~D-08</name>
<files>frontend/tests/e2e/input-and-compose.spec.ts, frontend/tests/e2e/support/chat-helpers.ts, frontend/src/core/threads/hooks.test.ts</files>
<read_first>
- frontend/tests/e2e/input-and-compose.spec.ts
- frontend/tests/e2e/support/chat-helpers.ts
- frontend/src/core/threads/hooks.test.ts
- .planning/phases/06-/06-VALIDATION.md
- .planning/phases/06-/06-CONTEXT.md
</read_first>
<behavior>
- Test 1: 输入 `@` 后只展示当前线程候选并可过滤per D-01, D-02
- Test 2: 选择候选后显示 chip超过 10 个不可继续添加per D-03, D-08
- Test 3: 失效引用被剔除且发送不阻断per D-07
</behavior>
<action>`input-and-compose.spec.ts` 增加 `@引用` 场景用例(可用 `test.describe("聊天工作台 / @引用文件")` 分组);必要时在 `chat-helpers.ts` 增加 thread 内 artifact/upload fixture 探测辅助;在 `hooks.test.ts` 增加引用元信息提交与失效软失败断言。若环境依赖不足,使用 `testInfo.skip` 并写明原因字符串,不允许静默跳过。</action>
<acceptance_criteria>
- `rg -n "@引用文件|chip|失效引用|上限" frontend/tests/e2e/input-and-compose.spec.ts` 命中新增场景。
- `rg -n "ref_kind|ref_source|soft|stale|继续提交" frontend/src/core/threads/hooks.test.ts` 命中新增断言。
- 新增/修改测试命令可执行且输出包含 pass 或 explainable skip。
</acceptance_criteria>
<verify>
<automated>cd frontend && pnpm -s test:e2e -- input-and-compose.spec.ts && node --test src/core/threads/hooks.test.ts</automated>
</verify>
<done>自动化覆盖 D-01~D-08 的关键行为,并保留可解释 skip 机制。</done>
</task>
<task type="auto">
<name>Task 2: 更新验证矩阵并关闭 Wave 0 缺口</name>
<files>.planning/phases/06-/06-VALIDATION.md</files>
<read_first>
- .planning/phases/06-/06-VALIDATION.md
- .planning/phases/06-/06-RESEARCH.md
- .planning/phases/06-/06-CONTEXT.md
</read_first>
<action>`06-VALIDATION.md` 中 Wave 0 缺口替换为本阶段已落地的真实测试文件与命令;将 `nyquist_compliant` 更新为 `true`(前提是所有任务都具备自动化验证命令);在 Per-Task Verification Map 中加入 D-01~D-09 对应条目与 threat 引用。</action>
<acceptance_criteria>
- `rg -n "nyquist_compliant:\\s*true" .planning/phases/06-/06-VALIDATION.md` 命中。
- `rg -n "D-0[1-9]|ATREF" .planning/phases/06-/06-VALIDATION.md` 命中需求映射。
- `rg -n "Wave 0" .planning/phases/06-/06-VALIDATION.md` 不再包含未完成占位项。
</acceptance_criteria>
<verify>
<automated>cd /home/mt/Project/deerflow2 && rg -n "nyquist_compliant:\\s*true|D-0[1-9]|ATREF" .planning/phases/06-/06-VALIDATION.md</automated>
</verify>
<done>验证策略与实现状态一致,且 Nyquist 检查可通过。</done>
</task>
<task type="auto">
<name>Task 3: 产出 Phase 6 Git 提交分组计划style/logic/tests/docs</name>
<files>.planning/phases/06-/06-COMMIT-GUIDE.md</files>
<read_first>
- .planning/phases/05-test-hardening-and-commit-hygiene/05-SUMMARY.md
- .planning/phases/06-/06-01-PLAN.md
- .planning/phases/06-/06-02-PLAN.md
- .planning/phases/06-/06-VALIDATION.md
</read_first>
<action>新增 `06-COMMIT-GUIDE.md`,明确提交顺序与分组:`1) style`(仅样式/展示类变更,如 chip 外观、dropdown 样式类),`2) logic`(候选聚合、提交结构、软失败逻辑),`3) tests`hooks/e2e 用例与 helper`4) docs`VALIDATION/SUMMARY/ROADMAP 更新);每组列出建议 `git add` 文件清单与规范 commit message 模板禁止跨组混提。tests 组最小 E2E 验证必须覆盖 `DF-INPUT-007|DF-INPUT-008|DF-INPUT-009`,满足 DF-INPUT-009 hygiene 缺口。</action>
<acceptance_criteria>
- `06-COMMIT-GUIDE.md` 包含固定顺序文本 `style -> logic -> tests -> docs`
- 文档内每个分组都有文件清单与 commit message 示例。
- 文档包含“禁止跨组混提”规则。
</acceptance_criteria>
<verify>
<automated>cd /home/mt/Project/deerflow2 && rg -n "style -> logic -> tests -> docs|禁止跨组混提|DF-INPUT-009|commit message" .planning/phases/06-/06-COMMIT-GUIDE.md</automated>
</verify>
<done>提交卫生方案可直接执行,满足用户的分组与顺序约束。</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| test fixtures→真实线程环境 | 自动化测试依赖 thread fixtures 与后端可用性 |
| commit grouping doc→实际提交动作 | 文档规范需要转化为可执行提交步骤 |
## STRIDE Threat Register
| Threat ID | Category | Component | Disposition | Mitigation Plan |
|-----------|----------|-----------|-------------|-----------------|
| T-06-03-01 | R | `06-COMMIT-GUIDE.md` | mitigate | 提供固定顺序与文件清单,确保提交可追踪与可审计。 |
| T-06-03-02 | D | E2E 测试执行 | mitigate | 环境不足时显式 skip 并给原因,避免反复失败阻塞整个阶段。 |
| T-06-03-03 | T | 验证矩阵 | mitigate | 将验证命令与需求映射写死到 VALIDATION避免后续手工偏离。 |
</threat_model>
<verification>
- `cd frontend && pnpm -s test:e2e -- input-and-compose.spec.ts`
- `cd frontend && node --test src/core/threads/hooks.test.ts`
- `cd /home/mt/Project/deerflow2 && rg -n "style -> logic -> tests -> docs|DF-INPUT-009" .planning/phases/06-/06-COMMIT-GUIDE.md`
</verification>
<success_criteria>
- Phase 6 关键行为有自动化回归(单测 + E2E
- 验证文档与代码状态一致,不留 Wave 0 未闭合缺口。
- Git 提交计划明确 style/logic/tests/docs 分组与执行顺序。
</success_criteria>
<output>
After completion, create `.planning/phases/06-/06-03-SUMMARY.md`
</output>