Harden self-update recovery (T-617)

This commit is contained in:
ila
2026-07-20 00:05:41 +08:00
parent ea1d6c8ee4
commit 24e9862192
12 changed files with 369 additions and 42 deletions
+6 -3
View File
@@ -3,12 +3,12 @@ id: T-617
title: 自更新事务恢复与健康门禁加固
phase: 4
deps: [T-403]
status: TODO
status: DONE
created: 2026-07-19
issue: null
context_ref: null
context_ref: ea1d6c83742eb882f28a9a4dbe18382aedb15e78
claim_branch: null
work_branch: null
work_branch: agent/codex/T-617
write_paths:
- docs/tasks/T-617.md
- core/updater/updater.go
@@ -60,3 +60,6 @@ write_paths:
## 执行记录
- 2026-07-19:正式落成。根据 Phase 4 审核 O1/O4 及补充状态机复核,冻结“prepared rename 后 sync 失败必须恢复/保留、五 phase Recover、故障错误链与双端 health flag 参数拒绝”的最小整改闭环;真实 Windows 锁与发布侧装配继续后置。
- 2026-07-19:领取任务,基于 `ea1d6c83742eb882f28a9a4dbe18382aedb15e78` 在 `agent/codex/T-617` 执行;先重跑基线,再修复 prepared durability 后的恢复状态机并补测试。
- 2026-07-19:完成。`prepared` Recover 现按经 `Lstat` 验证的 target/backup 实际拓扑收敛:target 存在且 backup 缺失才删 journal,target 缺失且 managed backup 存在先 restore,其余组合保留材料并返回 `ErrRecoveryRequired`;首次 backup rename 的目录 sync 错误会立即走同一恢复路径。rollback/restore 的恢复码与底层 rename/sync 根因均用 Go 1.20 多重 `%w` 保留。新增可计数 `DirectorySyncer` 失败测试,覆盖 prepared rename+sync 即时/下次恢复、prepared 矛盾布局/restore fence、health timeout 后 rollback 阻塞再 Recover、五个持久 phase、transaction 写入/同步和 committed cleanup sync;双端 `cmd/softbox` 新增内部 health flag 缺 ID/多余参数拒绝测试。未伪造真实 Windows EXE 锁、杀毒或断电结论。
- 2026-07-19:验证通过:`./init.ps1`、`go -C core vet ./...`、`go -C core test -count=1 ./...`、`go -C core test -count=10 ./updater`、modern/Win7 `go test -count=1 ./...`、双端 Windows amd64 `softbox`/`softboxupdater` 构建、`./scripts/verify_phase0.ps1`、`python scripts/validate_agent_context.py`、`python scripts/validate_harness_governance.py` 与 `git diff --check`。