feat(short-drama-agent-front): 同步拆解候选审核与安全提交

This commit is contained in:
GJ committed 2026-10-17 20:18:20 +08:00
1 parent cc27d463e0
commit 190333d4f9
26 files changed
+1495 -249

No files matched your search

+17 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '@/features/workflows/selectors'
import { breakdownSnapshot, formalBreakdownSnapshot, recoveryOptions, workflowCheckpoints } from '@/features/workflows/selectors'
import type { Checkpoint } from '@/features/workflows/types'
import type { BreakdownState } from '@/features/breakdown/types'
@@ -9,6 +9,22 @@ function checkpoint(index: number, state: BreakdownState, workflowName = 'breakd
}
describe('Checkpoint 选择与恢复', () => {
it('正式工作区不会读取未提交候选,已有正式成果也不会被新候选覆盖', () => {
const candidate = checkpoint(2, { candidateOnly: true, subjectCandidates: [] })
expect(formalBreakdownSnapshot([candidate])).toBeNull()
const formal = checkpoint(1, { candidateOnly: true, candidateCommitted: true, storyboardPersisted: true, subjectCandidates: [], storyboardShotValidation: { valid: true, issues: [] } })
expect(formalBreakdownSnapshot([formal, candidate])?.candidateCommitted).toBe(true)
})
it('顶层修复和正式提交结果覆盖同一检查点内的旧嵌套质量状态', () => {
const result = breakdownSnapshot([checkpoint(1, {
candidateOnly: true,
candidateCommitted: true,
storyboardPersisted: true,
storyboardShotValidation: { valid: true, issues: [] },
breakdownResult: { storyboardShotValidation: { valid: false, issues: [{ episodeNo: 1, message: '旧错误' }] } }
})])
expect(result?.breakdownResult?.storyboardShotValidation).toEqual({ valid: true, issues: [] })
})
it('按 graph 隔离并保持输入不可变', () => {
const records = [checkpoint(2, {}), checkpoint(1, {}, 'create-drama')]
expect(workflowCheckpoints(records, 'breakdown').map(item => item.checkpointId)).toEqual(['2'])