fix(short-drama-agent-front): 修复B01分镜与历史失败状态

This commit is contained in:
GJ committed 2026-11-04 17:22:22 +08:00
1 parent ecb0423153
commit 75e86f7486
4 files changed
+123 -31

No files matched your search

+82 -2
View File
@@ -410,6 +410,81 @@ it('候选审核通过后只展示候选,修复后的正式结果不再被嵌
expect(read).toHaveBeenCalledTimes(1)
})
it('原位采用的正式分镜显示完整统计,先前失败仅进入历史执行记录', async () => {
const state = candidateState({
projectId: 'breakdown-scroll-test',
storyboardPersisted: true,
candidateCommitted: true
})
const episode = state.storyboardEpisodeShots![0]!
const example = episode.beatShots[0]!.shots[0]!
state.storyboardEpisodeShots = [17, 13, 16, 14].map((count, index) => ({
episodeNo: index + 1,
episodePlan: { ...episode.episodePlan, episodeNo: index + 1 },
beatShots: [
{
beatNo: episode.beatShots[0]!.beatNo,
shots: Array.from({ length: count }, (_, shotIndex) => {
const subjectBindings = Array.from(
{ length: index === 0 && shotIndex < 7 ? 5 : 4 },
(_binding, i) => ({
...example.subjectBindings![0]!,
subjectRef: '@CH000' + (i + 1)
})
)
return {
...example,
shotNo: shotIndex + 1,
subjectRefs: subjectBindings.map(item => item.subjectRef),
subjectBindings
}
})
}
]
}))
const current = {
...candidateCheckpoint(state),
updatedAt: '2026-10-17T10:05:00Z'
}
mountPage([current], 4)
const record = {
id: 'failed-before-in-place-adoption',
projectId: 'breakdown-scroll-test',
workflowName: 'breakdown',
status: 'failed' as const,
stage: 'failed',
current: 2,
total: 4,
currentResourceId: null,
metadata: null,
result: null,
error: '历史分镜时长冲突',
startedAt: '2026-10-17T09:20:00Z',
completedAt: '2026-10-17T10:00:00Z',
createdAt: '2026-10-17T09:20:00Z',
updatedAt: '2026-10-17T10:00:00Z'
}
vi.spyOn(workflowExecutionApi, 'get').mockResolvedValue(record)
const preview = vi.spyOn(breakdownApi, 'candidateCommitPreview')
taskScope = effectScope()
const tracker = taskScope.run(() => useWorkflowExecution(ref(record.projectId), 'breakdown'))!
await tracker.track(record.id)
await flushPromises()
expect(wrapper!.text()).toMatch(/正式拆解结果\s*·\s*4 集\s*·\s*60 镜\s*·\s*247 条绑定/)
expect(wrapper!.text()).toContain('已提交正式结果')
expect(wrapper!.text()).not.toContain('工作流失败')
expect(wrapper!.find('button.breakdown-desktop-issues').exists()).toBe(false)
expect(preview).not.toHaveBeenCalled()
await wrapper!.get('[data-workspace-tools]').trigger('click')
await flushPromises()
expect(drawerPanel().text()).toContain('历史拆解执行记录')
await drawerPanel().get('.breakdown-execution-history .n-collapse-item__header-main').trigger('click')
await flushPromises()
expect(drawerPanel().text()).toContain('历史执行记录')
expect(drawerPanel().get('[aria-label="历史拆解任务"]').attributes('data-task-state')).toBe('unknown')
tracker.dismiss()
})
it('历史修复元数据不能掩盖之后新任务的真实失败', async () => {
const current = candidateCheckpoint(
candidateState({ projectId: 'breakdown-scroll-test', storyboardPersisted: true, candidateCommitted: true })
@@ -531,7 +606,7 @@ function mountPage(records = [checkpoint()], episodes = 1): ReturnType<typeof us
style: '',
status: 'completed',
durationMode: 'auto',
episodeCount: 1,
episodeCount: episodes,
targetDurationSeconds: null,
episodeMinSeconds: null,
episodeMaxSeconds: null,
@@ -540,7 +615,12 @@ function mountPage(records = [checkpoint()], episodes = 1): ReturnType<typeof us
characters: [],
world: null,
episodes: episodes ? [{ episode: 1, targetDurationSeconds: null, title: '第一集', content: '正文' }] : []
episodes: Array.from({ length: episodes }, (_, index) => ({
episode: index + 1,
targetDurationSeconds: null,
title: index === 0 ? '第一集' : `第 ${index + 1} 集`,
content: '正文'
}))
}
const data = ref({
project,