feat(cli): reconcile externally replaced npm Runtime Hosts - #4069
feat(cli): reconcile externally replaced npm Runtime Hosts#4069me2seeks wants to merge 4 commits into
Conversation
Post-implementation dual audit — GOFirst-principles correctness
Simplification / deletion proof
Validation at 中文审计结论结论:GO。实现仍只有一份 owner/handoff/lease authority。旧版本通过其自身 helper 兼容不同 epoch,新版本通过共享 activator 等待精确 Ready 后才提交;用户确认后的 Host 若已经换了 epoch,不会被误关闭。活跃工作会回滚,退休开始后的故障保留 handoff 供恢复。实现还删除了重新联网下载旧版本的路径,直接验证持久化的精确旧包;没有新增 scheduler、journal、lock 或第二份恢复状态。远程与托管 Host 仍由各自 operator 更新。 |
fdc4364 to
4b3368e
Compare
|
Maintainer findings independently confirmed and fixed at
Regression coverage includes an injected authority read failure followed by exact committed ownership (release, never retire), readable uncommitted handoff retirement, uncertain coordinator commit settlement, and Desktop-to-CLI owner mismatch with no staging or Host observation. Validation: CLI build; focused 42/42; full CLI 617/617; release policy 15/15; scoped Biome and diff-check. 中文修复说明两条结论均确认属实并已修复。父进程不再发送 committed/abort 裁决,只触发结算;activator 统一读取 durable record 决定 release 或 retire,读取不确定时继续持有 barrier/lease。外部 npm reconciliation 明确只支持同一 durable npm-global owner;跨 owner 在任何 registry、stage、store 或 Host 操作前返回 typed 拒绝。 |
Summary
The installed npm slot is already changed in this flow, so this PR does not run npm, add an update scheduler, or introduce another owner, journal, or lock. Cross-owner transfer, remote Hosts, and managed service Hosts remain under their respective owner/operator paths.
Safety invariants
Validation
npm run build --prefix packages/cligit diff --checkRefs #3243
Refs #3231
中文说明
本 PR 处理同一 durable npm-global installation owner 已被用户通过 npm 外部替换、但旧 Runtime Host 仍在运行的情况。不同 owner 的转移不属于本切片,会在解析 registry、stage 或观察 Host 前 typed 拒绝。
新 CLI 不直接假装兼容旧 Host,而是从持久化部署中启动旧版本自己的 retirement helper;旧版本负责按自己的协议安全退休旧 Host,新版本再通过共享 activator 启动并验证精确目标。父 coordinator 的成功、失败或断线都不再决定 target 的关闭与保留;activator 统一读取 durable owner record 后裁决。读取不确定时保留 barrier 与 authority lease,读到 exact committed 才 release,否则才 retire。
不在本 PR 范围内:跨 owner transfer、远程 Host、systemd 等托管 Host、npx 临时运行语义、自动检查周期与 TUI 文案。