fix(deploy): preserve legacy environment and diagnose prepared plans safely

The old initializer defaults HN_ENVIRONMENT to development, while migration
validation required the literal production and combined database/platform
prerequisites into one opaque error. Preserve supported environment identity
namespaces without editing the live .env; still require PostgreSQL and fixed
HTTPS/WSS endpoints for every existing-server migration. Match supported
boolean spellings and report failing field names without credential values.

Add read-only diagnose for an existing prepared plan so an earlier failed
prepare can be reviewed without deleting or regenerating its keyring. Move
future prerequisite validation before private directory/key generation.

Validation: 253 passed, 3 skipped (real PostgreSQL unavailable), 30 existing
warnings; 40 deployment-tool tests including 11 new compatibility/redaction
cases. Python 3.7 syntax and staged diff checks pass. Actual ECS diagnosis
must still confirm the current failing field; no live config or key changed.
This commit is contained in:
ex_tianzy
2026-11-04 13:59:22 +08:00
parent d3ce0099b7
commit 2657146334
4 changed files with 124 additions and 7 deletions
+10
View File
@@ -178,3 +178,13 @@ Windows / Python 3.12.10,平台桩、临时证书/密钥、SQLite及带Lua的F
修订Compose命令统一显式指定`--profile longconn`,不启用未知profile;保留服务集合严格校验并在不符时仅输出missing/extra服务名。后续up仍限connector/router且带--no-deps。新增3项回归模拟被profile隐藏的服务及缺失/多出服务的安全诊断,本地工具测试29项通过;现机实际解析结果仍需更新后重跑确认,不将该推断当作已经现场复现的唯一原因。
修订后完整本地回归:**242 passed,3 skipped,30 warnings**(48.50秒)。跳过与warnings类型同上,宿主脚本Python3.7语法及diff检查通过。
### 准备阶段配置诊断兼容修订
现场prepare在platform/database配置检查处停止,未切换容器;原流程在最后验证前已生成私有plan/keyring,不得删除重建来绕过。核对旧初始化器默认environment=development,首版工具错误地要求字面production,可能误拒绝现有测试部署;同时数据库/开关条件合并导致现场无法辨别具体字段。
新版按现有Settings接受production/development/test,保持原身份命名空间和原.env,所有部署环境仍强制PostgreSQL、固定HTTPS平台/公开入口和WSS,不降低网络校验。布尔开关对齐Settings接受true/1/yes/on。错误只列字段,不回显数据库URL等敏感值;新增diagnose只读已有plan,无需重生成keyring。未来prepare在生成私有目录前先验证必要条件。
新增11项工具回归,覆盖合法环境保持、HTTPS/WSS/数据库失败在写密钥前拒绝、只读diagnose保留全部准备文件、错误不泄露数据库凭据;工具专项40项通过。实际现场哪项原始条件不符仍以更新后的diagnose输出为准,不将历史默认值当作当前配置证明。
修订后完整本地回归:**253 passed,3 skipped,30 warnings**(49.46秒);真实PostgreSQL仍未提供,warnings类型同上,Python3.7语法与diff检查通过。