ReconcileLibraryJobs 不再把 completed capture queue 当成不存在,保留待核对 pending 封存作业;failed/cancelled/missing 仍按真实队列状态处置。管理员核对 入口只允许精确的启动误判形态,并要求 completed queue、export succeeded、 唯一 test_sealed 版本、来源身份与完整归档复核。新增 library_job_repairs 不可变审计表,在同一事务内 CAS 保存原 state/stage/error/recovery/finished_at 及本次 actor/原因/证据后修复;真实失败/取消不开放。 验证:真实隔离 PostgreSQL 启动收敛 RED/GREEN、启动→handler 纵向 pending 与 系统误判 failed、审计保留/幂等、负例;真实 Go 全量与 make verify 17 项通过。
This commit is contained in:
@@ -744,6 +744,32 @@ describe('ReleaseTargetsView(确认稿布局)', () => {
|
||||
expect(engineer).not.toContain('核对封存结果')
|
||||
})
|
||||
|
||||
it('系统误判的封存作业(已完成队列+成功导出)仍可由管理员核对;真实失败不显示', () => {
|
||||
const misclassified: LibraryJobRecord = {
|
||||
...persistedSeal,
|
||||
state: 'failed',
|
||||
stage: '',
|
||||
snapshot_id: '',
|
||||
error: '队列中已无对应作业,业务作业未收到结果',
|
||||
recovery: '封存作业由 agent 恢复来源;确认来源 healthy 后可重发',
|
||||
stages: [{ ...persistedSeal.stages[0], state: 'succeeded' }],
|
||||
}
|
||||
const admin = render({
|
||||
canReconcileCapture: true,
|
||||
overview: { ...overview, job: misclassified, jobs: [misclassified] },
|
||||
})
|
||||
expect(admin).toContain('核对封存结果')
|
||||
const realFailure = render({
|
||||
canReconcileCapture: true,
|
||||
overview: {
|
||||
...overview,
|
||||
job: { ...misclassified, error: '真实导出失败' },
|
||||
jobs: [{ ...misclassified, error: '真实导出失败' }],
|
||||
},
|
||||
})
|
||||
expect(realFailure).not.toContain('核对封存结果')
|
||||
})
|
||||
|
||||
it('封存作业只显示只读导出步骤,不冒充生产备份/同步/生效或目标维护', () => {
|
||||
const html = render({
|
||||
jobs: [runningJob],
|
||||
|
||||
@@ -1107,6 +1107,14 @@ function ProgressBody({
|
||||
// 不是"只有 sync 才有"。写死 sync 会让恢复作业的分项全显示"未接入"。
|
||||
const dataJob = job && job.kind !== 'seal' ? job : undefined
|
||||
const running = job?.state === 'running' || job?.state === 'pending'
|
||||
// Startup reconciliation used to rewrite a completed capture as "队列不存在".
|
||||
// Only that exact legacy shape gets an admin reconcile action; real failures do not.
|
||||
const legacyOrphan =
|
||||
sealJob?.state === 'failed' &&
|
||||
sealJob.stage === '' &&
|
||||
sealJob.snapshot_id === '' &&
|
||||
sealJob.error === '队列中已无对应作业,业务作业未收到结果' &&
|
||||
sealJob.recovery === '封存作业由 agent 恢复来源;确认来源 healthy 后可重发'
|
||||
const stage = (name: string) => (dataJob ?? sealJob)?.stages.find((item) => item.stage === name)
|
||||
|
||||
// F11: counts must belong to the snapshot this job actually used. A newly
|
||||
@@ -1197,7 +1205,7 @@ function ProgressBody({
|
||||
<StageBar view={view} />
|
||||
{sealJob &&
|
||||
canReconcileCapture &&
|
||||
(sealJob.state === 'pending' || sealJob.state === 'running') &&
|
||||
(sealJob.state === 'pending' || sealJob.state === 'running' || legacyOrphan) &&
|
||||
stage('export')?.state === 'succeeded' ? (
|
||||
<div className="rel-between rel-progress-foot" aria-label="核对封存结果">
|
||||
<span>队列已完成、导出阶段已成功,但作业终态尚未回写。</span>
|
||||
@@ -1869,7 +1877,17 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
const internal = scopeView(page, jobs, 'internal', scopedOverview('internal'))
|
||||
const external = scopeView(page, jobs, 'external', scopedOverview('external'))
|
||||
const view = scope === 'internal' ? internal : external
|
||||
const active = Boolean(view.activeJob) || view.job?.state === 'running' || view.job?.state === 'pending'
|
||||
const legacyOrphanJob = Boolean(
|
||||
view.job &&
|
||||
view.job.kind === 'seal' &&
|
||||
view.job.state === 'failed' &&
|
||||
view.job.stage === '' &&
|
||||
view.job.snapshot_id === '' &&
|
||||
view.job.error === '队列中已无对应作业,业务作业未收到结果' &&
|
||||
view.job.recovery === '封存作业由 agent 恢复来源;确认来源 healthy 后可重发'
|
||||
)
|
||||
const active =
|
||||
Boolean(view.activeJob) || view.job?.state === 'running' || view.job?.state === 'pending' || legacyOrphanJob
|
||||
// F06: 运行中禁止再次启动,也禁止把主按钮继续显示成可启动的绿色动作。
|
||||
const runningJob = active && view.job ? view.job : undefined
|
||||
// 三类版本严格分开:target 是测试封存,production 是生产权威版本,prebackup 是本次预备份。
|
||||
|
||||
Reference in New Issue
Block a user