docs: split inbox test plans into case files
This commit is contained in:
+12
-176
@@ -1,176 +1,12 @@
|
||||
# Inbox `send` Test Plan
|
||||
|
||||
## Scope
|
||||
|
||||
This document covers thread creation and message append behavior exposed by `inbox send`.
|
||||
|
||||
Shared conventions live in [../_shared/README.md](../_shared/README.md).
|
||||
|
||||
## case: send-creates-new-thread
|
||||
|
||||
### 用例意义
|
||||
|
||||
验证 `send` 在未指定既有线程时会创建新线程,并写入首条任务消息。
|
||||
|
||||
### 前置条件
|
||||
|
||||
- 空数据库已完成 `init`
|
||||
|
||||
### 输入
|
||||
|
||||
```bash
|
||||
inbox --db TMPDIR/coord.db --json send --from leader --to worker-a --subject "Implement feature X" --summary "Add retry policy" --body "Implement retry handling for the HTTP client." --run run_blog_001 --task T1
|
||||
```
|
||||
|
||||
### 预期输出
|
||||
|
||||
- 命令退出码为 `0`
|
||||
- 返回 `thread.thread_id`
|
||||
- `thread.status == "pending"`
|
||||
- `thread.created_by == "leader"`
|
||||
- `thread.assigned_to == "worker-a"`
|
||||
- `message.kind == "task"`
|
||||
|
||||
### 断言结论
|
||||
|
||||
- `send` 会新建线程而不是只插入孤立消息
|
||||
- 新线程的默认初始状态是 `pending`
|
||||
|
||||
## case: send-appends-message-to-existing-thread
|
||||
|
||||
### 用例意义
|
||||
|
||||
验证 `send` 在指定既有 `--thread` 时会向原线程追加消息,而不是重建线程。
|
||||
|
||||
### 前置条件
|
||||
|
||||
- 已存在一个由 `leader` 发给 `worker-d` 的线程 `THREAD_ID`
|
||||
|
||||
### 输入
|
||||
|
||||
```bash
|
||||
inbox --db TMPDIR/coord.db --json send --from leader --to worker-d --thread THREAD_ID --summary "Use a markdown editor" --body "Prefer a textarea-based markdown editor for v1."
|
||||
inbox --db TMPDIR/coord.db --json show --thread THREAD_ID
|
||||
```
|
||||
|
||||
### 预期输出
|
||||
|
||||
- `send` 成功,返回的 `thread.thread_id` 仍为 `THREAD_ID`
|
||||
- 线程状态保持原值,不被强制改写为新状态
|
||||
- `show` 可见消息数增加
|
||||
|
||||
### 断言结论
|
||||
|
||||
- 追加消息不会重置线程生命周期
|
||||
- 线程历史按时间顺序保留旧消息与新消息
|
||||
|
||||
## case: send-reads-body-from-body-file
|
||||
|
||||
### 用例意义
|
||||
|
||||
验证 `send --body-file` 会把文件内容写入消息正文。
|
||||
|
||||
### 前置条件
|
||||
|
||||
- `TMPDIR/task.md` 已存在,内容为测试正文
|
||||
|
||||
### 输入
|
||||
|
||||
```bash
|
||||
inbox --db TMPDIR/coord.db --json send --from leader --to worker-d --subject "Build admin editor" --summary "Create the first editor screen" --body-file TMPDIR/task.md
|
||||
inbox --db TMPDIR/coord.db --json show --thread THREAD_ID
|
||||
```
|
||||
|
||||
### 预期输出
|
||||
|
||||
- `send` 成功
|
||||
- `show` 首条消息的 `body` 与文件内容一致
|
||||
|
||||
### 断言结论
|
||||
|
||||
- `body-file` 内容会被原样读取
|
||||
- 该行为与直接传 `--body` 的最终存储结果等价
|
||||
|
||||
## case: send-attaches-artifact-with-metadata
|
||||
|
||||
### 用例意义
|
||||
|
||||
验证 `send` 支持附带 artifact、kind 和 metadata,并可在返回值或后续 `show` 中读取。
|
||||
|
||||
### 前置条件
|
||||
|
||||
- `TMPDIR/task.md` 已存在
|
||||
|
||||
### 输入
|
||||
|
||||
```bash
|
||||
inbox --db TMPDIR/coord.db --json send --from leader --to worker-d --subject "Build admin editor" --summary "Create the first editor screen" --artifact TMPDIR/task.md --artifact-kind brief --artifact-metadata-json '{"label":"task-brief"}'
|
||||
```
|
||||
|
||||
### 预期输出
|
||||
|
||||
- 命令退出码为 `0`
|
||||
- `message.artifacts` 长度为 `1`
|
||||
- artifact `path == "TMPDIR/task.md"`
|
||||
- artifact `kind == "brief"`
|
||||
- artifact `metadata_json.label == "task-brief"`
|
||||
|
||||
### 断言结论
|
||||
|
||||
- `send` 可以在创建消息时持久化附件及其结构化元数据
|
||||
|
||||
## case: send-rejects-invalid-payload-json
|
||||
|
||||
### 用例意义
|
||||
|
||||
验证 `send` 对非法 `--payload-json` 输入给出稳定错误契约。
|
||||
|
||||
### 前置条件
|
||||
|
||||
- 空数据库已完成 `init`
|
||||
|
||||
### 输入
|
||||
|
||||
```bash
|
||||
inbox --db TMPDIR/coord.db --json send --from leader --to worker-z --subject "Invalid payload json" --payload-json not-json
|
||||
```
|
||||
|
||||
### 预期输出
|
||||
|
||||
- 退出码为 `30`
|
||||
- JSON 错误码为 `invalid_input`
|
||||
|
||||
### 断言结论
|
||||
|
||||
- 非法 payload 在写库前就会被拒绝
|
||||
- 错误归类为输入问题,而不是内部错误
|
||||
|
||||
## case: send-rejects-invalid-artifact-metadata-json
|
||||
|
||||
### 用例意义
|
||||
|
||||
验证 `send` 对非法 artifact metadata JSON 给出稳定错误契约。
|
||||
|
||||
### 前置条件
|
||||
|
||||
- 空数据库已完成 `init`
|
||||
|
||||
### 输入
|
||||
|
||||
```bash
|
||||
inbox --db TMPDIR/coord.db --json send --from leader --to worker-z --subject "Invalid artifact json" --artifact TMPDIR/report.md --artifact-metadata-json not-json
|
||||
```
|
||||
|
||||
### 预期输出
|
||||
|
||||
- 退出码为 `30`
|
||||
- JSON 错误码为 `invalid_input`
|
||||
|
||||
### 断言结论
|
||||
|
||||
- artifact metadata 会在写入前校验 JSON 合法性
|
||||
|
||||
## Notes
|
||||
|
||||
- 新建线程时未显式传 `--summary`,会回退到 `--subject`
|
||||
- `--body` 与 `--body-file` 互斥;该约束由 shared 文档统一说明
|
||||
# Inbox `send` Test Plan Index
|
||||
|
||||
## Case Files
|
||||
|
||||
| Case Slug | File | Coverage Note |
|
||||
| --- | --- | --- |
|
||||
| `send-creates-new-thread` | [send-creates-new-thread.md](./send-creates-new-thread.md) | creates a pending thread with an initial task message |
|
||||
| `send-appends-message-to-existing-thread` | [send-appends-message-to-existing-thread.md](./send-appends-message-to-existing-thread.md) | appends a message to an existing non-terminal thread |
|
||||
| `send-reads-body-from-body-file` | [send-reads-body-from-body-file.md](./send-reads-body-from-body-file.md) | reads message body from a file path |
|
||||
| `send-attaches-artifact-with-metadata` | [send-attaches-artifact-with-metadata.md](./send-attaches-artifact-with-metadata.md) | persists artifact path, kind, and metadata on send |
|
||||
| `send-rejects-invalid-payload-json` | [send-rejects-invalid-payload-json.md](./send-rejects-invalid-payload-json.md) | rejects malformed payload JSON with `invalid_input` |
|
||||
| `send-rejects-invalid-artifact-metadata-json` | [send-rejects-invalid-artifact-metadata-json.md](./send-rejects-invalid-artifact-metadata-json.md) | rejects malformed artifact metadata JSON |
|
||||
|
||||
Reference in New Issue
Block a user