feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码

This commit is contained in:
hugo committed 2026-08-23 00:27:18 +08:00
1 parent 935bf26fa6
commit 7cfd5d167e
230 files changed
+9337 -10989

No files matched your search

@@ -101,7 +101,11 @@ describe('workbenchActionRegistry', () => {
it('warns and omits unregistered action codes from review presentation', () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
const result = resolveProcessingActionPresentation(projection({
availableActions: ['totally_unknown_action', 'view_result'],
uiState: {
status: 'waiting_human', stage: 'waiting_review', blocking_reason: null,
primary_action: { code: 'totally_unknown_action', label_key: 'x' },
secondary_actions: [{ code: 'view_result', enabled: true }],
},
}), { surface: 'review', actionsExecutable: true });
expect(result.primary?.intent).toBe('view_result');
expect(warn).toHaveBeenCalled();
@@ -124,7 +128,7 @@ describe('workbenchActionRegistry', () => {
},
availableActions: ['refresh'],
}), { surface: 'review', actionsExecutable: true });
expect(result.primary?.intent).toBe('open_inventory_match_review');
expect(result.primary?.intent).toBe('retry_inventory_matching');
expect(result.primary?.actionCode).toBe('retry_inventory_matching');
expect(result.secondary).toBeNull();
});
@@ -169,7 +173,7 @@ describe('workbenchActionRegistry', () => {
}), { surface: 'review', actionsExecutable: true });
expect(result.primary?.actionCode).toBe('retry_freight_upload_rpa');
expect(result.primary?.intent).toBe('retry');
expect(result.primary?.intent).toBe('retry_freight_upload_rpa');
expect(result.secondary?.actionCode).toBe('download_excel');
expect(result.overflow.map((item) => item.actionCode)).not.toContain('mark_manual_uploaded');
});
@@ -177,6 +181,11 @@ describe('workbenchActionRegistry', () => {
it('does not turn the admin todo-regeneration recovery action into manual upload', () => {
const result = resolveProcessingActionPresentation(projection({
stage: 'freight_uploading',
uiState: {
status: 'waiting_human', stage: 'freight_uploading', blocking_reason: null,
primary_action: { code: 'regenerate_manual_upload_todo', label_key: 'x' },
secondary_actions: [{ code: 'download_excel', enabled: true }],
},
currentGate: {
gateCode: 'manual_upload_handoff',
status: 'blocked',
@@ -184,7 +193,6 @@ describe('workbenchActionRegistry', () => {
blockingReasonCode: 'manual_upload_todo_missing',
attemptNo: 1,
},
availableActions: ['download_excel'],
}), { surface: 'review', actionsExecutable: true });
expect(result.primary?.actionCode).toBe('download_excel');