feat(short-drama-agent-front): 补齐首帧审核与视线修订
This commit is contained in:
1 parent
c7a6b12261
commit
0d58dd8c53
25 files changed
+1140
-30
No files matched your search
@@ -0,0 +1,77 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
validAssessment,
|
||||
type ApplicabilityBasis,
|
||||
type EvidenceAssessment
|
||||
} from '@/features/production/source-applicability'
|
||||
/** 正式完整依据,不按物件名称推断。 */
|
||||
const basis: ApplicabilityBasis = {
|
||||
fingerprint: 'a'.repeat(64),
|
||||
actionIds: ['a1', 'a2'],
|
||||
cameraMovement: 'static',
|
||||
references: [{ imageNumber: 1, subjectRefs: ['@SC1'] }],
|
||||
facts: {}
|
||||
}
|
||||
/**
|
||||
* 构建已经逐项核对的人工范围。
|
||||
* @returns 完整声明
|
||||
*/
|
||||
function assessment(): EvidenceAssessment {
|
||||
return {
|
||||
imageNumber: 1,
|
||||
dimension: 'structure',
|
||||
featureKey: '局部结构',
|
||||
subjectRef: '@SC1',
|
||||
requirement: 'non_blocking_unknown',
|
||||
evidence: '当前镜头不可见,其它证据已核对',
|
||||
actions: ['a1', 'a2'].map(actionId => ({ actionId, requiresEvidence: false, reason: '当前动作不依赖此结构' })),
|
||||
stateRequiresEvidence: false,
|
||||
framingRequiresEvidence: false,
|
||||
noVisibleContradiction: true,
|
||||
remainingEvidenceVerified: true
|
||||
}
|
||||
}
|
||||
describe('有界证据适用性', () => {
|
||||
it('仅完整正式依据与人工声明可准备非阻断范围', () => {
|
||||
expect(validAssessment(assessment(), basis)).toBe(true)
|
||||
})
|
||||
it.each(['pan', null])('非固定或缺失机位 %s 拒绝豁免', cameraMovement => {
|
||||
expect(validAssessment(assessment(), { ...basis, cameraMovement })).toBe(false)
|
||||
})
|
||||
it('动作缺失、遗漏、重复均不可豁免', () => {
|
||||
expect(validAssessment(assessment(), { ...basis, actionIds: null })).toBe(false)
|
||||
const item = assessment()
|
||||
item.actions.pop()
|
||||
expect(validAssessment(item, basis)).toBe(false)
|
||||
item.actions.push(item.actions[0]!)
|
||||
expect(validAssessment(item, basis)).toBe(false)
|
||||
})
|
||||
it('外来主体和未确认反证不可豁免', () => {
|
||||
const item = assessment()
|
||||
item.subjectRef = '@SC2'
|
||||
expect(validAssessment(item, basis)).toBe(false)
|
||||
item.subjectRef = '@SC1'
|
||||
item.noVisibleContradiction = null
|
||||
expect(validAssessment(item, basis)).toBe(false)
|
||||
})
|
||||
it('任何必要依赖或反证均拒绝非阻断', () => {
|
||||
for (const field of ['stateRequiresEvidence', 'framingRequiresEvidence'] as const) {
|
||||
const item = assessment()
|
||||
item[field] = true
|
||||
expect(validAssessment(item, basis)).toBe(false)
|
||||
}
|
||||
const item = assessment()
|
||||
item.actions[0]!.requiresEvidence = true
|
||||
expect(validAssessment(item, basis)).toBe(false)
|
||||
item.actions[0]!.requiresEvidence = false
|
||||
item.noVisibleContradiction = false
|
||||
expect(validAssessment(item, basis)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
it('正式审核原件读取路径可以进入公共图片组件,任意路径不扩展权限', async () => {
|
||||
const { validationImageUrl } = await import('@/features/production/validation-preview')
|
||||
const path = '/api/storyboard-shots/s/keyframes/k/generation-input/references/1?projectId=p'
|
||||
expect(validationImageUrl(path)).toBe(new URL(path, window.location.origin).href)
|
||||
expect(validationImageUrl('/api/private')).toBe('/api/private')
|
||||
})
|
||||
@@ -1,3 +1,4 @@
|
||||
import { validationPreview } from '../../fixtures/validation-preview'
|
||||
import { ApiError } from '@/lib/http'
|
||||
import { defineComponent, reactive, ref } from 'vue'
|
||||
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
@@ -37,6 +38,7 @@ afterEach(() => {
|
||||
|
||||
/** 模拟统一配置后的真实契约,测试绝不调用真实图片或视觉模型。 */
|
||||
function server() {
|
||||
const plan = structuredClone(validationPreview)
|
||||
const projectId = `quality-test-${sequence++}`
|
||||
const project = testProjectContext(projectId).project.value!
|
||||
const validation = {
|
||||
@@ -164,6 +166,7 @@ function server() {
|
||||
}
|
||||
else if (String(url).endsWith('/checkpoints?view=summary')) data = []
|
||||
else if (path.endsWith('/production/entry-readiness')) data = { ready: true }
|
||||
else if (path.endsWith('/validate/preview')) data = plan
|
||||
else if (path.endsWith('/validations')) data = []
|
||||
else if (path.endsWith('/quality-review'))
|
||||
data = {
|
||||
@@ -191,6 +194,7 @@ function server() {
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
return {
|
||||
projectId,
|
||||
plan,
|
||||
project,
|
||||
validation,
|
||||
keyframe,
|
||||
@@ -461,8 +465,9 @@ describe('质量面板渐进展示', () => {
|
||||
})
|
||||
await flushPromises()
|
||||
expect(validationButton().disabled).toBe(true)
|
||||
expect(document.body.textContent).toContain('更多参数与模型限制')
|
||||
expect(document.querySelector('[aria-label="额外允许的画面文字"]')).not.toBeNull()
|
||||
expect(document.body.textContent).toContain('免费审核预检')
|
||||
expect(document.body.textContent).toContain('未知,需先核对费用范围')
|
||||
expect(document.querySelector('[aria-label="额外允许的画面文字"]')).toBeNull()
|
||||
expect(data.posts()).toHaveLength(0)
|
||||
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
|
||||
await flushPromises()
|
||||
@@ -639,3 +644,47 @@ describe('视频修复候选与复检晋升', () => {
|
||||
expect(data.posts()).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('普通审核计划保护', () => {
|
||||
it.each(['blocked', 'reusable'] as const)('%s 不允许新审核且不自动收费', async status => {
|
||||
const data = server()
|
||||
data.plan.status = status
|
||||
if (status === 'reusable') data.plan.reusableResult = { passed: false, summary: '旧失败结论' }
|
||||
else data.plan.activeTasks = [{ status: 'running' }]
|
||||
wrapper = mount(QualityDialog, {
|
||||
attachTo: document.body,
|
||||
props: {
|
||||
projectId: data.projectId,
|
||||
target: { kind: 'keyframe', shotId: 'shot-1', assetId: 'keyframe-1', title: '计划保护' },
|
||||
open: true,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
await flushPromises()
|
||||
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
|
||||
await flushPromises()
|
||||
expect(validationButton().disabled).toBe(true)
|
||||
expect(data.posts()).toHaveLength(0)
|
||||
expect(document.body.textContent).toContain(status === 'reusable' ? '历史审核:未通过' : '正在执行')
|
||||
})
|
||||
it('批准后计划变化撤销提交,刷新后等待重新确认', async () => {
|
||||
const data = server()
|
||||
wrapper = mount(QualityDialog, {
|
||||
attachTo: document.body,
|
||||
props: {
|
||||
projectId: data.projectId,
|
||||
target: { kind: 'keyframe', shotId: 'shot-1', assetId: 'keyframe-1', title: '计划保护' },
|
||||
open: true,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
await flushPromises()
|
||||
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
|
||||
await flushPromises()
|
||||
data.plan.validationFingerprint = 'b'.repeat(64)
|
||||
validationButton().click()
|
||||
await flushPromises()
|
||||
expect(data.posts()).toHaveLength(0)
|
||||
expect(validationButton().disabled).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -276,3 +276,25 @@ it('抽屉使用真实表单,打开只读历史,免费预检逐项展示全
|
||||
wrapper.unmount()
|
||||
}
|
||||
})
|
||||
|
||||
/** 非阻断只依据服务端资格开放免费计划,未知观察和机器质量保持独立。 */
|
||||
it('当前非阻断来源可查看独立计划,服务端明确拒绝时关闭入口', async () => {
|
||||
const mock = sourceMock('non_blocking_unknown')
|
||||
Object.assign(mock.record, { validationEligible: true })
|
||||
mock.record.review.observations[0]!.finding.structure = 'unknown'
|
||||
vi.stubGlobal('fetch', mock.fetcher)
|
||||
const form = scope.run(() => useSourceReview(ref(JSON.stringify(['s', 'k', 'p']))))!
|
||||
await flushPromises()
|
||||
form.reviewId.value = 'r'
|
||||
await form.readRecord()
|
||||
await form.loadPlan()
|
||||
expect(form.plan.value?.reviewId).toBe('r')
|
||||
expect(form.record.value?.review.observations[0]!.finding.structure).toBe('unknown')
|
||||
expect(mock.calls.every(call => call.body === null)).toBe(true)
|
||||
form.plan.value = null
|
||||
Object.assign(form.record.value!, { validationEligible: false, reviewStatus: 'passed' })
|
||||
const before = mock.calls.length
|
||||
await form.loadPlan()
|
||||
expect(mock.calls.length).toBe(before)
|
||||
expect(form.plan.value).toBeNull()
|
||||
})
|
||||
Reference in new issue
Block a user