fix(library): 收口 B1-R1/B2-R1/B5-R1 并让恢复链经过正式队列终态

B1-R1: 演练写集改为受限 restore-drill(V2 信封/contract 1/schema 摘要,零对象、零索引、零本地映射,来源身份必填)。B2-R1: verify 作业先建不可变 operation 并携带 operation_id,同 job recover 的网关 claim 同时携带原 operation 与 recovery 身份。B5-R1: 前端按 scope 世代与动作序号丢弃迟到响应,不污染新 scope 或父级旧回调。harness 的 recovery 改由生产 jobs.Worker.RunOnce 消费并读回 jobs 终态;原失败窗口作业保持 failed,不改写历史。
This commit is contained in:
姚章浩
2026-11-03 13:02:42 +08:00
parent f9457fab52
commit b4add6c9b0
12 changed files with 1515 additions and 18 deletions
+8
View File
@@ -99,6 +99,14 @@ func TestLibraryVerifyEnqueuesVerifyJobWithCanaryStages(t *testing.T) {
if !strings.HasPrefix(store.lastJob.ID, "libverify-internal-") {
t.Fatalf("job id=%q", store.lastJob.ID)
}
// B2-R1:verify 作业必须带不可变 operation,worker 的 owned attempt / 恢复派发
// 身份都从它取;没有 operation 的作业在真实恢复时会被 fail closed。
if store.lastJob.OperationID == "" || store.lastJob.OperationID != store.lastOperation.ID {
t.Fatalf("verify job must carry its operation: job=%#v op=%#v", store.lastJob, store.lastOperation)
}
if store.lastOperation.Kind != governance.LibraryJobVerify || store.lastOperation.Scope != "internal" {
t.Fatalf("verify operation identity=%#v", store.lastOperation)
}
// 阶段必须包含 canary:没有"写 canary 证明校验有效"这一步,验证就只是自证。
want := governance.VerifyStages()
if len(want) != 5 || want[2] != "canary" || want[3] != "restore" || want[4] != "finalize" {