refactor(shipping-notice): 进度信号统一为 15 阶 stage 契约码并透传阻断原因

- 后端进度写入 step_key 全量切换为 15 阶契约 stage 码
- 投影层清除 CheckPoint stepN_* 遗留别名与子串/前缀启发式,阶段信号按契约码精确匹配
- 建单前 Case 摘要透传草稿首要阻断原因
- 前端标签/归一化/处理卡片同步契约码,阻断原因按 i18n 优先展示
- 修复正式下游回看时 activeCase 刻意为空导致队列定位与接收解析上下文静默跳过
- 同步更新投影/门禁/工作台/RPA 流程测试
This commit is contained in:
hugo committed 2026-09-17 15:54:53 +08:00
1 parent d1adbe5ec5
commit 18af972d20
34 files changed
+903 -111

No files matched your search

@@ -1184,4 +1184,86 @@ describe('ShippingConversationProcessingCard', () => {
const row = wrapper.find('[data-testid="shipping-processing-file-DOC-10"]');
expect(row.findAll('button')).toHaveLength(0);
});
it('shows a specific blocking reason once per waiting-human card without header duplication', async () => {
// v4 去重:具体原因由文件行页脚独家承载;任务卡头不再重复同一句。
// ui_state 挂在任务条目上(与后端 EML 聚合下发形态一致:任务级为代表子项原因)。
const projection = buildProjection();
setStatusGroup(projection, 'waiting_human', [{
user_task_no: 'OT-REASON-ONCE', group: 'waiting_human', status_label: 'pending_review',
file_count: 1, run_no: 'RUN-REASON-ONCE', can_append: false,
uiState: {
status: 'waiting_human',
stage: 'order_review',
blocking_reason: { code: 'customer_unresolved', message: '客户尚未确认' },
primary_action: null,
secondary_actions: [],
},
objects: [{
kind: 'document', object_key: 'DOC-REASON', label: 'reason.pdf', filename: 'reason.pdf',
document_id: 91, root_document_id: 91, status_label: 'pending_review',
}],
}]);
const workItem = buildWorkItem('OT-REASON-ONCE', {
sourceSummary: {
emailSubject: null, filename: 'reason.pdf', documentId: 91,
documentCount: 1, parsedDocumentCount: 1, candidateCount: 1,
customerName: null, poNumber: 'PO-REASON',
},
status: 'waiting_human',
uiState: {
status: 'waiting_human',
stage: 'order_review',
blocking_reason: { code: 'customer_unresolved', message: '客户尚未确认' },
primary_action: null,
secondary_actions: [],
},
});
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection, workItems: [workItem], workbenchMode: true },
global: { plugins: [i18n] },
});
await flushPromises();
// 关键断言:具体原因全文只出现一次,且带「阻塞原因:」前缀落在文件行页脚。
const matches = wrapper.text().match(/客户尚未确认/g) || [];
expect(matches.length).toBe(1);
expect(wrapper.text()).toContain('阻塞原因:客户尚未确认');
});
it('hides the blocker line when the backend only provides a generic fallback reason', async () => {
// v4:未知原因码不得渲染成「当前步骤需要人工处理」空话;状态芯片已表达待人工。
const projection = buildProjection();
setStatusGroup(projection, 'waiting_human', [{
user_task_no: 'OT-REASON-GENERIC', group: 'waiting_human', status_label: 'pending_review',
file_count: 1, run_no: 'RUN-REASON-GENERIC', can_append: false,
objects: [{
kind: 'document', object_key: 'DOC-GENERIC', label: 'generic.pdf', filename: 'generic.pdf',
document_id: 92, root_document_id: 92, status_label: 'pending_review',
}],
}]);
const workItem = buildWorkItem('OT-REASON-GENERIC', {
sourceSummary: {
emailSubject: null, filename: 'generic.pdf', documentId: 92,
documentCount: 1, parsedDocumentCount: 1, candidateCount: 1,
customerName: null, poNumber: 'PO-GENERIC',
},
status: 'waiting_human',
uiState: {
status: 'waiting_human',
stage: 'order_review',
blocking_reason: { code: 'mystery_internal_code' },
primary_action: null,
secondary_actions: [],
},
});
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection, workItems: [workItem], workbenchMode: true },
global: { plugins: [i18n] },
});
await flushPromises();
expect(wrapper.text()).not.toContain('阻塞原因');
expect(wrapper.text()).not.toContain('当前步骤需要人工处理');
});
});