fix(deploy): repair missing router public-key path after partial activation

Live evidence showed a healthy candidate connector and a restarting router:
legacy router environment omitted HN_CONNECTOR_PUBLIC_KEY, so the new routing
verifier tried runtime/pki/connector.pub instead of the existing /trust mount.

Resolve the public key from the existing read-only trust bind, set its path
in new overlays, and actually load it during isolated runtime checks. Add
repair-router for a known healthy candidate connector: preserve credential
keys and live configuration, back up overlay/plan, add only the router path,
update integrity metadata, probe, and recreate router alone with --no-deps.
Retries do not regenerate keys or overwrite repair backups.

Add read-only state including stopped/restarting containers and fixed startup
error classes, including stderr, without printing raw logs or credentials.
Identify command stage/exit code and activation progress. Permit rollback
of known stopped candidate targets and old overlays without requiring the
new router key; unknown images still fail closed.

Validation: full suite 262 passed, 3 skipped (real PostgreSQL unavailable),
30 existing warnings; final tooling suite 50 passed after the added CLI
rollback regression. Python 3.7 syntax and staged diff checks pass.
No live repair was executed by this agent; operator must run repair-router
and verify health and the real client handshake on ECS.
This commit is contained in:
ex_tianzy
2026-11-04 16:27:47 +08:00
parent 2657146334
commit 8a94d60155
4 changed files with 332 additions and 17 deletions
+10
View File
@@ -188,3 +188,13 @@ Windows / Python 3.12.10,平台桩、临时证书/密钥、SQLite及带Lua的F
新增11项工具回归,覆盖合法环境保持、HTTPS/WSS/数据库失败在写密钥前拒绝、只读diagnose保留全部准备文件、错误不泄露数据库凭据;工具专项40项通过。实际现场哪项原始条件不符仍以更新后的diagnose输出为准,不将历史默认值当作当前配置证明。
修订后完整本地回归:**253 passed,3 skipped,30 warnings**(49.46秒);真实PostgreSQL仍未提供,warnings类型同上,Python3.7语法与diff检查通过。
### 部分切换故障与router公钥路径修复
现场activate只输出通用Docker失败,用户随后提供状态:connector已是broker候选并healthy,router同候选持续Restarting(1)。进一步只读确认router未配置HN_CONNECTOR_PUBLIC_KEY,实际日志FileNotFoundError指向默认runtime/pki/connector.pub。这是旧router此前不消费connector公钥,而新模式开始验证路由签名后,迁移叠加漏传原信任目录公钥路径;首次import/Settings探测未实际打开公钥,没提前发现。
修订新prepare识别现有只读信任挂载中的公钥并显式传HN_CONNECTOR_PUBLIC_KEY,runtime_check挂载并实际load_public。新增repair-router面向已知健康候选connector的部分切换,备份叠加/plan、保留keyring/原.env/其他镜像,只补router路径并重建router。原密钥或运行配置漂移时拒绝,不自动删除/重准备。
新增state只读查看停止/重启容器并对本地日志只提取固定错误类(包含Docker logs的stderr);run错误报告阶段/退出码而非原始配置。activate输出阶段,明确up失败可能部分切换。rollback的目标服务可为已停止的已知原/候选容器,不再因只查询运行容器而无法识别;未知镜像仍拒绝。
工具专项50项通过(新增state/部分回滚/错误脱敏4项、公钥修复5项、旧部分计划CLI回滚1项)。完整本地回归262 passed、3 skipped、30 warnings(49.76秒),之后追加的回滚入口检查再次通过工具50项;Python3.7语法与diff检查通过。真实PostgreSQL仍未提供。实际修复结果仍需现场执行并核验,不能把本地Docker桩通过当作router已恢复。