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

@@ -13,6 +13,8 @@ import { readAllStyles } from '@/testing/styles'
import { effectScope } from 'vue'
import { useWorkflowExecution } from '@/features/workflows/execution'
import { workflowExecutionApi } from '@/features/workflows/execution-api'
import { breakdownApi } from '@/features/breakdown/api'
import { candidateCheckpoint, candidateReview, candidateState } from '../../fixtures/breakdown-candidate'
let wrapper: VueWrapper | undefined
/** 跨组件后台任务观察器,验证结束时释放。 */
@@ -68,6 +70,48 @@ it('后台重新拆解时显示真实运行状态并隐藏所有诊断入口,
tracker.dismiss()
})
it('候选审核通过后只展示候选,修复后的正式结果不再被嵌套历史五个错误污染', async () => {
const old = Array.from({ length: 5 }, (_, index) => ({ episodeNo: 1, message: `历史错误 ${index}` }))
const current = candidateCheckpoint(candidateState({ projectId: 'breakdown-scroll-test', breakdownResult: { storyboardShotValidation: { valid: false, issues: old } } }))
const read = vi.spyOn(breakdownApi, 'revalidateCandidate').mockResolvedValue(candidateReview({ projectId: 'breakdown-scroll-test', previousIssues: old }))
const provided = mountPage([current])
expect(wrapper!.text()).not.toContain('分镜校验未通过')
await flushPromises()
expect(wrapper!.text()).toContain('拆解候选 · 尚未提交正式结果')
expect(wrapper!.find('button.breakdown-desktop-issues').exists()).toBe(false)
expect(wrapper!.find('.subject-record-actions router-link-stub').exists()).toBe(false)
await selectTab('分镜')
expect(wrapper!.find('.storyboard-diagnosis-summary').exists()).toBe(false)
expect(read).toHaveBeenCalledTimes(1)
provided.data.value!.checkpoints = [{ ...current, state: { ...current.state, storyboardPersisted: true, candidateCommitted: true } }]
await selectTab('人物')
await flushPromises()
expect(wrapper!.text()).toContain('正式拆解结果')
expect(wrapper!.text()).toContain('已提交正式结果')
expect(wrapper!.text()).not.toContain('分镜校验未通过')
expect(read).toHaveBeenCalledTimes(1)
})
it('历史修复元数据不能掩盖之后新任务的真实失败', async () => {
const current = candidateCheckpoint(candidateState({ projectId: 'breakdown-scroll-test', storyboardPersisted: true, candidateCommitted: true }))
mountPage([current])
const record = {
id: 'new-failed-breakdown', projectId: 'breakdown-scroll-test', workflowName: 'breakdown',
status: 'failed' as const, stage: 'failed', current: 0, total: 3, currentResourceId: null,
metadata: null, result: null, error: '新任务执行失败',
startedAt: '2026-10-17T10:00:00Z', completedAt: '2026-10-17T10:01:00Z',
createdAt: '2026-10-17T10:00:00Z', updatedAt: '2026-10-17T10:01:00Z'
}
vi.spyOn(workflowExecutionApi, 'get').mockResolvedValue(record)
taskScope = effectScope()
const tracker = taskScope.run(() => useWorkflowExecution(ref(record.projectId), 'breakdown'))!
await tracker.track(record.id)
await flushPromises()
expect(wrapper!.text()).toContain('工作流失败')
expect(wrapper!.find('button.breakdown-desktop-issues').exists()).toBe(true)
tracker.dismiss()
})
/** 长主体、长分镜与长任务列表,用真实 Naive 滚动组件验证内容边界。 */
function checkpoint(): Checkpoint {
const plan: EpisodePlan = {