Author orch Markdown test plan

This commit is contained in:
2026-03-19 16:27:28 +08:00
parent b448d98e71
commit a20bec1cac
68 changed files with 2225 additions and 160 deletions
@@ -0,0 +1,39 @@
# Case: `dispatch-creates-strict-worktree`
## 用例意义
验证显式 `--strict-worktree` dispatch 会创建隔离 worktree,并把 workspace 元数据持久化到 attempt 与任务 payload 中。
## 前置条件
- `TMPDIR/repo` 是一个干净的 Git 仓库
- 仓库内已存在至少一个已提交文件
- 已存在 run `run_blog_worktree_001` 与任务 `T1`
## 输入
```bash
orch --db TMPDIR/coord.db --json run init --run run_blog_worktree_001 --goal "Validate strict worktree dispatch"
orch --db TMPDIR/coord.db --json task add --run run_blog_worktree_001 --task T1 --title "Implement backend" --default-to worker-a
orch --db TMPDIR/coord.db --json dispatch --run run_blog_worktree_001 --task T1 --repo-path TMPDIR/repo --workspace-root .orch/worktrees --strict-worktree --body "Implement inside isolated worktree."
```
## 预期输出
- `dispatch` 退出码为 `0`
- `data.attempt.base_ref == "HEAD"`
- `data.attempt.base_commit` 等于仓库当前 `HEAD` commit
- `data.attempt.branch_name == "orch/run-blog-worktree-001/T1/attempt-1"`
- 返回非空 `data.attempt.worktree_path`
- `data.attempt.workspace_status == "created"`
- `data.message.payload_json.worktree_path` 与 attempt 中的路径一致
## 断言结论
- strict worktree dispatch 会创建真正的隔离工作目录,而不是只记录一组字符串元数据
- worker 读取任务 payload 时可以拿到同一份 worktree 路径
## 补充约束
- 未显式传 `--base-ref` 且仓库干净时,会默认回退到 `HEAD`
- `--workspace-root` 为相对路径时,会相对于仓库根目录解析