Repository navigation
fix(desktop): isolate bundled runtime installer Git context - #6286
Conversation
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; runtime_reported; gpt-6.1-sol; OpenAI; xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
未发现阻塞此有界修复的代码问题。评审 exact head 4618f071893dee44f93301646faeb13bcf93084c;完整启动与协作验收保持独立,不以安装成功代替它们。
动机
开发者在仓库目录内暂存 App 运行时,或从带 Git 环境变量的终端启动 App。 此前,已校验的运行时归档会被记录为另一工作区的分支和脏状态;现在,安装结果保留归档的 revision,并将不属于归档的 Git 元数据留空。 真实安装器的持久化 release.json 已通过两种反例验证,默认 CLI 内容保持原样。 本 PR 不改变用户版本选择、首屏、签名策略或通用源码安装器,也不宣称完成整个 App 升级或团队协作验收。 最终用户窗口在再次升级后的捕获超时,完整启动矩阵、Windows 和业务协作验收仍需独立证据。
改动思路
现有原生安装器边界足以隔离临时归档的 Git 上下文;不需要第二个来源判定器。 本轮只修复真实运行时安装结果中的错误 Git 元数据,并保留版本选择、外部 CLI 与恢复机制。 只清除 Git 目录覆盖会漏掉父仓库,只加 ceiling 会漏掉显式覆盖;两者需一起作用于现有子进程。签名与 digest 仍先校验,源码版本、私有安装位置、选择与重试机制沿用既有 owner。
规范:docs/architecture/rfcs/desktop-execution-frontends-v0.md,spec_revision c464cf308c3c9bad5d1109a758d30dc3620bfde4。据规范现有段落逐项判断:Desktop shell CLI/HTTP artifact selection 保持独立绑定和归档身份;independently managed CLI 通过真实安装及回滚读回保留;ordinary packaged restart 的完整资格仍留在既有验收中,本轮最终原生捕获超时,未用 HTTP 健康代替可见窗口证明。
具体改动
install_snapshot 在临时目录的父目录设置 GIT_CEILING_DIRECTORIES,并仅对安装器子进程清除 GIT_DIR、GIT_WORK_TREE、GIT_COMMON_DIR、GIT_INDEX_FILE。install_private 仍从 App 自带归档与 identity 进入该路径。现有 real_private_installer_keeps_the_default_cli_owner 独立读取落盘 release.json,新增非 Git 归档的 branch/dirty 留空断言,同时保留 revision 与外部 CLI 内容断言。README 四行公开说明这项默认变化。
验证不是仅模拟字段:同一官方签名 Main 归档、真实安装脚本和隔离状态下,原实现被新增语义断言击穿(exit 101),修复在父仓库 TMPDIR 与显式 Git 覆盖两种条件均通过(exit 0)。第一版将 ceiling 放在当前目录仍失败,最终改为父目录后才通过。已验证 native 代码在 rebase 后字节未变;保持同一归档与执行条件。Cargo 104 passed / 2 ignored,另显式执行真实安装、stable/Main 签名与篡改拒绝、真实备份签名测试;fmt、clippy、semantic check、macOS 打包通过。全部选择的 premerge 命令通过,托管 quality-receipt gate 待本 exact-head 评审写回。未查询或等待 CI。
对主干的风险
影响仅在 Desktop 的已校验归档子进程。通用源码 checkout 安装器仍能读取自身 Git 元数据,运行时选择、HTTP/CLI 身份与外部 CLI 所有权不改;无新协议、状态、权限、配置开关或首屏改动。相关 caller/owner 与两文件全 diff 已检查,未发现重复决策 owner、领域专用义务、默认关闭承诺或文字启发式分类。
实际候选 macOS 包已启动并准备匹配运行时;宿主未接受它要求的环境隔离,故不把该窗口当作坏环境反例,反例由独立真实安装器提供。Windows、完整用户业务旅程及最终再次升级后的原生截图未验证。已执行真实官方升级、回滚和再升级,HTTP/默认 CLI 与 11 个 session 的 ID/status 保留;该独立软件维护证据不代表此尚未合并补丁已安装。最强剩余缺口是完整原生窗口/平台矩阵;无需扩张这个来源元数据修复去重写整个启动器。
我的整体评价
APPROVE:修复真实来源污染并保留已有安装/选择边界。31 行增量包含 10 行生产上下文约束、17 行既有真实测试加强和 4 行说明;未来改动已局部化在同一原生 provider owner,无额外框架或平行 Python 决策源。可单独回滚。评审结论不授予合并权限;托管质量回执与合并资格应独立读回。
English verdict: APPROVE - 4618f07; the verified Desktop export no longer borrows ambient Git provenance. Real base failure and two fixed installer cases, native checks, signed-artifact/tamper and backup tests support this bounded change. Windows and full bootstrap/collaboration acceptance remain unqualified.
When Desktop prepares its bundled runtime inside a repository-backed temporary directory, or a developer exports Git directory overrides, the child installer can attribute an unrelated branch and dirty state to the verified archive. Fence Git discovery at the staging parent and clear only directory/index overrides for that child; the bundled revision, digest, runtime selection and external CLI ownership retain their existing owners. This is a bounded S4/S12 preparation fix.
Validation: the real bundled-runtime installer fails the new provenance invariant on the base, then passes under repository-backed temporary storage and explicit Git overrides. An official signed desktop artifact supplies the actual payload. Cargo checks, semantic inventory/check, macOS bundle build and native startup were exercised; signed-artifact acceptance/tamper rejection and real backup-copy verification were also run. The guarded premerge checks and exact-scope change-quality receipt pass. The exact-head author-owned review is published; readiness is separate from maintainer merge authorization. Windows and full collaboration acceptance remain unqualified.
The related refactor keeps environment isolation in the existing native installer boundary, without a new helper or a second source-policy owner. The ordinary source-checkout installer is outside this change. No first-viewport presentation is changed.