108 lines
3.4 KiB
TypeScript
108 lines
3.4 KiB
TypeScript
import type {
|
|
ValidationExecutionHistory,
|
|
ValidationExecutionHistoryItem
|
|
} from '@/features/production/validation-executions.types'
|
|
|
|
/** 隔离任务的完整正式路径身份。 */
|
|
export const executionHistoryTarget = ['project', 'shot', 'keyframe', 'task'] as const
|
|
/**
|
|
* 创建逐次证据的隔离执行,不调用 Provider。
|
|
* @param id 正式执行编号
|
|
* @param patch 本次已保存证据覆盖
|
|
* @returns 执行公开 DTO
|
|
*/
|
|
export function validationExecutionFixture(
|
|
id: string,
|
|
patch: Partial<ValidationExecutionHistoryItem> = {}
|
|
): ValidationExecutionHistoryItem {
|
|
return {
|
|
execution: {
|
|
id,
|
|
projectId: 'project',
|
|
workflowName: 'shot-keyframe-validation',
|
|
status: 'failed',
|
|
stage: 'vision',
|
|
current: 1,
|
|
total: 2,
|
|
currentResourceId: null,
|
|
metadata: { validationTaskId: 'task', shotId: 'shot', keyframeId: 'keyframe' },
|
|
result: null,
|
|
error: '物理步骤回执尚待核查',
|
|
startedAt: '2026-11-07T00:00:00Z',
|
|
completedAt: '2026-11-07T00:01:00Z',
|
|
createdAt: '2026-11-07T00:00:00Z',
|
|
updatedAt: '2026-11-07T00:01:00Z'
|
|
},
|
|
isCurrent: false,
|
|
mode: 'unknown',
|
|
scheduledSteps: null,
|
|
reusedSteps: null,
|
|
steps: null,
|
|
stepsEvidence: 'not_recorded',
|
|
...patch
|
|
}
|
|
}
|
|
/**
|
|
* 构造正式分页响应,当前指针独立于页内排序。
|
|
* @param items 本页独立执行证据
|
|
* @param patch 分页及当前指针覆盖
|
|
* @returns 隔离接口响应数据
|
|
*/
|
|
export function validationHistoryFixture(
|
|
items: ValidationExecutionHistoryItem[],
|
|
patch: Partial<ValidationExecutionHistory> = {}
|
|
): ValidationExecutionHistory {
|
|
return {
|
|
projectId: 'project',
|
|
shotId: 'shot',
|
|
keyframeId: 'keyframe',
|
|
validationTaskId: 'task',
|
|
taskStatus: 'completed',
|
|
currentExecutionId: 'current-run',
|
|
total: 2,
|
|
items,
|
|
integrity: { currentExecution: 'valid' },
|
|
nextCursor: null,
|
|
...patch
|
|
}
|
|
}
|
|
/** 带通用复用与本次物理调用的正式证据。 */
|
|
export const physicalHistoryFixture = validationExecutionFixture('current-run', {
|
|
execution: {
|
|
...validationExecutionFixture('current-run').execution,
|
|
status: 'completed',
|
|
current: 2,
|
|
result: { passed: false, qualityDecision: 'needs_review' },
|
|
error: null
|
|
},
|
|
isCurrent: true,
|
|
mode: 'physical_retry',
|
|
scheduledSteps: ['physical'],
|
|
reusedSteps: ['general'],
|
|
stepsEvidence: 'execution_snapshot',
|
|
steps: [
|
|
{
|
|
name: 'general',
|
|
status: 'completed',
|
|
quality: 'passed',
|
|
issues: [],
|
|
error: null,
|
|
usage: { inputTokens: 100, outputTokens: 10 },
|
|
executionKind: 'reused',
|
|
sourceExecutionId: 'old-run',
|
|
usageAttribution: 'reused'
|
|
},
|
|
{
|
|
name: 'physical',
|
|
status: 'completed',
|
|
quality: 'needs_review',
|
|
issues: [{ code: 'visibility', description: '固定部件部分遮挡', severity: 'warning' }],
|
|
error: null,
|
|
usage: { inputTokens: 80 },
|
|
executionKind: 'executed',
|
|
sourceExecutionId: null,
|
|
usageAttribution: 'this_execution'
|
|
}
|
|
]
|
|
})
|