feat(shipping-process-gates): 落地全门禁中断恢复并消除双真相
纳入 Execution/Gate/Attempt 模型与迁移、Worker/API/前端恢复卡片与 Admin 诊断, Gate 阻断时清零旧 action_buttons,异常摘要统一脱敏,并为运维筛选与 Attempt Diff 补齐入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b352c281d5
commit
323928626b
92 files changed
+11930
-458
No files matched your search
@@ -215,6 +215,12 @@ L1 字段级:目标单元格 + 表头 + 相邻单元格
|
||||
|
||||
**目标**:不新增第二套模板库或复核工作台,在现有对话、任务中心、复核工作台、模板模块和审计中心中承载新能力。
|
||||
|
||||
**复核重识别闭环(2026-07-31)**:重新识别不建立独立进度模型,前端按既有 WorkflowItem 的 `layout_parsing / extracting / pending_review / reparse_failed` 权威状态轮询;仅展示不确定阶段,不根据耗时伪造百分比。新版 `current_run_no + current_case_no` 形成后自动加载,手工“跳转当前版本”也必须先刷新 Item。坐标模板路由中,`line_layouts` 是物理子布局描述而非必需消费行数;只有模板明确 `allow_cross_page=true` 的固定子行模式才能暂存跨页 carry,完整自适应订单行不得因此被丢弃。成功模板匹配必须把 Profile 身份传给 Route Decision,保证“实际使用”审计可追溯。
|
||||
|
||||
**邮件补充重建规则(2026-07-31)**:邮件表头只能按当前 Run 冻结 Schema 的显式别名映射;行级 `reservation_id` 包含真实业务表头 `External reservation ID`。只要 Intake 保留原始 `body_html_tables`,Run 冻结时必须按自己的 Schema 重新解析完整补充表,不能复用上传阶段缺字段但已有部分行的旧结果;没有 HTML 时才复用已有完整结果或安全回退纵向纯文本解析。
|
||||
|
||||
**`llm_extraction` 回退语义(2026-08-01)**:订单字段标记为 `llm_extraction` 表示“确定性解析无法取值时允许 LLM 补充”,不表示必须使用 LLM。通用解析门禁应依据字段是否已有完整、无冲突的确定性证据裁决;已取得必填 Header/Line 值时可直通,缺失时由 `required_field_missing` 转入 LLM/人工复核。
|
||||
|
||||
验收标准:四语言文案完整;前端 `npm run build` 通过;业务按钮只消费后端允许动作;对象版本冲突可见;普通用户无法进入模板治理或全局审计;页面不展示虚假百分比或内部 Workflow/Job/Provider 细节。
|
||||
|
||||
### 6. 核心页面位置与框线原型
|
||||
@@ -1650,12 +1656,9 @@ SHIPPING_NOTICE_CHAT_DIFY_API_KEY=
|
||||
SHIPPING_NOTICE_CHAT_DIFY_BASE=http://192.168.100.192:8882/v1
|
||||
```
|
||||
|
||||
### 1.3 注册 Agent 记录
|
||||
### 1.3 配置 Agent 记录
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
python seed_shipping_notice_agents.py
|
||||
```
|
||||
货代发货通知 Agent 由管理端手工创建和维护。配置完成后填写本节的 Dify Chatflow 环境变量;不使用种子脚本写入或覆盖 Agent 记录。
|
||||
|
||||
### 1.4 Mock RPA(开发)
|
||||
|
||||
@@ -2427,6 +2430,43 @@ pytest tests/test_shipping_notice_state_machine.py tests/test_shipping_notice_ui
|
||||
- `order_build_eligibility_service` 在 Draft 校验与确认前投影行级候选;人工选择须填写原因且库存源已启用。
|
||||
- API:`PUT .../order-review-cases/{case_no}/draft/lines/{line_key}/inventory-candidates`;Draft 投影含 `build_eligibility`。
|
||||
|
||||
### 门禁恢复阶段 0:库存源路由独立重算(2026-07-31)
|
||||
|
||||
- **目标**:在不重新识别 PDF 的前提下,按最新已发布路由规则与最新库存源启停/解析 Profile 状态重算建单前库存源候选(典型:`DBS SIN` 线索命中已停用源后的恢复)。
|
||||
- **投影分层**:
|
||||
- `raw_rule_source_codes`:规则原始候选;
|
||||
- `unavailable_source_codes`:停用、不存在或无已发布解析 Profile 的源;
|
||||
- `candidate_inventory_source_codes`:当前有效结果;
|
||||
- `rule_suggestion*`:最新规则建议(含 `rule_versions` / `matched_rules`)。
|
||||
- **人工决定优先级**:
|
||||
- 人工指定结果优先于自动规则结果;
|
||||
- `POST .../draft/inventory-routing/reroute` 只生成/刷新建议,不静默覆盖人工决定;
|
||||
- 用户显式 `adopt-suggestion` 后才替换有效结果;
|
||||
- `keep-manual` 明确保留人工值并清除 `suggestion_pending`;
|
||||
- 无人工决定且规则唯一可用命中时,建议直接成为有效结果。
|
||||
- **API**:
|
||||
- `POST .../draft/inventory-routing/reroute`(可选 `line_key`、`idempotency_key`)
|
||||
- `POST .../draft/lines/{line_key}/inventory-routing/adopt-suggestion`
|
||||
- `POST .../draft/lines/{line_key}/inventory-routing/keep-manual`
|
||||
- **审计**:`inventory_routing_*` 事件写入操作人、规则版本、前后候选与幂等键;同一幂等键只产生一次有效副作用;409 版本冲突不执行副作用。
|
||||
- **前端**:复核台 `ReviewInventoryCandidatesPanel` 提供「重新匹配路由 / 采用规则结果 / 保留人工结果」。
|
||||
|
||||
### 门禁恢复阶段 1:契约冻结(2026-07-31)
|
||||
|
||||
- **范围**:冻结 19 个业务门禁编码、状态、恢复动作、责任方、依赖失效图、审计事件与快照键;前后端类型对齐。
|
||||
- **代码源**:`process_gate_contract.py`、`process_gate_dependency.py`、`progress_audit_contract.PROCESS_GATE_AUDIT_EVENT_TYPES`、前端 `ShippingProcessGate*` 联合类型。
|
||||
- **权威契约**:[process-gate-recovery-contract.md](./process-gate-recovery-contract.md)。
|
||||
- **非范围**:本阶段不接线 Execution/Gate/Attempt 持久化、统一恢复 API、Worker 租约或页面改造(后续阶段)。
|
||||
|
||||
### 门禁恢复阶段 1.5:语义统一与错误阻断修复(2026-08-01)
|
||||
|
||||
- **目标**:在 Phase 3 接线前修正阻断真相,防止错误状态写入 Execution/Gate/Attempt。
|
||||
- **字段阻断资格**:仅 `required=true` 或 `auto_create_key_field=true` 可因字段质量进入 `blocked_fields`;可选非关键字段证据不足只生成 `severity=diagnostic` Finding。
|
||||
- **Candidate 冲突**:只投影最终 `blocked_fields` 对应 Decision;派生成功后的 `line_no` 不得再带出派生前 `evidence_missing`。
|
||||
- **原因唯一归属**:`PROCESS_GATE_REASON_OWNING_GATE`;自动冻结资格/客户范围/场景/紧急停止统一归属 `order_freeze_readiness`。
|
||||
- **旧五门禁**:内部仍评估 `can_auto_create`,但禁止 `auto_build_gate_*` 平行用户阻断;用户可见最多一条「自动建单策略尚未放行」。
|
||||
- **投影**:`process_gate_projection` 分离用户安全投影与管理员诊断投影;`ui_state` / Workflow 提示优先消费统一 Gate 摘要。
|
||||
|
||||
### STP 阶段 3:自动建单与复核工作台(2026-07-30)
|
||||
|
||||
- 抽取收尾 `maybe_stp_auto_create_for_run`:无人工改脏且资格 ready 时幂等自动建单并 `auto_progress`。
|
||||
@@ -2616,7 +2656,6 @@ API 层
|
||||
|
||||
- `frontend/src/features/chat/shipping/*` — 聊天上传、会话摘要与订单抽取通知
|
||||
- `frontend/src/features/workspace/shipping-task-center/*` — 我的待办与任务处理工作台
|
||||
- `backend/seed_shipping_notice_agents.py` — Agent 注册
|
||||
- `backend/scripts/export_shipping_notice_openapi.py` — OpenAPI 导出
|
||||
- `docs/features/shipping-notice/technical.md` — 手动配置主文档
|
||||
|
||||
@@ -2635,7 +2674,6 @@ API 层
|
||||
| `backend/tests/test_shipping_notice_inventory_schedule.py` | 定时批量库存 RPA 排程 executor 单测 |
|
||||
| `backend/tests/test_shipping_notice_match_summary.py` | 匹配摘要相关测试 |
|
||||
| `scripts/rpa/freight_rpa_worker.py` | 开发态 RPA worker(支持单条/批量 inventory_export) |
|
||||
| `seed_shipping_notice_agents.py` | Agent 注册脚本 |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user