fix(library): DS01 激活消费真实维护 journal 证据

为什么:v1 激活门只重算调用方自填 JSON 的 sha256,stopped/queue_drained 仍是声明,
不是排空事实。v2 证据只声明身份,事实改由 Store 读取维护窗口 journal(入口
drained+active_at_close=0、quiesce 全零且停写后复核、writer stop_requested+退出码)
与治理库实例维护行(同作业/实例/指纹/level、未释放、writer 集合一致)核出;缺受信
journal 根或构建身份未注入即失败关闭。

同时把 r38 激活移到维护窗口 held 的当下(barrier 点,真实只读观察),更新 PG/adapter
夹具与 F3 反例(伪造/替换摘要、错 writer 集合、未退出、未排空、过期、库/指纹/构建
不符、窗口已释放、journal 已 recovered、未配置受信根),并更名 beforeCommit 用例。
This commit is contained in:
姚章浩
2026-11-02 18:48:10 +08:00
parent 3b7ad9061c
commit 1c58f1ef7e
16 changed files with 1107 additions and 243 deletions
+2 -1
View File
@@ -142,7 +142,8 @@ func run(ctx context.Context, getenv func(string) string) error {
} else if len(pending) > 0 {
return fmt.Errorf("治理库 schema 落后(待应用迁移 %v):本角色不拥有 DDL,先由控制面进程完成迁移", pending)
}
store := postgresstore.NewStore(pool).WithLibraryTarget(config.LibraryTargetIdentity())
store := postgresstore.NewStore(pool).WithLibraryTarget(config.LibraryTargetIdentity()).
WithRestoreDispatchEvidence(config.LibraryTargetJournalRoot)
log.Printf("library target evidence identity=%s", config.LibraryTargetIdentity())
// 启动先接管被中断的写作业(复用已持久化的预备份),再把剩下的孤儿判失败:
// 顺序反了会把可接管的作业先标失败,丢掉已完成的备份。