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
+5 -4
View File
@@ -1,7 +1,8 @@
# Orch `cancel` Test Plan Index
## Status
## Case Files
No command case files are authored yet.
Use [../ROADMAP.md](../ROADMAP.md) for planned case slugs and document progress.
| Case Slug | File | Coverage Note |
| --- | --- | --- |
| `cancel-cancels-single-task` | [cancel-cancels-single-task.md](./cancel-cancels-single-task.md) | cancels one task without implicitly cancelling unrelated tasks in the same run |
| `cancel-cancels-entire-run` | [cancel-cancels-entire-run.md](./cancel-cancels-entire-run.md) | cancels the run and forces every task into the cancelled terminal state |
@@ -0,0 +1,30 @@
# Case: `cancel-cancels-entire-run`
## 用例意义
验证不带 `--task``cancel` 会取消整个运行,并把所有任务推进到 `cancelled`
## 前置条件
- 运行 `run_blog_cancel_001` 已存在
- 该运行下至少有 `T1``T2` 两个任务
- 在执行本用例前,可能已有单任务取消发生
## 输入
```bash
orch --db TMPDIR/coord.db --json cancel --run run_blog_cancel_001 --reason "Stop the run."
orch --db TMPDIR/coord.db --json status --run run_blog_cancel_001
```
## 预期输出
- `cancel` 退出码为 `0`
- `cancel.data.run.status == "cancelled"`
- `status.data.run.status == "cancelled"`
- `status.data.tasks` 中所有任务的 `status` 都为 `cancelled`
## 断言结论
- 运行级取消会级联终止运行下的全部任务
- 该命令是 leader 主动停止整个调度的主入口,而不是只做标记
@@ -0,0 +1,32 @@
# Case: `cancel-cancels-single-task`
## 用例意义
验证 `cancel --task` 只取消指定任务,不会隐式取消同一运行中的其他任务。
## 前置条件
- 已创建运行 `run_blog_cancel_001`
- 已创建任务 `T1``T2`
- `T1` 已完成 `dispatch`
- 已知 `T1` 对应线程为 `THREAD_ID`
## 输入
```bash
orch --db TMPDIR/coord.db --json cancel --run run_blog_cancel_001 --task T1 --reason "Task is no longer needed."
orch --db TMPDIR/coord.db --json status --run run_blog_cancel_001
inbox --db TMPDIR/coord.db --json show --thread THREAD_ID
```
## 预期输出
- `cancel` 退出码为 `0`
- `status``T1.status == "cancelled"`
- `status``T2` 仍保持非 `cancelled` 状态
- `show.data.thread.status == "cancelled"`,指向 `T1` 的原线程
## 断言结论
- 单任务取消是局部控制动作,不会把运行整体终止
- 对已分派任务,取消也会同步终止对应 inbox 线程,避免 worker 继续执行