feat(shipping-notice): 落地 XFA 统一视觉拆分确认门禁与处理投影收敛

闭合拆分预览令牌单次消费、样本 checksum 绑定与确认审计;正式提取改为 bindings-only。
同步统一标注工作台交互,并补齐进度投影/任务中心与迁移文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-06 10:21:25 +08:00
1 parent d2b3d74def
commit 84a881b554
195 files changed
+20269 -3463

No files matched your search

@@ -1,8 +1,8 @@
/**
* features/chat/shipping/useShippingOrderExtractionRuns.spec.ts
* 用途:验证订单抽取 Run 的状态映射、消息幂等持久化与轮询生命周期。
* 用途:验证订单抽取 Run 的状态映射、单状态卡消息持久化与轮询生命周期。
* 依赖:Vitest、Vue refs、shipping.api mock、useShippingOrderExtractionRuns。
* 逻辑:覆盖状态契约、新会话启动、无变化轮询、恢复失败及切会话迟到响应。
* 逻辑:覆盖新建/追加提交不生成重复反馈气泡、状态契约、无变化轮询及恢复隔离。
*/
import { computed, ref } from 'vue';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -98,7 +98,7 @@ describe('useShippingOrderExtractionRuns lifecycle', () => {
vi.useRealTimers();
});
it('persists stable user and assistant formIds and does not write unchanged polling state again', async () => {
it('persists one user message and one Run state card without duplicate submission feedback', async () => {
const queued = run({
run_no: 'SNER-START',
conversation_id: 'conv-created',
@@ -126,14 +126,41 @@ describe('useShippingOrderExtractionRuns lifecycle', () => {
expect(harness.options.onConversationResolved).toHaveBeenCalledWith('conv-created');
expect(harness.messages.value.map((item) => item.payload?.formId)).toEqual([
'shipping-order-extraction-user:SNER-START',
'shipping-submission-decision:op-1',
'shipping-order-extraction-run:SNER-START',
]);
expect(harness.options.saveLocalMessageToBackend).toHaveBeenCalledTimes(3);
expect(harness.options.saveLocalMessageToBackend).toHaveBeenCalledTimes(2);
await vi.advanceTimersByTimeAsync(1000);
expect(api.getRun).toHaveBeenCalledWith('SNER-START', expect.any(AbortSignal));
expect(harness.options.saveLocalMessageToBackend).toHaveBeenCalledTimes(3);
expect(harness.options.saveLocalMessageToBackend).toHaveBeenCalledTimes(2);
harness.runs.stopPolling();
});
it('keeps an appended submission in the user message and the existing Run state card only', async () => {
const queued = run({
run_no: 'SNER-APPENDED',
conversation_id: 'conv-existing',
user_task_no: 'OT-EXISTING',
});
api.createSubmission.mockResolvedValue({
decision: 'appended',
user_task_no: 'OT-EXISTING',
run_no: 'SNER-APPENDED',
created_new: false,
operation_id: 'op-appended',
});
api.getRun.mockResolvedValue(queued);
const harness = createHarness();
harness.conversationId.value = 'conv-existing';
await harness.runs.startRun('追加附件', ['SNI-1'], []);
expect(harness.messages.value.map((item) => item.payload?.formId)).toEqual([
'shipping-order-extraction-user:SNER-APPENDED',
'shipping-order-extraction-run:SNER-APPENDED',
]);
expect(harness.messages.value[0]?.payload?.submission_decision).toBe('appended');
expect(harness.options.saveLocalMessageToBackend).toHaveBeenCalledTimes(2);
harness.runs.stopPolling();
});
@@ -177,6 +204,7 @@ describe('useShippingOrderExtractionRuns lifecycle', () => {
expect.objectContaining({ content: '' }),
undefined,
);
expect(harness.messages.value).toHaveLength(2);
harness.runs.stopPolling();
});