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:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -22,6 +23,24 @@ func (s verifyEvidenceStore) LatestLibraryRestoreVerification(context.Context, s
|
||||
return s.evidence, s.found, nil
|
||||
}
|
||||
|
||||
// 审核 B3:读取失败不能被 env=true 洗成"满足"。
|
||||
type unreadableEvidenceStore struct{}
|
||||
|
||||
func (unreadableEvidenceStore) LatestLibraryRestoreVerification(context.Context, string) (governance.LibraryRestoreVerification, bool, error) {
|
||||
return governance.LibraryRestoreVerification{}, false, errors.New("evidence lookup failed")
|
||||
}
|
||||
|
||||
func TestWorkerUnreadableEvidenceBeatsEnv(t *testing.T) {
|
||||
ok, reason := libraryRestoreEvidenceSatisfied(context.Background(), unreadableEvidenceStore{},
|
||||
appconfig.Config{ProductionBackupRestoreVerified: true}, "internal")
|
||||
if ok {
|
||||
t.Fatalf("unreadable evidence must block even with env=true; reason=%q", reason)
|
||||
}
|
||||
if !strings.Contains(reason, "读取恢复验证证据失败") {
|
||||
t.Fatalf("reason=%q", reason)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLibraryRestoreEvidenceSatisfied(t *testing.T) {
|
||||
now := time.Now().UTC()
|
||||
passed := verifyEvidenceStore{found: true, evidence: governance.LibraryRestoreVerification{
|
||||
|
||||
Reference in New Issue
Block a user