feat(shipping-notice): 落地字段资产治理与唯一 Schema,自动建单随版本冻结
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b7307fc573
commit
3a1dbf7ce5
144 files changed
+15167
-4480
No files matched your search
@@ -78,12 +78,12 @@ const buildBatchUiStateEvent = (
|
||||
});
|
||||
|
||||
describe('useChat shipping_ui_state SSE', () => {
|
||||
it('hydrates focus task ui state from batch payload and does not reattach used actions', () => {
|
||||
it('hydrates ui_state for notifications and never attaches chat fulfillment actions', () => {
|
||||
const message: ChatMessage = {
|
||||
role: 'assistant',
|
||||
content: '当前正在处理批次任务',
|
||||
type: 'shipping-match-result',
|
||||
payload: { action_buttons: [] },
|
||||
payload: { action_buttons: [{ id: 'legacy' }] },
|
||||
};
|
||||
|
||||
const batchEvent = buildBatchUiStateEvent('SN-UNIT-001', 'SB-UNIT-001', 'generate_excel');
|
||||
@@ -91,22 +91,12 @@ describe('useChat shipping_ui_state SSE', () => {
|
||||
applyShippingUiStateToMessage(message, batchEvent);
|
||||
|
||||
expect(message.shipping_ui_state?.task_no).toBe('SN-UNIT-001');
|
||||
expect(message.shipping_actions?.map((item) => item.id)).toEqual(['generate_excel']);
|
||||
expect((message.payload as { action_buttons?: unknown[] }).action_buttons).toHaveLength(1);
|
||||
expect((message.payload as { shipping_batch_ui_state?: { batch_no?: string } }).shipping_batch_ui_state?.batch_no).toBe('SB-UNIT-001');
|
||||
|
||||
message.shipping_actions_used = true;
|
||||
message.shipping_actions = undefined;
|
||||
(message.payload as { action_buttons?: unknown[] }).action_buttons = [];
|
||||
|
||||
applyShippingUiStateToMessage(message, batchEvent);
|
||||
|
||||
expect(message.shipping_ui_state?.checkpoint).toBe('ready_export');
|
||||
expect(message.shipping_actions).toBeUndefined();
|
||||
expect((message.payload as { action_buttons?: unknown[] }).action_buttons).toEqual([]);
|
||||
expect((message.payload as { shipping_batch_ui_state?: { batch_no?: string } }).shipping_batch_ui_state?.batch_no).toBe('SB-UNIT-001');
|
||||
});
|
||||
|
||||
it('switches buttons when batch focus task changes from A to B', () => {
|
||||
it('updates ui_state when batch focus task changes without remounting action buttons', () => {
|
||||
const message: ChatMessage = {
|
||||
role: 'assistant',
|
||||
content: '请继续处理当前批次',
|
||||
@@ -116,12 +106,12 @@ describe('useChat shipping_ui_state SSE', () => {
|
||||
applyShippingUiStateToMessage(message, buildBatchUiStateEvent('SN-FOCUS-A', 'SB-FOCUS-001', 'generate_excel'));
|
||||
|
||||
expect(message.shipping_ui_state?.task_no).toBe('SN-FOCUS-A');
|
||||
expect(message.shipping_actions?.map((item) => item.id)).toEqual(['generate_excel']);
|
||||
expect(message.shipping_actions).toBeUndefined();
|
||||
|
||||
applyShippingUiStateToMessage(message, buildBatchUiStateEvent('SN-FOCUS-B', 'SB-FOCUS-001', 'retry_upload'));
|
||||
|
||||
expect(message.shipping_ui_state?.task_no).toBe('SN-FOCUS-B');
|
||||
expect(message.shipping_actions?.map((item) => item.id)).toEqual(['retry_upload']);
|
||||
expect(message.shipping_actions).toBeUndefined();
|
||||
expect((message.payload as { shipping_batch_ui_state?: { current_focus_task_no?: string } }).shipping_batch_ui_state?.current_focus_task_no)
|
||||
.toBe('SN-FOCUS-B');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user