Files
Agent-System/.doc/system-design/2026-09-25-doc-review-lifecycle-design.md
weichen b5a782bb38 feat(chat): dialogue triggers for comments/reopen/pending-supplements with mistouch guards
Wire intent→coordinator DocResolver confirm cards→action_executor kinds for comment, reopen, pending-supplements query, and real submit-review execution.
2026-09-25 20:14:10 +00:00

67 lines
2.7 KiB
Markdown
Raw Permalink 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.
# 受控文档三权流转控制完善(审核/批准/归档/重开 + 锁定期补充消化)
> 落地版 · `task_id=doc-review-lifecycle-2026-09-25` · 2026-09-25
## 1. 目标
在既有四态状态机(`drafting→reviewing→approving→approved`)上补齐四条缺口,不重造状态机:
| ID | 缺口 | 处理 |
|---|---|---|
| G1 | 锁定期补充误生成提案后卡死 | 积压账本 + `skipped_locked` |
| G2 | 职责人流转零通知 | 生命周期事件 + 收件人按槽位路由 |
| G3 | 批注不落库 / 权限过宽 | 阶段化矩阵 + resolve API + 前端落库 |
| G4 | 重开无 UI / 审批人仅创建人 | Approver 优先 + 创建人兜底 + 前端入口 |
## 2. 状态机(语义不变,正交积压)
```mermaid
stateDiagram-v2
drafting --> reviewing : submit_review
reviewing --> approving : review_approve
reviewing --> drafting : review_reject
approving --> approved : approver_approve
approving --> reviewing : approver_reject
approving --> drafting : approver_reject
approved --> drafting : reopen_approve
```
积压表 `document_pending_supplements`(goose `00073`)独立于 `document_records` 状态列。回 drafting 时 `DigestPendingOnReturnToDrafting` 标记 digested 并通知 author。
## 3. 锁定期补充闭环
1. `CreateFromSupplement`:`LockedSnapshot = IsLocked || state != drafting`;`BusySnapshot` 仍为编辑租约。
2. `Decide`:锁定项 → `OutcomeSkippedLocked` + `PendingLedger.Record` + 知会当前职责人(reviewing→reviewer,approving/approved→approver,缺位→author)。
3. 回 drafting(驳回/重开)→ 消化积压 + `pending_supplements` digest。
## 4. 流转通知收件人
| 事件 | 收件人 |
|---|---|
| `document.review_requested` | ReviewerID |
| `document.approval_requested` | ApproverID |
| `document.rejected` / `reopened` / `pending_supplements` | AuthorID |
| `document.approved` | AuthorID |
`docnotify.RecipientForDocEvent` 统一解析;lifecycle hook 在 `SubmitForReview` / `Review*` / `Approver*` / `ReopenForRevision` 成功后触发。
## 5. 批注权限矩阵
| 状态 | 可新增批注 |
|---|---|
| drafting | author, reviewer |
| reviewing | reviewer, author(回应) |
| approving | approver, reviewer |
| approved | 禁止新增(`ErrDocumentLocked`) |
| viewer | 恒只读 |
`POST /api/v1/docgov/comments/{id}/resolve`:author 在 drafting 可 resolved;reviewer 可 reopen。
## 6. 重开审批
`handleProjectTraceReopenApprove`:文档 `ApproverID` 且成员仍 active → 可批;全部批准人缺位/退出 → 项目创建人兜底。前端 approved 态提供「申请再修订」。
## 7. 明确不做
- 不新增第五状态、不改 `IsLocked` 语义、不引入批量审批委托、不动 FAV 归档链路。