fix(library): 打通恢复验证的正常恢复与页面联动
build / build (push) Successful in 1m35s

B1/B2:演练在同一维护切点做两次真实捕获(写前镜像与来源身份),
写集合在写第一笔之前落盘并登记;恢复走限定范围的 RestoreDrill,
复用同一份 DS01 身份合同与 Apply 原语整段回放,不再让同快照必被拒绝。
worker 接治理维护生命周期(实例+scope 行、真实入口状态、成功才释放),
held 保留行并由同 job 的 library.recover 收口(kind 过滤贯通 verify)。
B3:证据优先,failed/invalid 与读取错误即使 env=true 也拒绝。
B4/B5:GET 投影在飞作业,子面板回调父页面轮询;观测绑定 scope 与代次,
刷新失败明确过期,不再显示旧的"已验证"。
迁移 79 不自动 down;未部署、未调用业务目标。
This commit is contained in:
姚章浩
2026-11-03 11:14:27 +08:00
parent 5e1482e349
commit f9457fab52
22 changed files with 1145 additions and 136 deletions
+11 -3
View File
@@ -127,7 +127,10 @@ func runLibraryRecovery(ctx context.Context, store *postgresstore.Store, config
defer control.Close()
defer coordinator.Close()
restorer := recoveryRestorer{target: target, expected: prebackup, writeSet: ledger}
restorer := recoveryRestorer{target: target, expected: prebackup, writeSet: ledger,
// 恢复验证写的是"隔离 canary",不是发布计划:同一 job 的收尾走受限的演练
// 恢复入口(同样的身份合同 + 整段回放),不能拿发布计划合同去回放它。
drill: windowJob.Kind == governance.LibraryJobVerify}
verifier := recoveryVerifier{target: target, expected: prebackup}
result, recoverErr := coordinator.RecoverWindow(ctx, payload.WindowJobID, restorer, verifier)
now := time.Now().UTC()
@@ -171,6 +174,8 @@ type recoveryRestorer struct {
target *v071.ProductionLibraryTarget
expected string
writeSet *libraryrelease.WriteSet
// drill 表示窗口属于恢复演练:它的写集合是 canary,不是发布执行计划。
drill bool
}
func (r recoveryRestorer) Restore(ctx context.Context, backupID string) error {
@@ -183,8 +188,11 @@ func (r recoveryRestorer) Restore(ctx context.Context, backupID string) error {
if r.writeSet.BackupSnapshotID != backupID {
return fmt.Errorf("写集合记录绑定预备份 %s,不是 %s", r.writeSet.BackupSnapshotID, backupID)
}
return r.target.Restore(ctx, libraryrelease.BackupRef{ID: "backup-" + backupID, SnapshotID: backupID,
WriteSet: r.writeSet})
ref := libraryrelease.BackupRef{ID: "backup-" + backupID, SnapshotID: backupID, WriteSet: r.writeSet}
if r.drill {
return r.target.RestoreDrill(ctx, ref)
}
return r.target.Restore(ctx, ref)
}
// recoveryVerifier 做真实的内容校验,并把目标当前状态摘要作为"校验过什么"的凭证。