1.2 KiB
1.2 KiB
Case: fetch-unread-uses-read-cursor
用例意义
验证 fetch --unread 基于 agent 的 read cursor 计算未读,而不是仅按线程是否存在新消息。
前置条件
leader已向worker-e发送一个pending线程THREAD_ID
输入
inbox --db TMPDIR/coord.db --json fetch --agent worker-e --status pending --unread
inbox --db TMPDIR/coord.db --agent worker-e --json show --thread THREAD_ID --mark-read
inbox --db TMPDIR/coord.db --json fetch --agent worker-e --status pending --unread
inbox --db TMPDIR/coord.db --json send --from leader --to worker-e --thread THREAD_ID --summary "Use sentence case" --body "Keep the nav labels in sentence case."
inbox --db TMPDIR/coord.db --json fetch --agent worker-e --status pending --unread
预期输出
- 第一次
fetch --unread返回该线程 show --mark-read后,第二次fetch --unread无匹配结果- 新消息追加后,第三次
fetch --unread再次返回该线程
断言结论
- 未读判断依赖
thread_reads.last_read_message_id - 新消息到达会让同线程重新进入未读结果集
补充约束
- 使用
--unread时必须具备 agent 身份,否则会返回invalid_input