Add install preflight safeguards (T-303)

This commit is contained in:
ila
2026-07-18 18:14:25 +08:00
parent 449b183ca3
commit ae3f64c407
8 changed files with 655 additions and 44 deletions
+7 -3
View File
@@ -3,12 +3,12 @@ id: T-303
title: 失败处理与磁盘预检查
phase: 3
deps: [T-302]
status: TODO
status: DONE
created: 2026-07-18
issue: null
context_ref: null
context_ref: 449b1832741bef57fd6ef9bc771d2702a9120dc5
claim_branch: null
work_branch: null
work_branch: agent/codex/T-303
write_paths:
- docs/tasks/T-303.md
- core/application/install/
@@ -56,3 +56,7 @@ T-302 已把已验签 Catalog selection、同句柄 package 校验、严格 `app
## 执行记录
- 2026-07-18:正式落成。冻结 verified-package hook、64 MiB 解压保留、强制注入 disk/target-state checker、稳定失败码及 T-401 的进程检测边界。
- 2026-07-18:领取任务,基线为 `449b1832741bef57fd6ef9bc771d2702a9120dc5`,工作分支 `agent/codex/T-303`;下一步运行统一初始化/完整基线,再开始实现。
- 2026-07-18:基线通过:`./init.ps1` 完成治理、core 架构/Go 版本闸门、Go 1.20 core vet/test、modern/Win7 test/build 与 Python harness 校验。
- 2026-07-18:实现 verified-package pre-extract hook(仅暴露已验证 payload bytes/files/entrypoint)和 `InstallServiceConfig` 的强制 disk/target-state 注入;预检在严格 ZIP/app manifest 验证后、staging 创建前执行,空间阈值固定为 payload 加 64 MiB。稳定 `FailureCode` 保留原始 `errors.Is` 原因,未引入 Windows API 或命令层装配。
- 2026-07-18:复核成功、精确容量阈值、首次/更新磁盘不足、磁盘/运行状态查询故障、运行中、哈希不符、CRC 损坏、hook 顺序及旧版本/记录保护;`go -C core vet ./...`、`go -C core test -count=1 ./...`、`go -C core test -count=10 ./installer ./application/install`、`./scripts/verify_phase0.ps1`、`python scripts/validate_agent_context.py` 与 `python scripts/validate_harness_governance.py` 全部通过。Windows Toolhelp/正常退出等待和命令层实际装配仍保留给 T-401。