fix(api+frontend): codex review 六件——死因空白strip/终态422防500/落盘回读断言/validator精确断言/promoted确认路径/文案不越权承诺 [vps]
CI/CD / test (push) Successful in 41s
CI/CD / nas-deploy (push) Failing after 14s
CI/CD / nas-verify (push) Has been skipped

This commit is contained in:
2026-10-09 20:21:23 +08:00
parent 10a6af6338
commit 9475836c38
6 changed files with 97 additions and 49 deletions
@@ -76,10 +76,10 @@ describe('FactorDetail.vue 危险区送墓园(2026-10-09 补丁)', () => {
vi.mocked(api.postFactorVerdict).mockResolvedValue({ ok: true, action: 'graveyard' })
const w = await mountDetail()
await w.find('.grave-btn').trigger('click')
// validator:空死因拒/非空过
// validator:空死因拒(返回提示串)/非空过(严格 true)——codex review HIGH-3 断言精确化
const validator = captured.inputValidator as (v: string) => string | boolean
expect(validator('')).toBeTruthy()
expect(validator(' ')).toBeTruthy()
expect(validator('')).toBe('死因必填')
expect(validator(' ')).toBe('死因必填')
expect(validator('死因')).toBe(true)
expect(api.postFactorVerdict).toHaveBeenCalledWith(
'insider_buy_decay60', 'graveyard', [], '概念与既有因子重复')
@@ -103,4 +103,18 @@ describe('FactorDetail.vue 危险区送墓园(2026-10-09 补丁)', () => {
expect(api.postFactorVerdict).not.toHaveBeenCalled()
confirmSpy.mockRestore()
})
it('promoted 重确认通过后继续送墓园(确认路径,decaying 同款文案)', async () => {
// codex review MEDIUM-3:补确认继续路径+生产态危险区提示
vi.spyOn(ElMessageBox, 'confirm').mockResolvedValue({} as never)
vi.spyOn(ElMessageBox, 'prompt').mockResolvedValue({ value: '衰减不止' } as never)
vi.mocked(api.postFactorVerdict).mockResolvedValue({ ok: true, action: 'graveyard' })
const w = await mountDetail({
factor: { ...DETAIL.factor, status: 'decaying' },
birth: null,
})
expect(w.text()).toContain('生产因子判死需二次确认')
await w.find('.grave-btn').trigger('click')
expect(api.postFactorVerdict).toHaveBeenCalledWith(
'insider_buy_decay60', 'graveyard', [], '衰减不止')
})
})
+2 -1
View File
@@ -56,7 +56,8 @@ async function sendToGraveyard(): Promise<void> {
burying.value = true
try {
await postFactorVerdict(name.value, 'graveyard', [], note)
ElMessage.success('已入墓园(卡片已回写)')
// codex review LOW-2:回写失败后端会降级留附记,不在此承诺「已回写」
ElMessage.success('已入墓园')
router.push('/pipeline/factors')
} catch (e) {
ElMessage.error(`判死失败: ${e instanceof Error ? e.message : e}`)