fix(library): 修复封存终态回写并增加精确核对
build / build (push) Successful in 2m9s

修复 varchar 状态参数在 AdvanceLibraryJob 的 42P08;worker 开始/终态写入失败
不再吞掉。新增管理员核对路由,仅在 completed capture queue、export succeeded、
精确 test_sealed 版本、来源身份和归档复核一致时,以条件更新修复仍为
pending/running 的同一作业;已有不同快照或并发失败/取消行拒绝覆盖。保留
第一因与历史记录,不重新封存、不产生快照、不写源或目标知识。

验证:真实 varchar DDL PG 路径、handler 负例/幂等、worker 注入、web 组件;
umask022 与真实隔离 kg_library_test_* 下 Go 全量与 make verify 17 项通过。
This commit is contained in:
姚章浩
2026-11-06 10:04:19 +08:00
parent 77bbc3ac6b
commit 146ac832a2
18 changed files with 1082 additions and 39 deletions
+21
View File
@@ -171,6 +171,9 @@ const base: ViewProps = {
pendingCapture: false,
canCapture: true,
canWrite: true,
canReconcileCapture: false,
pendingReconcileCapture: '',
onReconcileCapture: vi.fn(),
canRestore: false,
sync: { canSign: false, pendingGrant: false, onGrant: vi.fn(), canStart: false, pending: false, onStart: vi.fn() },
baseline: { canStart: false, pending: false, onStart: vi.fn() },
@@ -723,6 +726,24 @@ describe('ReleaseTargetsView(确认稿布局)', () => {
expect(html).not.toContain('已完成 0 / 0')
})
it('封存已完成但终态未回写时,管理员看到核对入口;工程师不显示', () => {
const reconciled: LibraryJobRecord = {
...persistedSeal,
stages: [{ ...persistedSeal.stages[0], state: 'succeeded', detail: '已封存快照 f992d64ea45b' }],
}
const admin = render({
canReconcileCapture: true,
onReconcileCapture: vi.fn(),
overview: { ...overview, job: reconciled, jobs: [reconciled] },
})
expect(admin).toContain('核对封存结果')
const engineer = render({
canReconcileCapture: false,
overview: { ...overview, job: reconciled, jobs: [reconciled] },
})
expect(engineer).not.toContain('核对封存结果')
})
it('封存作业只显示只读导出步骤,不冒充生产备份/同步/生效或目标维护', () => {
const html = render({
jobs: [runningJob],