纳入 Execution/Gate/Attempt 模型与迁移、Worker/API/前端恢复卡片与 Admin 诊断, Gate 阻断时清零旧 action_buttons,异常摘要统一脱敏,并为运维筛选与 Attempt Diff 补齐入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
/**
|
|
* features/shipping-process-gates/components/ProcessGateRecoveryCard.spec.ts
|
|
* 用途:验证待处理事项卡片不展示未知内部编号和技术诊断文本。
|
|
* 依赖:Vitest、Vue Test Utils、vue-i18n。
|
|
* 逻辑:构造未知环节、动作及技术自由文本,断言全部回退为业务文案。
|
|
*/
|
|
import { mount } from '@vue/test-utils';
|
|
import { createI18n } from 'vue-i18n';
|
|
import { describe, expect, it } from 'vitest';
|
|
import workspaceZhCn from '@/locales/zh-CN/workspace.json';
|
|
import ProcessGateRecoveryCard from './ProcessGateRecoveryCard.vue';
|
|
import type { ShippingProcessGateUserSummary } from '../types/process-gate.types';
|
|
|
|
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',
|
|
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',
|
|
};
|
|
const wrapper = mount(ProcessGateRecoveryCard, {
|
|
props: { summary, canHandle: true },
|
|
global: { plugins: [i18n] },
|
|
});
|
|
const text = wrapper.text();
|
|
expect(text).toContain('当前处理环节');
|
|
expect(text).toContain('当前步骤');
|
|
expect(text).toContain('继续处理');
|
|
expect(text).toContain('当前步骤需要人工处理');
|
|
for (const technicalText of [
|
|
'auto_build_gate_quality_gate_passed', 'quality_gate_internal', 'internal_reason_code',
|
|
'internal_retry_action', 'HTTP 500', 'node_id', 'traceback', 'worker.py',
|
|
]) {
|
|
expect(text).not.toContain(technicalText);
|
|
}
|
|
});
|
|
});
|