feat(shipping_notice): 支持客户 ODM 白名单与整单 ODM 选择收敛导出
- 客户主数据新增 odm_ids 白名单字段(含 Alembic 迁移),表单与管理端支持维护 - 导出库存命中行按客户白名单与整单 ODM 裁决收敛,新增 notice_odm_choice_service - 工作台新增 odm-options / odm-choice 接口,投影行级候选并持久化用户选择 - 修复复核工作台跨 Run 切换时接收解析上下文残留 - 同步四语言 i18n、测试用例、funclist 与 shipping-notice 技术文档
This commit is contained in:
1 parent
a032354cb9
commit
d396371020
51 files changed
+2717
-109
No files matched your search
@@ -0,0 +1,667 @@
|
||||
# 订单队列图标语义重映射 + needs_attention 标志 实现计划
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 队列行内图标收敛为五态语义(需人工⚠/进行中🔄/终态✓/失败✗/中性○),后端队列下发 `needs_attention` 门禁阻塞标志,summary 计数同口径对齐。
|
||||
|
||||
**Architecture:** 后端在既有批量 Gate 缓存上新增只读判定函数(零额外 SQL),`_serialize_review_case_summary` 增量输出字段;前端单组件重写 `navIconKind` 优先级链并新增 LoaderCircle 分支。无迁移、无接口破坏性变更。
|
||||
|
||||
**Tech Stack:** Flask + SQLAlchemy 2.0(后端);Vue 3 `<script setup>` + lucide-vue-next + vitest(前端);pytest(后端测试)。
|
||||
|
||||
**Spec:** `docs/superpowers/specs/2026-09-16-review-queue-icon-semantics-design.md`
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- 🚫 **禁止自动 commit**(用户强规则,覆盖本 skill 模板的提交步骤):每个任务只落盘 + 跑验证,最后统一停在"完成、未提交"状态;仅当用户当轮明确说提交时才 `git add <具体文件>` + commit。
|
||||
- 外科手术式改动:只改本计划列出的文件与位置;不顺手改注释/格式/相邻代码。
|
||||
- 无数据库迁移;无新增第三方依赖;不改既有字段语义(`status`/`issue_count`/`lifecycle_stage` 原样保留)。
|
||||
- 验证基线:改动文件对应测试通过 + `cd frontend && npm run build` 通过(Task 4 统一回归)。
|
||||
- 注释遵循 AGENTS.md §5:新增函数带含 Args/Returns 的 docstring;逻辑变化同步更新受影响注释。
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 后端 `needs_attention` 字段
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/app/services/shipping_notice/order_review_projection.py`(在 `_queue_current_gate_hint` 之后、`_serialize_review_case_summary` 之前插入辅助函数;在 `_serialize_review_case_summary` 返回 dict 增加一行)
|
||||
- Test: `backend/tests/test_shipping_order_review_service.py`(文件末尾追加 3 个测试)
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: 会话级缓存 `shipping_conversation_projection_read_cache` 中的 `execution_by_case_id` / `gates_by_execution_id`(`_load_review_case_summary_batch` 已预取,`:1333-1355`)。
|
||||
- Produces: 队列 item 新增 `'needs_attention': bool`(`serialize_review_queue` 与 `serialize_review_run` 的 items 均携带);模块级函数 `_queue_gate_needs_attention(case: ShippingOrderReviewCase) -> bool`,Task 2 依赖该字段。
|
||||
|
||||
- [ ] **Step 1: 追加失败测试**
|
||||
|
||||
在 `backend/tests/test_shipping_order_review_service.py` 文件末尾追加(fixture 写法仿照同文件 `test_review_queue_falls_back_to_process_gate_when_ot_stage_is_legacy_step`,`:351-406`):
|
||||
|
||||
```python
|
||||
def test_review_queue_flags_blocked_gate_cases_as_needs_attention(app):
|
||||
"""门禁 blocked_manual(如库存缺口)的已建任务单,队列必须下发 needs_attention=True。"""
|
||||
from app.models import ShippingProcessExecution, ShippingProcessGate
|
||||
|
||||
with app.app_context():
|
||||
user, agent, session, intake, document = _seed_run_input(suffix='REVIEW-QUEUE-NEEDS-ATTN')
|
||||
run = _materialized_run(user=user, agent=agent, session=session, intake=intake)
|
||||
candidate = ShippingOrderCandidate(
|
||||
candidate_no='CAND-REVIEW-QUEUE-NEEDS-ATTN',
|
||||
intake_id=intake.id,
|
||||
primary_document_id=document.id,
|
||||
candidate_key='review-queue-needs-attn',
|
||||
order_extraction_run_id=run.id,
|
||||
po_number='PO-QUEUE-ATTN',
|
||||
)
|
||||
db.session.add(candidate)
|
||||
db.session.flush()
|
||||
case = ensure_review_case_for_unit(run=run, unit=run.extraction_plan.units[0])
|
||||
task = ShippingOrderTask(
|
||||
task_no='OT-REVIEW-QUEUE-NEEDS-ATTN',
|
||||
user_id=user.id,
|
||||
conversation_id=session.session_id,
|
||||
extraction_run_id=run.id,
|
||||
status='processing',
|
||||
stage='inventory_preparation',
|
||||
)
|
||||
db.session.add(task)
|
||||
db.session.flush()
|
||||
execution = ShippingProcessExecution(
|
||||
execution_no='SPE-REVIEW-QUEUE-NEEDS-ATTN',
|
||||
task_id=task.id,
|
||||
review_case_id=case.id,
|
||||
status='active',
|
||||
current_gate_code='inventory_sufficiency',
|
||||
)
|
||||
db.session.add(execution)
|
||||
db.session.flush()
|
||||
db.session.add(ShippingProcessGate(
|
||||
execution_id=execution.id,
|
||||
gate_code='inventory_sufficiency',
|
||||
sequence_no=16,
|
||||
status='blocked_manual',
|
||||
))
|
||||
task.active_process_execution_id = execution.id
|
||||
case.status = 'confirmed'
|
||||
case.confirmed_task_id = task.id
|
||||
db.session.commit()
|
||||
|
||||
item = serialize_review_queue([run])['items'][0]
|
||||
|
||||
# 关键断言:库存缺口类门禁阻塞必须在队列可见,不再只依赖当前单的完整详情。
|
||||
assert item['needs_attention'] is True
|
||||
assert item['lifecycle_stage'] == 'fulfillment_prep'
|
||||
|
||||
|
||||
def test_review_queue_waiting_external_gate_is_not_needs_attention(app):
|
||||
"""RPA 外部等待(waiting_external)属于系统在办,不得标记 needs_attention。"""
|
||||
from app.models import ShippingProcessExecution, ShippingProcessGate
|
||||
|
||||
with app.app_context():
|
||||
user, agent, session, intake, document = _seed_run_input(suffix='REVIEW-QUEUE-WAIT-EXT')
|
||||
run = _materialized_run(user=user, agent=agent, session=session, intake=intake)
|
||||
candidate = ShippingOrderCandidate(
|
||||
candidate_no='CAND-REVIEW-QUEUE-WAIT-EXT',
|
||||
intake_id=intake.id,
|
||||
primary_document_id=document.id,
|
||||
candidate_key='review-queue-wait-ext',
|
||||
order_extraction_run_id=run.id,
|
||||
po_number='PO-QUEUE-WAIT',
|
||||
)
|
||||
db.session.add(candidate)
|
||||
db.session.flush()
|
||||
case = ensure_review_case_for_unit(run=run, unit=run.extraction_plan.units[0])
|
||||
task = ShippingOrderTask(
|
||||
task_no='OT-REVIEW-QUEUE-WAIT-EXT',
|
||||
user_id=user.id,
|
||||
conversation_id=session.session_id,
|
||||
extraction_run_id=run.id,
|
||||
status='processing',
|
||||
stage='freight_uploading',
|
||||
)
|
||||
db.session.add(task)
|
||||
db.session.flush()
|
||||
execution = ShippingProcessExecution(
|
||||
execution_no='SPE-REVIEW-QUEUE-WAIT-EXT',
|
||||
task_id=task.id,
|
||||
review_case_id=case.id,
|
||||
status='waiting_external',
|
||||
current_gate_code='freight_upload_rpa',
|
||||
)
|
||||
db.session.add(execution)
|
||||
db.session.flush()
|
||||
db.session.add(ShippingProcessGate(
|
||||
execution_id=execution.id,
|
||||
gate_code='freight_upload_rpa',
|
||||
sequence_no=18,
|
||||
status='waiting_external',
|
||||
))
|
||||
task.active_process_execution_id = execution.id
|
||||
case.status = 'confirmed'
|
||||
case.confirmed_task_id = task.id
|
||||
db.session.commit()
|
||||
|
||||
item = serialize_review_queue([run])['items'][0]
|
||||
|
||||
# 关键断言:外部等待是在办不是待办,图标应走进行中而非需人工。
|
||||
assert item['needs_attention'] is False
|
||||
|
||||
|
||||
def test_review_queue_without_execution_is_not_needs_attention(app):
|
||||
"""已建任务但尚无 Execution(或缓存未命中)时,needs_attention 必须为 False。"""
|
||||
with app.app_context():
|
||||
user, agent, session, intake, document = _seed_run_input(suffix='REVIEW-QUEUE-NO-EXEC')
|
||||
run = _materialized_run(user=user, agent=agent, session=session, intake=intake)
|
||||
candidate = ShippingOrderCandidate(
|
||||
candidate_no='CAND-REVIEW-QUEUE-NO-EXEC',
|
||||
intake_id=intake.id,
|
||||
primary_document_id=document.id,
|
||||
candidate_key='review-queue-no-exec',
|
||||
order_extraction_run_id=run.id,
|
||||
po_number='PO-QUEUE-NOEXEC',
|
||||
)
|
||||
db.session.add(candidate)
|
||||
db.session.flush()
|
||||
case = ensure_review_case_for_unit(run=run, unit=run.extraction_plan.units[0])
|
||||
task = ShippingOrderTask(
|
||||
task_no='OT-REVIEW-QUEUE-NO-EXEC',
|
||||
user_id=user.id,
|
||||
conversation_id=session.session_id,
|
||||
extraction_run_id=run.id,
|
||||
status='processing',
|
||||
stage='inventory_preparation',
|
||||
)
|
||||
db.session.add(task)
|
||||
db.session.flush()
|
||||
case.status = 'confirmed'
|
||||
case.confirmed_task_id = task.id
|
||||
db.session.commit()
|
||||
|
||||
item = serialize_review_queue([run])['items'][0]
|
||||
|
||||
# 关键断言:无门禁事实时不臆造需人工标志。
|
||||
assert item['needs_attention'] is False
|
||||
```
|
||||
|
||||
若文件顶部 import 缺少 `ShippingOrderCandidate` / `ShippingOrderTask` / `ensure_review_case_for_unit` / `db`,按同文件既有测试的 import 方式补齐(它们已在既有测试中使用,通常已在顶部导入)。
|
||||
|
||||
- [ ] **Step 2: 运行验证测试失败**
|
||||
|
||||
Run: `cd backend && source venv/bin/activate && python -m pytest tests/test_shipping_order_review_service.py::test_review_queue_flags_blocked_gate_cases_as_needs_attention -v`
|
||||
Expected: FAIL,`KeyError: 'needs_attention'`
|
||||
|
||||
- [ ] **Step 3: 实现辅助函数与字段**
|
||||
|
||||
3a. 在 `order_review_projection.py` 的 `_queue_current_gate_hint` 函数结束(`:1065` 的 `return None`)与 `_serialize_review_case_summary`(`:1068`)之间插入:
|
||||
|
||||
```python
|
||||
# 队列当前 Gate 活跃口径:在 _queue_current_gate_hint 活跃集合上补 queued/failed_terminal,
|
||||
# 供 needs_attention 兜底取 Gate,避免终态失败的单被漏判。
|
||||
_QUEUE_CURRENT_GATE_STATUSES = frozenset({
|
||||
'pending', 'queued', 'running', 'blocked_retryable', 'blocked_manual', 'waiting_external', 'failed_terminal',
|
||||
})
|
||||
# 需要人工介入的 Gate 状态;waiting_external/running/pending/queued 属系统在办,不算需人工。
|
||||
_QUEUE_ATTENTION_GATE_STATUSES = frozenset({'blocked_manual', 'blocked_retryable', 'failed_terminal'})
|
||||
|
||||
|
||||
def _queue_gate_needs_attention(case: ShippingOrderReviewCase) -> bool:
|
||||
"""
|
||||
判定 Case 当前正式门禁是否需要人工介入;供队列摘要下发 needs_attention。
|
||||
|
||||
只读会话级批量缓存(_load_review_case_summary_batch 已预取 Execution/Gate),
|
||||
零额外 SQL;当前 Gate 取 execution.current_gate_code 对应 Gate,缺失时按
|
||||
sequence_no 取第一个活跃 Gate。调用方禁止据此之外再自行推断阻塞。
|
||||
|
||||
Args:
|
||||
case: 当前复核 Case。
|
||||
|
||||
Returns:
|
||||
当前 Gate 状态 ∈ {blocked_manual, blocked_retryable, failed_terminal} 时 True;
|
||||
无 Execution / 无活跃 Gate 时 False。
|
||||
"""
|
||||
cache = db.session.info.get('shipping_conversation_projection_read_cache')
|
||||
if not isinstance(cache, dict) or getattr(case, 'id', None) is None:
|
||||
return False
|
||||
execution = (cache.get('execution_by_case_id') or {}).get(int(case.id))
|
||||
if execution is None:
|
||||
return False
|
||||
gate_code = str(getattr(execution, 'current_gate_code', None) or '').strip().lower()
|
||||
gates = (cache.get('gates_by_execution_id') or {}).get(int(execution.id), []) or []
|
||||
current = None
|
||||
if gate_code:
|
||||
for gate in gates:
|
||||
if str(getattr(gate, 'gate_code', '') or '').strip().lower() == gate_code:
|
||||
current = gate
|
||||
break
|
||||
if current is None:
|
||||
for gate in gates:
|
||||
if str(getattr(gate, 'status', '') or '').strip().lower() in _QUEUE_CURRENT_GATE_STATUSES:
|
||||
current = gate
|
||||
break
|
||||
if current is None:
|
||||
return False
|
||||
return str(getattr(current, 'status', '') or '').strip().lower() in _QUEUE_ATTENTION_GATE_STATUSES
|
||||
```
|
||||
|
||||
3b. 在 `_serialize_review_case_summary` 返回 dict 中,`'issue_count': len(draft.issue_summary_json or []) if draft is not None else 0,`(`:1159`)之后插入一行:
|
||||
|
||||
```python
|
||||
'needs_attention': _queue_gate_needs_attention(case),
|
||||
```
|
||||
|
||||
- [ ] **Step 4: 运行新测试通过**
|
||||
|
||||
Run: `cd backend && source venv/bin/activate && python -m pytest tests/test_shipping_order_review_service.py -v -k "needs_attention"`
|
||||
Expected: 3 passed
|
||||
|
||||
- [ ] **Step 5: 跑整个测试文件防回归**
|
||||
|
||||
Run: `cd backend && source venv/bin/activate && python -m pytest tests/test_shipping_order_review_service.py -v`
|
||||
Expected: 全部 passed(既有测试只断言 `lifecycle_stage`,不受新字段影响)
|
||||
|
||||
---
|
||||
|
||||
### Task 2: 后端 summary 计数对齐
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/app/services/shipping_notice/order_review_projection.py`(`serialize_review_queue` 前插入归类函数;替换 `:1447-1452` 的 counts 块)
|
||||
- Test: `backend/tests/test_shipping_order_review_service.py`(追加 2 个测试)
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: Task 1 的 item 字段 `needs_attention`。
|
||||
- Produces: 模块级函数 `_queue_summary_bucket(item: dict[str, Any]) -> str`(返回 `'needs_action' | 'processing' | 'completed'`);`serialize_review_queue` 返回的 `summary` 三桶新口径。
|
||||
|
||||
- [ ] **Step 1: 追加失败测试**
|
||||
|
||||
```python
|
||||
def test_review_queue_summary_counts_terminal_stage_as_completed(app):
|
||||
"""OT.stage=completed(通知完成)的已建任务单计入 completed,不再计入 processing。"""
|
||||
with app.app_context():
|
||||
user, agent, session, intake, document = _seed_run_input(suffix='REVIEW-QUEUE-SUM-DONE')
|
||||
run = _materialized_run(user=user, agent=agent, session=session, intake=intake)
|
||||
candidate = ShippingOrderCandidate(
|
||||
candidate_no='CAND-REVIEW-QUEUE-SUM-DONE',
|
||||
intake_id=intake.id,
|
||||
primary_document_id=document.id,
|
||||
candidate_key='review-queue-sum-done',
|
||||
order_extraction_run_id=run.id,
|
||||
po_number='PO-QUEUE-SUMDONE',
|
||||
)
|
||||
db.session.add(candidate)
|
||||
db.session.flush()
|
||||
case = ensure_review_case_for_unit(run=run, unit=run.extraction_plan.units[0])
|
||||
task = ShippingOrderTask(
|
||||
task_no='OT-REVIEW-QUEUE-SUM-DONE',
|
||||
user_id=user.id,
|
||||
conversation_id=session.session_id,
|
||||
extraction_run_id=run.id,
|
||||
status='processing',
|
||||
stage='completed',
|
||||
)
|
||||
db.session.add(task)
|
||||
db.session.flush()
|
||||
case.status = 'confirmed'
|
||||
case.confirmed_task_id = task.id
|
||||
db.session.commit()
|
||||
|
||||
summary = serialize_review_queue([run])['summary']
|
||||
|
||||
# 关键断言:summary 与五态图标同口径——confirmed+终态=completed 而非 processing。
|
||||
assert summary['total'] == 1
|
||||
assert summary['completed'] == 1
|
||||
assert summary['processing'] == 0
|
||||
assert summary['needs_action'] == 0
|
||||
|
||||
|
||||
def test_review_queue_summary_counts_quality_issue_as_needs_action(app):
|
||||
"""quality_issue(文件质量异常)从 completed 改归 needs_action,与黄⚠图标一致。"""
|
||||
with app.app_context():
|
||||
user, agent, session, intake, document = _seed_run_input(suffix='REVIEW-QUEUE-SUM-QI')
|
||||
run = _materialized_run(user=user, agent=agent, session=session, intake=intake)
|
||||
candidate = ShippingOrderCandidate(
|
||||
candidate_no='CAND-REVIEW-QUEUE-SUM-QI',
|
||||
intake_id=intake.id,
|
||||
primary_document_id=document.id,
|
||||
candidate_key='review-queue-sum-qi',
|
||||
order_extraction_run_id=run.id,
|
||||
po_number='PO-QUEUE-SUMQI',
|
||||
)
|
||||
db.session.add(candidate)
|
||||
db.session.flush()
|
||||
case = ensure_review_case_for_unit(run=run, unit=run.extraction_plan.units[0])
|
||||
case.status = 'quality_issue'
|
||||
db.session.commit()
|
||||
|
||||
summary = serialize_review_queue([run])['summary']
|
||||
|
||||
# 关键断言:质量异常是待办不是完成。
|
||||
assert summary['needs_action'] == 1
|
||||
assert summary['completed'] == 0
|
||||
assert summary['processing'] == 0
|
||||
|
||||
|
||||
def test_review_queue_summary_counts_plain_confirmed_as_processing(app):
|
||||
"""已建任务、无阻塞、非终态的 confirmed 单计入 processing(对应转圈图标)。"""
|
||||
with app.app_context():
|
||||
user, agent, session, intake, document = _seed_run_input(suffix='REVIEW-QUEUE-SUM-PROC')
|
||||
run = _materialized_run(user=user, agent=agent, session=session, intake=intake)
|
||||
candidate = ShippingOrderCandidate(
|
||||
candidate_no='CAND-REVIEW-QUEUE-SUM-PROC',
|
||||
intake_id=intake.id,
|
||||
primary_document_id=document.id,
|
||||
candidate_key='review-queue-sum-proc',
|
||||
order_extraction_run_id=run.id,
|
||||
po_number='PO-QUEUE-SUMPROC',
|
||||
)
|
||||
db.session.add(candidate)
|
||||
db.session.flush()
|
||||
case = ensure_review_case_for_unit(run=run, unit=run.extraction_plan.units[0])
|
||||
task = ShippingOrderTask(
|
||||
task_no='OT-REVIEW-QUEUE-SUM-PROC',
|
||||
user_id=user.id,
|
||||
conversation_id=session.session_id,
|
||||
extraction_run_id=run.id,
|
||||
status='processing',
|
||||
stage='inventory_preparation',
|
||||
)
|
||||
db.session.add(task)
|
||||
db.session.flush()
|
||||
case.status = 'confirmed'
|
||||
case.confirmed_task_id = task.id
|
||||
db.session.commit()
|
||||
|
||||
summary = serialize_review_queue([run])['summary']
|
||||
|
||||
# 关键断言:已创建任务是在办不是完成。
|
||||
assert summary['processing'] == 1
|
||||
assert summary['completed'] == 0
|
||||
assert summary['needs_action'] == 0
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 运行验证测试失败**
|
||||
|
||||
Run: `cd backend && source venv/bin/activate && python -m pytest tests/test_shipping_order_review_service.py -v -k "summary_counts"`
|
||||
Expected: 3 FAILED(terminal 单被计入 processing;quality_issue 被计入 completed;plain confirmed 被计入 completed)
|
||||
|
||||
- [ ] **Step 3: 实现归类函数并替换 counts**
|
||||
|
||||
3a. 在 `serialize_review_queue`(`:1380`)定义之前插入:
|
||||
|
||||
```python
|
||||
def _queue_summary_bucket(item: dict[str, Any]) -> str:
|
||||
"""
|
||||
队列计数桶归类;优先级与前端队列图标一致:需人工 > 终态完成 > 进行中。
|
||||
|
||||
桶是"处置去向"粗归类,与五态图标非一一映射(non_order 计入 completed,
|
||||
图标为中性别灰○);needs_attention(门禁阻塞)恒优先于 completed,
|
||||
避免阻塞单被计数成"完成"。
|
||||
|
||||
Args:
|
||||
item: 队列 item 投影(含 status / needs_attention / lifecycle_stage)。
|
||||
|
||||
Returns:
|
||||
'needs_action' | 'completed' | 'processing'。
|
||||
"""
|
||||
status = str(item.get('status') or '')
|
||||
if status in ('unreviewed', 'draft', 'ready', 'quality_issue') or item.get('needs_attention'):
|
||||
return 'needs_action'
|
||||
if status in ('non_order', 'closed', 'completed') or str(item.get('lifecycle_stage') or '') == 'upload_complete':
|
||||
return 'completed'
|
||||
return 'processing'
|
||||
```
|
||||
|
||||
3b. 将 `serialize_review_queue` 末尾的 counts 块(原 `:1447-1452`):
|
||||
|
||||
```python
|
||||
counts = {
|
||||
'total': len(items),
|
||||
'needs_action': sum(1 for item in items if item['status'] in ('unreviewed', 'draft', 'ready')),
|
||||
'processing': sum(1 for item in items if item['status'] in ('confirming', 'reparse_pending')),
|
||||
'completed': sum(1 for item in items if item['status'] in ('confirmed', 'non_order', 'quality_issue')),
|
||||
}
|
||||
```
|
||||
|
||||
替换为:
|
||||
|
||||
```python
|
||||
buckets = [_queue_summary_bucket(item) for item in items]
|
||||
counts = {
|
||||
'total': len(items),
|
||||
'needs_action': buckets.count('needs_action'),
|
||||
'processing': buckets.count('processing'),
|
||||
'completed': buckets.count('completed'),
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 4: 运行新测试通过**
|
||||
|
||||
Run: `cd backend && source venv/bin/activate && python -m pytest tests/test_shipping_order_review_service.py -v -k "summary_counts or needs_attention"`
|
||||
Expected: 6 passed
|
||||
|
||||
- [ ] **Step 5: 跑整个测试文件防回归**
|
||||
|
||||
Run: `cd backend && source venv/bin/activate && python -m pytest tests/test_shipping_order_review_service.py -v`
|
||||
Expected: 全部 passed(已核实 `summary` 三桶除本文件外无其他消费方;`test_shipping_conversation_processing_api.py` 等文件的 `needs_action` 属另一投影 `ShippingProcessingProjection`,不受影响)
|
||||
|
||||
---
|
||||
|
||||
### Task 3: 前端类型 + 图标映射重写
|
||||
|
||||
**Files:**
|
||||
- Modify: `frontend/src/features/chat/types/shipping.api.types.ts`(`ShippingOrderReviewCaseSummary`,`:2322` 的 `issue_count` 之后)
|
||||
- Modify: `frontend/src/features/chat/components/shipping-review/ReviewDocumentNavigation.vue`
|
||||
- Test: `frontend/src/features/chat/components/shipping-review/ReviewDocumentNavigation.spec.ts`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: 队列 item 的 `needs_attention?: boolean`(Task 1 下发;旧后端缺省按 false)。
|
||||
- Produces: `navIconKind(item): 'alert' | 'done' | 'failed' | 'processing' | 'idle'`(删除 `'active'`);`ReviewDocumentNavItem` 新增 `needs_attention?: boolean | null`。
|
||||
|
||||
- [ ] **Step 1: 追加失败测试**
|
||||
|
||||
在 `ReviewDocumentNavigation.spec.ts` 的最后一个 `describe` 之后追加:
|
||||
|
||||
```ts
|
||||
describe('ReviewDocumentNavigation queue row status icons', () => {
|
||||
/**
|
||||
* 以指定字段挂载单行侧栏队列,返回该行按钮包装器。
|
||||
*/
|
||||
function mountRow(item: Partial<ReviewDocumentNavItem>) {
|
||||
return mount(ReviewDocumentNavigation, {
|
||||
props: {
|
||||
items: [{ case_no: 'C-1', file_name: 'f1.pdf', status: 'draft', ...item }],
|
||||
activeCaseNo: 'C-1',
|
||||
navAriaLabel: 'nav',
|
||||
forceMode: 'sidebar',
|
||||
},
|
||||
global: { plugins: i18n },
|
||||
}).get('[data-testid="review-doc-nav-C-1"]');
|
||||
}
|
||||
|
||||
it('renders confirmed cases as in-progress spinner instead of done check', () => {
|
||||
const row = mountRow({ status: 'confirmed' });
|
||||
// 关键断言:已创建任务是系统在办中间态,必须转圈而非绿勾。
|
||||
expect(row.find('svg.animate-spin').exists()).toBe(true);
|
||||
expect(row.find('svg.text-emerald-500').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('renders ready-to-confirm cases as amber attention icon', () => {
|
||||
const row = mountRow({ status: 'ready' });
|
||||
// 关键断言:可确认是等人操作,属于待办而非完成。
|
||||
expect(row.find('svg.text-amber-500').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('renders backend gate-blocked cases as amber attention icon', () => {
|
||||
const row = mountRow({ status: 'confirmed', needs_attention: true });
|
||||
// 关键断言:needs_attention 是后端门禁裁决,优先于中间态转圈。
|
||||
expect(row.find('svg.text-amber-500').exists()).toBe(true);
|
||||
expect(row.find('svg.animate-spin').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('reserves the green check for terminal upload_complete', () => {
|
||||
const row = mountRow({ status: 'confirmed', lifecycle_stage: 'upload_complete' });
|
||||
expect(row.find('svg.text-emerald-500').exists()).toBe(true);
|
||||
expect(row.find('svg.animate-spin').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('renders failed and neutral states as before', () => {
|
||||
expect(mountRow({ status: 'failed' }).find('svg.text-rose-500').exists()).toBe(true);
|
||||
const idle = mountRow({ status: 'non_order' });
|
||||
expect(idle.find('svg.text-muted').exists()).toBe(true);
|
||||
expect(idle.find('svg.animate-spin').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('keeps the truthful state icon on the selected row', () => {
|
||||
const row = mountRow({ status: 'draft' });
|
||||
// 关键断言:选中态由行高亮表达,图标不再被 active 覆盖成灰圈。
|
||||
expect(row.find('svg.text-amber-500').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('treats missing needs_attention as false for old queue payloads', () => {
|
||||
const row = mountRow({ status: 'confirmed', needs_attention: undefined });
|
||||
expect(row.find('svg.animate-spin').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 运行验证测试失败**
|
||||
|
||||
Run: `cd frontend && npx vitest run src/features/chat/components/shipping-review/ReviewDocumentNavigation.spec.ts`
|
||||
Expected: 新增用例 FAIL(confirmed 画绿勾、选中草稿被灰圈覆盖、`needs_attention` 未消费);既有用例仍 PASS
|
||||
|
||||
- [ ] **Step 3: 修改类型 `shipping.api.types.ts`**
|
||||
|
||||
在 `ShippingOrderReviewCaseSummary` 的 `issue_count: number;`(`:2322`)之后插入:
|
||||
|
||||
```ts
|
||||
/** 队列后端按当前门禁裁决:blocked_manual/blocked_retryable/failed_terminal 为 true;前端禁止自行推断阻塞。 */
|
||||
needs_attention?: boolean;
|
||||
```
|
||||
|
||||
- [ ] **Step 4: 重写组件映射与模板**
|
||||
|
||||
4a. `ReviewDocumentNavigation.vue` import 块(`:9-17`)加入 `LoaderCircle`(保持字母序):
|
||||
|
||||
```ts
|
||||
import {
|
||||
Check,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
Circle,
|
||||
LoaderCircle,
|
||||
Search,
|
||||
TriangleAlert,
|
||||
X,
|
||||
} from 'lucide-vue-next';
|
||||
```
|
||||
|
||||
4b. `ReviewDocumentNavItem` 类型(`:21-31`):`issue_count` 之后新增字段,并同步 `lifecycle_stage` 注释:
|
||||
|
||||
```ts
|
||||
issue_count?: number;
|
||||
/** 队列接口按当前门禁裁决的"需人工"标志(blocked_manual/blocked_retryable/failed_terminal);前端禁止自行推断阻塞。 */
|
||||
needs_attention?: boolean | null;
|
||||
po_number?: string | null;
|
||||
customer_name?: string | null;
|
||||
stage_label?: string | null;
|
||||
/** 队列接口下发的生命周期码;用于阶段文字展示与终态(upload_complete)绿勾判定,不参与阶段裁决。 */
|
||||
lifecycle_stage?: ReviewLifecycleStageCode | null;
|
||||
```
|
||||
|
||||
4c. 整体替换 `navIconKind` 函数(`:120-133`):
|
||||
|
||||
```ts
|
||||
/**
|
||||
* 队列状态图标语义,按优先级命中即停:
|
||||
* 失败 → 需人工(草稿问题数 / needs_attention 门禁阻塞)→ 终态绿勾
|
||||
* → 等人状态 ⚠ → 系统在办转圈 → 中性灰圈 → 兜底转圈。
|
||||
* 绿勾只属于终态(upload_complete / closed / completed);选中态由行高亮表达,
|
||||
* 本函数不感知选中,图标永远如实反映状态。
|
||||
*/
|
||||
function navIconKind(item: ReviewDocumentNavItem): 'alert' | 'done' | 'failed' | 'processing' | 'idle' {
|
||||
const status = String(item.status || '').toLowerCase();
|
||||
if (status === 'failed' || status === 'error') return 'failed';
|
||||
if ((item.issue_count && item.issue_count > 0) || item.needs_attention === true) return 'alert';
|
||||
if (item.lifecycle_stage === 'upload_complete' || status === 'completed' || status === 'closed') return 'done';
|
||||
if (['draft', 'ready', 'unreviewed', 'quality_issue', 'pending_review', 'waiting_review'].includes(status)) return 'alert';
|
||||
if (['confirmed', 'confirming', 'processing', 'reparse_pending', 'queued'].includes(status)) return 'processing';
|
||||
if (['non_order', 'cancelled', 'superseded'].includes(status)) return 'idle';
|
||||
return 'processing';
|
||||
}
|
||||
```
|
||||
|
||||
4d. `matchesStatusFilter`(`:142`)的 processing 分支改为:
|
||||
|
||||
```ts
|
||||
if (statusFilter.value === 'processing') return kind === 'processing';
|
||||
```
|
||||
|
||||
4e. tabs 模板分支(`:216-225` 的 `<X>` 块之后、`<Circle>` 之前)插入:
|
||||
|
||||
```html
|
||||
<LoaderCircle
|
||||
v-else-if="navIconKind(item) === 'processing'"
|
||||
class="h-3.5 w-3.5 shrink-0 animate-spin text-brand-600"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
```
|
||||
|
||||
4f. sidebar 模板分支(`:328-331` 的 `<X>` 块之后、`<Circle>` 之前)插入(该分支图标不带 aria-hidden,保持一致):
|
||||
|
||||
```html
|
||||
<LoaderCircle
|
||||
v-else-if="navIconKind(item) === 'processing'"
|
||||
class="mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-brand-600"
|
||||
/>
|
||||
```
|
||||
|
||||
- [ ] **Step 5: 运行新测试通过**
|
||||
|
||||
Run: `cd frontend && npx vitest run src/features/chat/components/shipping-review/ReviewDocumentNavigation.spec.ts`
|
||||
Expected: 全部 passed(含既有 8 个用例)
|
||||
|
||||
- [ ] **Step 6: 构建验证**
|
||||
|
||||
Run: `cd frontend && npm run build`
|
||||
Expected: 构建通过,无 vue-tsc 类型错误
|
||||
|
||||
---
|
||||
|
||||
### Task 4: 文档同步 + 全量回归
|
||||
|
||||
**Files:**
|
||||
- Modify: `docs/features/shipping-notice/technical.md`(文件末尾追加章节)
|
||||
- Modify: `docs/funclist.md`(`:95` 工作台条目所在表格追加一行)
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: Task 1–3 的最终实现。
|
||||
- Produces: 与代码一致的权威文档(AGENTS.md §9 要求同一 PR 内同步)。
|
||||
|
||||
- [ ] **Step 1: technical.md 末尾追加**
|
||||
|
||||
在 `docs/features/shipping-notice/technical.md` 文件末尾(「客户数据 ODM ID 范围与整单 ODM 裁决(2026-09)」章节之后)追加:
|
||||
|
||||
```markdown
|
||||
## 订单队列五态图标与 needs_attention(2026-09)
|
||||
|
||||
- 队列接口(`serialize_review_queue` / `serialize_review_run` 共用的 `_serialize_review_case_summary`)每个 item 新增 `needs_attention: bool`:复用批量预取的 Execution/Gate 会话缓存(零额外 SQL),当前 Gate(优先 `execution.current_gate_code`,缺失按 `sequence_no` 取第一个活跃 Gate)状态 ∈ {`blocked_manual`, `blocked_retryable`, `failed_terminal`} 时为 True;`waiting_external`/`running`/`pending`/`queued` 属系统在办。前端禁止自行推断阻塞。
|
||||
- 左侧文件队列图标五态口径(`ReviewDocumentNavigation.vue` 的 `navIconKind`,优先级命中即停):失败 ✗ → 需人工 ⚠(`issue_count>0` 或 `needs_attention`,以及 `draft`/`ready`/`unreviewed`/`quality_issue`)→ 终态绿勾 ✓(`lifecycle_stage=upload_complete` 或 `closed`/`completed`)→ 系统在办蓝转圈(`confirmed`/`confirming`/`processing`/`reparse_pending`/`queued`)→ 中性灰圈(`non_order`/`cancelled`/`superseded`)→ 兜底转圈。绿勾不再被「已创建任务」等中间态占用;选中态仅由行高亮表达。
|
||||
- 队列 `summary` 三桶与图标同口径(`_queue_summary_bucket`):`quality_issue` 归 needs_action;`confirmed` 归 processing;仅终态归 completed。前端当前未消费三桶,属契约纠偏。
|
||||
- 已知边界(fail-safe):队列 `lifecycle_stage` 为轻量投影,极端场景会偏早(兜回 `intake_parse`),后果是完成单暂不亮绿勾;反向(未完成亮绿勾)不可能——`upload_complete` 仅由已持久化 `OT.stage=completed` 驱动。
|
||||
```
|
||||
|
||||
- [ ] **Step 2: funclist.md 追加条目**
|
||||
|
||||
在 `docs/funclist.md:95`(「订单生命周期工作台状态展示统一(v2)」行)之后同表追加一行:
|
||||
|
||||
```markdown
|
||||
| 订单队列五态图标与门禁阻塞标志 | 已实现 | 队列 item 新增 `needs_attention`(复用批量 Gate 缓存零额外 SQL,blocked_manual/blocked_retryable/failed_terminal 为真);左侧文件队列图标收敛为 需人工⚠/进行中🔄/终态✓/失败✗/中性○ 五态,绿勾仅限通知完成终态;队列 summary 三桶同口径。设计:[2026-09-16 队列图标语义设计](superpowers/specs/2026-09-16-review-queue-icon-semantics-design.md) |
|
||||
```
|
||||
|
||||
- [ ] **Step 3: 全量回归**
|
||||
|
||||
Run: `cd backend && source venv/bin/activate && python -m pytest tests/test_shipping_order_review_service.py -v`
|
||||
Expected: 全部 passed
|
||||
|
||||
Run: `cd frontend && npx vitest run src/features/chat/components/shipping-review/ReviewDocumentNavigation.spec.ts && npm run build`
|
||||
Expected: 测试全过、构建通过
|
||||
|
||||
- [ ] **Step 4: 停在"完成、未提交"**
|
||||
|
||||
向用户汇报改动文件清单与验证结果;**不执行任何 git add/commit**,等用户指示。
|
||||
@@ -0,0 +1,120 @@
|
||||
# 订单队列图标语义重映射 + 门禁阻塞标志 设计文档
|
||||
|
||||
- 日期:2026-09-16
|
||||
- 分支:hugo-shipping-notice
|
||||
- 状态:待评审
|
||||
|
||||
## 1. 背景与问题
|
||||
|
||||
订单生命周期工作台左侧"本批订单队列"(`ReviewDocumentNavigation.vue`)的行内状态图标存在语义错位:
|
||||
|
||||
1. **绿勾被中间态占用**:图标映射把 Case 状态 `confirmed`(已创建任务)、`ready`(可确认)判为 `done` 画绿勾,但它们分别处于"系统/RPA 进行中"和"等待人工确认",并非终态。用户看到"通知准备/货代上传 · 已创建任务"亮绿勾,误读为"该阶段已完成"。`ready`(可确认)明明等人操作却画绿勾,是第二个语义错误。
|
||||
2. **选中项图标被覆盖**:`navIconKind()` 首行"当前选中返回 `active`"使选中草稿单的 ⚠️ 被灰圈覆盖,图标不再如实反映状态(选中态已有蓝色边框+底色表达)。
|
||||
3. **"进行中"与"中性"不可区分**:`processing`/`reparse_pending`/`confirmed` 与 `non_order`/`superseded` 都渲染灰圈。
|
||||
4. **库存缺口阻塞在队列不可见**:`issue_count` 只统计草稿复核问题(`order_review_projection.py:1159`),通知准备阶段的库存缺口记录在 Process Gate(`blocked_manual` 等)上,队列序列化刻意不读阻断信息(`blocking_reason=None`,性能约束),队列无字段携带"被库存缺口卡住需人工"。
|
||||
|
||||
同页面顶部阶段条的视觉语言是 ✓=已完成、蓝点/转圈=进行中、🔒=阻塞;队列图标必须与之同义。
|
||||
|
||||
## 2. 目标 / 非目标
|
||||
|
||||
**目标**
|
||||
|
||||
- 队列行内图标收敛为行业通用的五态语义:需人工(黄⚠)/ 进行中(蓝转圈)/ 已完成(绿✓,仅终态)/ 失败(红✗)/ 中性(灰○)。
|
||||
- 选中项只靠行高亮表达,图标永远如实反映状态。
|
||||
- 后端队列 item 新增 `needs_attention` 标志,利用已批量预取的 Gate 缓存判定(零额外 SQL),使"库存缺口等门禁阻塞需人工"在队列可见。
|
||||
- 队列 `summary` 计数与新语义对齐(现状把 `confirmed`/`quality_issue` 计入 completed,与新图标矛盾;前端已核实无消费方,仅测试引用)。
|
||||
|
||||
**非目标**
|
||||
|
||||
- 不改 Gate/Execution 写路径、状态机与任何动作授权。
|
||||
- 不改队列接口既有字段语义(`issue_count`、`status`、`lifecycle_stage` 原样保留)。
|
||||
- 不新增 i18n 文案(图标为 aria-hidden 装饰元素,状态文字已有)。
|
||||
- 不改收起模式(数字轨)与窄屏抽屉(无图标)。
|
||||
|
||||
## 3. 设计原则
|
||||
|
||||
1. 一个图标只回答一个问题:"这单现在什么状态、要不要我处理"。
|
||||
2. 图标永远如实反映状态;选中态由行高亮(既有蓝色边框+底色)表达。
|
||||
3. 绿勾只属于终态;宁可少亮绿勾(用户多看一眼),不可错亮绿勾(漏单)。
|
||||
4. 同页面同一图形必须同义(与顶部阶段条对齐)。
|
||||
|
||||
## 4. 前端:图标映射重写
|
||||
|
||||
文件:`frontend/src/features/chat/components/shipping-review/ReviewDocumentNavigation.vue`
|
||||
|
||||
`navIconKind()` 按以下优先级自上而下判定,命中即停。输入:`status`、`issue_count`、`needs_attention`、`lifecycle_stage`。
|
||||
|
||||
| 优先级 | 条件 | 图标 | 含义 |
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | `status` ∈ {`failed`, `error`} | 红 ✗(X) | 失败 |
|
||||
| 2 | `issue_count > 0` **或** `needs_attention === true` | 黄 ⚠️(TriangleAlert) | 需人工处理(草稿问题 / 门禁阻塞如库存缺口) |
|
||||
| 3 | 终态:`lifecycle_stage === 'upload_complete'` 或 `status` ∈ {`completed`, `closed`} | 绿 ✓(Check) | 整单完成(通知完成) |
|
||||
| 4 | 需人工状态:`status` ∈ {`draft`, `ready`, `unreviewed`, `quality_issue`, `pending_review`, `waiting_review`} | 黄 ⚠️(TriangleAlert) | 等人操作 |
|
||||
| 5 | 进行中:`status` ∈ {`confirmed`, `processing`, `reparse_pending`, `queued`, `confirming`} | 蓝 🔄(LoaderCircle + animate-spin) | 系统/RPA 在办 |
|
||||
| 6 | 中性:`status` ∈ {`non_order`, `cancelled`, `superseded`} | 灰 ○(Circle) | 不适用/已废弃 |
|
||||
| 7 | 兜底(含 `unknown`) | 蓝 🔄(LoaderCircle + animate-spin) | 未知按仍在流转处理 |
|
||||
|
||||
- 删除 `active` 返回值与选中优先分支;返回值联合类型收敛为 `'alert' | 'done' | 'failed' | 'processing' | 'idle'`。
|
||||
- `matchesStatusFilter()`:`processing` 过滤改判 `kind === 'processing'`(删 `|| kind === 'active'`)。
|
||||
- 模板 tabs 分支与 sidebar 分支的图标链各插入 `LoaderCircle`(`h-3.5 w-3.5` + `animate-spin` + `text-brand-600`,与 `ReviewLifecycleStageNavigation.vue:85` 顶部阶段条进行中样式一致);沿用既有重复写法,不抽子组件。
|
||||
- 视觉:⚠️ amber-500、✓ emerald-500、✗ rose-500、○ muted,全部不变。
|
||||
- 注释同步(AGENTS.md §5.3):`navIconKind` docstring 写明优先级链与"绿勾=终态"约束;`lifecycle_stage` 字段注释更新为"用于阶段文字展示与终态(upload_complete)绿勾判定,不参与阶段裁决";`ReviewDocumentNavItem` 类型新增 `needs_attention?: boolean | null` 并注明来源为队列接口。
|
||||
- 类型:`frontend/src/features/chat/types/shipping.api.types.ts` 的 `ShippingOrderReviewCaseSummary` 新增 `needs_attention?: boolean`(后端可选下发,缺省视为 false)。
|
||||
|
||||
对照截图的可见变化:6 个"通知准备/货代上传 · 已创建任务"绿勾 → 蓝转圈;"可确认"绿勾 → 黄⚠;仅"通知完成"终态亮绿勾。
|
||||
|
||||
## 5. 后端:needs_attention 标志
|
||||
|
||||
文件:`backend/app/services/shipping_notice/order_review_projection.py`
|
||||
|
||||
1. **现状复用**:`_load_review_case_summary_batch` 已批量预取 `executions_by_case_id` / `gates_by_execution_id` 并写入会话缓存(`:1333-1355`、`:1213-1215`),`_queue_current_gate_hint` 已从中取当前 Gate 码。本改动不新增任何 SQL。
|
||||
2. **当前 Gate 判定**:优先 `execution.current_gate_code` 对应 Gate;缺失时按 `sequence_no` 取第一个状态 ∈ {`pending`, `queued`, `running`, `blocked_retryable`, `blocked_manual`, `waiting_external`, `failed_terminal`} 的 Gate(在 `_queue_current_gate_hint` 活跃口径上补 `queued` 与 `failed_terminal`,避免终态失败的单被漏判)。
|
||||
3. **`needs_attention` 裁决**:当前 Gate `status` ∈ {`blocked_manual`, `blocked_retryable`, `failed_terminal`} → `true`;无 Execution / 无活跃 Gate → `false`。`waiting_external`(RPA 外部等待)、`running`/`pending`/`queued` 视为在办,不算需人工。
|
||||
4. **输出**:`_serialize_review_case_summary` 返回 dict 新增 `'needs_attention': bool`;`serialize_review_run` 与 `serialize_review_queue` 两个队列数据源自动携带(共用同一序列化函数)。仅对 `case.confirmed_task_id` 存在的 Case 有意义,但字段恒输出(布尔,不缺键)。
|
||||
5. **docstring**:函数注释写明裁决口径与"禁止前端自行推断阻塞"的约束。
|
||||
|
||||
## 6. 后端:summary 计数对齐
|
||||
|
||||
`serialize_review_queue` 的 counts(`order_review_projection.py:1447-1452`)重算,与 item 口径一致:
|
||||
|
||||
- `needs_action`:`status` ∈ {`unreviewed`, `draft`, `ready`, `quality_issue`} 或 `needs_attention` 为真。
|
||||
- `completed`:终态——`status` ∈ {`non_order`, `closed`, `completed`} 或 `lifecycle_stage === 'upload_complete'`。
|
||||
- `processing`:其余(`confirmed`/`confirming`/`reparse_pending` 等进行中)。
|
||||
|
||||
依据:前端已核实无任何组件消费 `queue.summary` 的三个计数(仅 `items` 与 `total` 语义被使用),后端仅 `backend/tests/test_shipping_order_review_service.py` 引用,风险可控。若不改,summary 的 completed 会与 item 的 needs_attention 图标互相矛盾,成为下一个"为什么"。
|
||||
|
||||
注意:summary 三个桶是"队列处置去向"粗粒度归类,与五态图标不是一一映射(如 `non_order` 计入 completed,但图标为中性别灰 ○);桶口径只需与"要不要再看这单"一致,不要求与图形一致。
|
||||
|
||||
## 7. 已知边界(明示,非缺陷)
|
||||
|
||||
- **阶段偏早(fail-safe)**:队列 `lifecycle_stage` 是轻量投影,极端场景(OT.stage 脏值且 Gate 缓存缺失)会兜回 `intake_parse`(`order_review_projection.py:1105`、`:1133`);异步回调成功但 OT.stage 未落库的瞬间也会短暂偏早。方向安全:完成单不亮绿勾只亮转圈,用户多看一眼;反向(未完成亮绿勾)不可能——`upload_complete` 仅由已持久化 `OT.stage == 'completed'` 驱动,队列不采信异步回执(`lifecycle_projection.py:138-146`)。
|
||||
- **`ready` 归黄⚠ 的口径变化**:`ready`(可确认)从绿勾改为黄⚠。若产品上希望"可确认"用独立图标(如待办蓝框),另行迭代,本版不引入第六种图形。
|
||||
|
||||
## 8. 测试计划
|
||||
|
||||
**后端**(`backend/tests/test_shipping_order_review_service.py`)
|
||||
|
||||
- `confirmed` Case + 当前 Gate `blocked_manual`(库存缺口场景)→ item `needs_attention=true`,summary `needs_action` 含该单。
|
||||
- 当前 Gate `waiting_external` → `needs_attention=false`。
|
||||
- 无 Execution 的 `confirmed` Case → `needs_attention=false`。
|
||||
- summary 计数:`quality_issue` 归 needs_action、`confirmed` 归 processing、`upload_complete` 归 completed。
|
||||
- 关键断言按 `docs/test_plan_matrix.md` §1 附意图注释。
|
||||
|
||||
**前端**(`frontend/src/features/chat/components/shipping-review/ReviewDocumentNavigation.spec.ts`)
|
||||
|
||||
- 映射表逐行:`confirmed`→转圈、`ready`→⚠、`draft`→⚠、`upload_complete`→✓、`failed`→✗、`non_order`→○、`needs_attention=true`+`confirmed`→⚠。
|
||||
- 选中项:选中 `draft` 单,图标仍为 ⚠(行高亮独立表达选中)。
|
||||
- `needs_attention` 缺省(旧后端响应)→ 按 false 处理,不报错。
|
||||
|
||||
**构建**:`cd frontend && npm run build` 必须通过;后端跑相关 pytest 文件。
|
||||
|
||||
## 9. 文档同步(与代码同一提交/PR)
|
||||
|
||||
- `docs/features/shipping-notice/technical.md`:队列投影小节补 `needs_attention` 字段与五态图标口径。
|
||||
- `docs/funclist.md`:涉及的功能条目措辞同步(如已有队列状态展示条目)。
|
||||
|
||||
## 10. 改动量与风险
|
||||
|
||||
- 后端 1 个文件(+辅助函数、+字段、+计数重算)+ 1 个测试文件;无迁移、无新依赖、无接口破坏性变更(纯增量字段)。
|
||||
- 前端 2 个文件(组件 + 类型)+ 1 个测试文件。
|
||||
- 主要风险:summary 计数语义变化(已核实无前端消费方);图标语义变化对用户习惯的影响(正是本次目的)。
|
||||
Reference in new issue
Block a user