feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估
- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。 - 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。 - 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。 - 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。 - 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
1 parent
cef3d5b26a
commit
3a9fbac2fc
226 files changed
+25010
-2098
No files matched your search
+89
-23
@@ -1,42 +1,78 @@
|
||||
/**
|
||||
* features/shipping-process-gates/components/ProcessGateRecoveryCard.spec.ts
|
||||
* 用途:验证待处理事项卡片不展示未知内部编号和技术诊断文本。
|
||||
* 依赖:Vitest、Vue Test Utils、vue-i18n。
|
||||
* 逻辑:构造未知环节、动作及技术自由文本,断言全部回退为业务文案。
|
||||
* 用途:验证待处理事项卡片不展示未知内部编号和技术诊断文本;审计缓存随 Execution 切换清空。
|
||||
* 依赖:Vitest、Vue Test Utils、vue-i18n、process-gates.api mock。
|
||||
* 逻辑:构造未知环节/动作/技术自由文本;断言业务文案与审计 i18n;切换 execution_no 后清空审计。
|
||||
*/
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { flushPromises, mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import workspaceZhCn from '@/locales/zh-CN/workspace.json';
|
||||
import ProcessGateRecoveryCard from './ProcessGateRecoveryCard.vue';
|
||||
import type { ShippingProcessGateUserSummary } from '../types/process-gate.types';
|
||||
|
||||
const listAuditMock = vi.fn();
|
||||
|
||||
vi.mock('../api/process-gates.api', () => ({
|
||||
listWorkspaceProcessGateAuditEvents: (...args: unknown[]) => listAuditMock(...args),
|
||||
postWorkspaceProcessGateAction: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('vue-router', () => ({
|
||||
useRouter: () => ({ push: vi.fn() }),
|
||||
}));
|
||||
|
||||
vi.mock('@/shared/composables/useMessage', () => ({
|
||||
useMessage: () => ({
|
||||
success: vi.fn(),
|
||||
warning: vi.fn(),
|
||||
error: vi.fn(),
|
||||
}),
|
||||
}));
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: { 'zh-CN': { workspace: workspaceZhCn } },
|
||||
});
|
||||
|
||||
describe('ProcessGateRecoveryCard', () => {
|
||||
it('does not expose internal gate, action or diagnostic text', () => {
|
||||
const summary: ShippingProcessGateUserSummary = {
|
||||
execution_no: 'EXEC-1',
|
||||
function baseSummary(overrides: Partial<ShippingProcessGateUserSummary> = {}): ShippingProcessGateUserSummary {
|
||||
return {
|
||||
execution_no: 'EXEC-1',
|
||||
status: 'blocked',
|
||||
current_blocking_gate: {
|
||||
gate_code: 'auto_build_gate_quality_gate_passed',
|
||||
label: 'quality_gate_internal',
|
||||
status: 'blocked',
|
||||
current_blocking_gate: {
|
||||
gate_code: 'auto_build_gate_quality_gate_passed',
|
||||
label: 'quality_gate_internal',
|
||||
status: 'blocked',
|
||||
sequence_no: 1,
|
||||
evaluation_version: 1,
|
||||
blocking_reason_code: 'internal_reason_code',
|
||||
next_action_code: 'internal_retry_action',
|
||||
},
|
||||
blocking_message: 'HTTP 500 error: node_id=abc',
|
||||
diagnostic_hint: 'traceback: C:\\service\\worker.py',
|
||||
responsible_party: 'owner',
|
||||
};
|
||||
sequence_no: 1,
|
||||
evaluation_version: 1,
|
||||
blocking_reason_code: 'internal_reason_code',
|
||||
next_action_code: 'internal_retry_action',
|
||||
},
|
||||
blocking_message: 'HTTP 500 error: node_id=abc',
|
||||
diagnostic_hint: 'traceback: C:\\service\\worker.py',
|
||||
responsible_party: 'owner',
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe('ProcessGateRecoveryCard', () => {
|
||||
beforeEach(() => {
|
||||
listAuditMock.mockReset();
|
||||
listAuditMock.mockResolvedValue({
|
||||
items: [
|
||||
{
|
||||
id: 1,
|
||||
event_type: 'process_gate_attempt_started',
|
||||
created_at: '2026-08-01T00:00:00Z',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('does not expose internal gate, action or diagnostic text', () => {
|
||||
const wrapper = mount(ProcessGateRecoveryCard, {
|
||||
props: { summary, canHandle: true },
|
||||
props: { summary: baseSummary(), canHandle: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
const text = wrapper.text();
|
||||
@@ -54,4 +90,34 @@ describe('ProcessGateRecoveryCard', () => {
|
||||
expect(text).not.toContain(technicalText);
|
||||
}
|
||||
});
|
||||
|
||||
it('maps audit event codes to business labels and clears cache on execution change', async () => {
|
||||
const wrapper = mount(ProcessGateRecoveryCard, {
|
||||
props: { summary: baseSummary({ execution_no: 'EXEC-1' }), canHandle: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
await wrapper.get('[data-testid="process-gate-view-audit"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(listAuditMock).toHaveBeenCalledWith('EXEC-1', 1, 20);
|
||||
expect(wrapper.text()).toContain('开始执行处理');
|
||||
expect(wrapper.text()).not.toContain('process_gate_attempt_started');
|
||||
|
||||
listAuditMock.mockResolvedValue({
|
||||
items: [
|
||||
{
|
||||
id: 2,
|
||||
event_type: 'process_gate_blocked',
|
||||
created_at: '2026-08-01T01:00:00Z',
|
||||
},
|
||||
],
|
||||
});
|
||||
await wrapper.setProps({ summary: baseSummary({ execution_no: 'EXEC-2' }) });
|
||||
await flushPromises();
|
||||
expect(wrapper.text()).not.toContain('开始执行处理');
|
||||
await wrapper.get('[data-testid="process-gate-view-audit"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(listAuditMock).toHaveBeenCalledWith('EXEC-2', 1, 20);
|
||||
expect(wrapper.text()).toContain('处理环节已阻断');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user