Repository navigation
Guard pip updates against in-place migration to the split layout - #10015
loopx-agent merged 5 commits into
Conversation
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
在原 pip 环境执行 LoopX 更新、可以先在独立环境试迁移的现有用户。 主干直接运行 pip install --upgrade loopx。若索引选中依赖型 split 包,pip 将先处理其组件,而旧 monolith 仍持有交叠文件的 RECORD。 真实 pip 先解析候选;若是 split 就原地拒绝。通过的同布局产物用 URL 和 SHA-256 固定,仍走现有安装后检验。 安装现有单包后,本地包仓让 pip 解析到仅依赖 loopx-core 的新发布。 有界改变现有 pip 更新下的布局选择与回执,保留包管理器和原安装的回退方式。
改动思路 / Approach
复用原 Python 包管理器命令、安装世代读回和更新回执。有界改变现有 pip 更新下的布局选择与回执,保留包管理器和原安装的回退方式。 将 preflight 放在现有安装边界,使用原安装器同一命令和来源解析,再复用原验证与退出状态。 检查 pip report 的规范包名及依赖;拒绝 split;已解析的新单包按 artifact hash 封闭。
具体改动 / Changes
- 真实解析 通过原 pip 命令的 dry run 得到依赖和实际下载物。split 元数据或 Core 依赖使执行留在更新前,回复中提供迁移路径。
- 固定可应用目标 将已通过的同布局目标固定到 artifact URL 和摘要。索引晚到的 split 版本不会重选,新字节也须满足原 digest。
- 执行器分流 复用原包管理器和已安装 package identity 的读回。没有安装动作的拒绝直接退出执行。
- 后台状态 允许 execution 为空,保留原错误和进程终态。旧环境可继续使用,并能按独立环境路径迁移。
基线 dc0505e 的 安装所有者 与 安装后读回 对应 保留安装所有权 和 终态明确可读与回退。
对主干的风险 / Risks
从本提交构建 wheel,安装到隔离环境,再由真实 pip 解析本地 split 元包。已安装的 update apply 拒绝,终态 status 保留原因,2275 个包拥有文件字节一致,原 CLI 可用。 真实 pip 同布局对照中,解析后出现更高版本 split 时仍安装已核验的 3.0.0 单包。已核验 wheel 的同版本字节被替换时 hash 校验失败并保留 2.4.1。 pipx 与 archive 不进入这个 preflight。原安装后验证仍由原执行器处理;同布局真实 pip 可以成功更新。 223 项定向 Python 测试通过,3 项平台用例跳过。Quick premerge 的 6 项直接和 3 项选定检查通过。 独立验证使用 macOS、离线 wheel 和临时安装。Windows、真实外部私有索引和稳定渠道 rollout 未在本轮复验。 当前主干 ca020c4 三方组合干净。
我的整体评价 / Verdict
批准这个 pip 更新边界。真实安装拒绝在原环境采用 split,原文件和 CLI 仍可继续使用。同布局升级及产物校验失败的路径也在隔离安装器中验证。
英文简短结论
English verdict: APPROVE at ba5f59c. An installed wheel refuses the split metapackage before changing any owned files. A real pip run keeps the verified monolith when a newer split appears and rejects replacement bytes under the same version.
…lidate-10015-pip-update-current-main-20261204 Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…015-split-guard Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
在单包 pip 环境中请求升级到新分包布局的操作者。 拒绝不受支持的原地布局切换,同时保留同布局升级和拆分版的维护路径。 目标指向分包时,旧包仍可能尝试沿现有 pip 安装路径进入不同布局。 升级检查识别相同 wheel 元数据,拒绝需要独立环境的目标,先于实际安装调用。 与当前主干整合的实际测试 223 项通过,平台专用用例跳过 3 项。现头另跑分包保护和 LaunchAgent 相关 5 项通过。 只处理升级分发选择、恢复说明和激活用例。新分包发布和旧环境迁移仍走原入口。
改动思路 / Approach
升级检查识别相同 wheel 元数据,拒绝需要独立环境的目标,先于实际安装调用。 复用现有分包计划、wheel 校验和已安装环境 owner。 只处理升级分发选择、恢复说明和激活用例。新分包发布和旧环境迁移仍走原入口。
具体改动 / Changes
提交 ff4890a3c2106b8ad4e7c869107b336cd430ca37,对照 8a90a051b43336b7fee828ab00f31c89b4b4b0be。
关键代码讲解
loopx/self_update.py:686的build_update_plan。确定同布局和跨布局的升级边界。tests/test_self_update_runtime_activation.py:631的test_pip_apply_refuses_split_target_before_starting_install。验证目标布局不支持时不执行安装。
语义与 CI 对齐
现有配置或安装 authority 沿用既有实现。 按分发 owner 计划、校验分包制品、拒绝不兼容原地安装;保持 pipx 环境及维护行为。
对主干的风险 / Risks
目标泄露凭据或半切换会导致原环境不可维护。拒绝在安装调用前发生,不以目标名称推断已成功激活。 构造 pip 到分包的升级计划,观测到拒绝且没有安装调用。当前主干会额外做机器身份读取,因此只按 launchctl 精确核验待重启服务。 验证本地命令和测试夹具。真实公共包发布不属于此 PR。并发 canary 达到时间上限,最新主干整合后分开执行真实本地安装和归档安装均通过。 已使用目标调用复核结果和本地差异门禁。
我的整体评价 / Verdict
APPROVE。 与当前主干整合的实际测试 223 项通过,平台专用用例跳过 3 项。现头另跑分包保护和 LaunchAgent 相关 5 项通过。 保留已安装环境的 owner,并在执行入口复核计划和精确制品。
English verdict: APPROVE at ff4890a. Monolithic pip updates reject an in-place split-layout conversion before the installer runs. The qualified existing update and activation routes stay available.
Problem
A pip-backed monolithic LoopX installation can resolve a dependency-only split metapackage during
loopx update apply. pip installs the split dependencies before removing the old monolith, whose RECORD still claims overlapping launcher and runtime files.Change
Verification
loopx update applyafter pip resolved a dependency-only split fixture. The refusal survived the detached operation, all 2,275 audited installed files retained their bytes, and the installed CLI remained usable.The already released updater still relies on the stable publication guard and the isolated migration path during the split rollout. This proposal covers the pip-owned installation path.
Native Windows follow-up
The exact head
ba5f59cc41passed installed qualification on Windows x64 with Python 3.11.9 and pip 25.1.1.Review follow-up
Revision
ff6ebe7849againstmain@0e784d7cba. The six-file patch is unchanged against current main. The focused source suites passed 223 cases with three platform skips. A real pip interpreter refused the split fixture without changing the installed monolith, used the pinned wheel even after a newer split fixture appeared, and refused different bytes offered under the same URL and version. Source install, packaged-archive install, and update smokes passed after preparing the verified Chat bundle before packaging. The native Windows verification above was recorded on the earlier revision of the same patch.