fix(library): 维护收尾必须按预备份恢复并校验
build / build (push) Successful in 1m20s

删掉会自己开入口、只看服务健康的 FinalizeAfterOperatorRecovery。
新的 RecoverWindow 绑定原作业/目标指纹/持久化预备份,在维护关闭下
执行恢复与逐类校验,通过才恢复服务与入口;失败继续维护。
预备份身份与内容风险在第一笔写入前一起落盘;后台任务必须静默后才停写者;
写入者发布端口即拒绝开窗口;维护占用改为按实例互斥(000072)。
This commit is contained in:
姚章浩
2026-10-29 00:50:32 +08:00
parent ec737a9a65
commit 3643e9bf82
26 changed files with 1730 additions and 225 deletions
+1 -30
View File
@@ -90,8 +90,6 @@ func main() {
runErr = runVerify(opts)
case "recover":
runErr = runRecover(ctx, opts)
case "finalize":
runErr = runFinalize(ctx, opts)
default:
usage()
os.Exit(2)
@@ -103,7 +101,7 @@ func main() {
}
func usage() {
fmt.Fprint(os.Stderr, `libraryctl <status|preflight|capture|list|verify|recover|finalize> [flags]
fmt.Fprint(os.Stderr, `libraryctl <status|preflight|capture|list|verify|recover> [flags]
status probe the real source and print what is configured / blocked
preflight read the source, run settlement + candidate validation (no writes, no stop)
@@ -111,8 +109,6 @@ func usage() {
list list sealed candidates and stored bytes
verify re-verify one sealed candidate (digests, coverage, identity)
recover restore writers from an interrupted freeze journal
finalize close a held window after an operator recovered the target by hand
(verifies services + ingress are really serving; starts nothing)
Flags (defaults target the local WKNFull test stack):
-source-app WKNFull-app container whose env describes the source
@@ -821,31 +817,6 @@ func runVerify(opts options) error {
return nil
}
func runFinalize(ctx context.Context, opts options) error {
if opts.job == "" {
return errors.New("finalize requires -job")
}
coordinator, control, err := openFreeze(ctx, opts)
if err != nil {
return err
}
defer coordinator.Close()
defer control.Close()
if err := coordinator.FinalizeAfterOperatorRecovery(ctx, opts.job); err != nil {
return err
}
items, err := control.Inventory(ctx)
if err != nil {
return err
}
group := []map[string]any{}
for _, item := range items {
group = append(group, map[string]any{"id": item.ID, "running": item.Running, "healthy": item.Healthy})
}
printJSON(map[string]any{"finalized": opts.job, "code": "operator_recovered", "writers": group})
return nil
}
func runRecover(ctx context.Context, opts options) error {
coordinator, control, err := openFreeze(ctx, opts)
if err != nil {