Repository navigation
fix(toolchain): 固定 Lithe-core-rust#135,rustup 的 cargo 代理按原名启动 - #2242
Merged
Merged
Conversation
rustup 把 ~/.cargo/bin/cargo、rust-analyzer 链接到自身,按启动时的名字决定运行哪个工具。 固定的 Core 把它们解析成 rustup,版本探针跑的是 rustup --version,工具定义永远找不到 cargo。 #135 让布局文件链接到另一个文件名时返回布局路径。
用合成工具定义把 jre/bin/vm 链接到同目录的 multiplexer,断言宿主选中的可执行文件是 vm, 版本来自对 vm 的探针。对应 rustup 把 cargo、rust-analyzer 链接到自身的情况(Lithe-core-rust#135)。
xiaoyumuxi
marked this pull request as ready for review
November 20, 2026 15:45
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
rustup 把
~/.cargo/bin/cargo、rust-analyzer等做成指向~/.cargo/bin/rustup的符号链接,rustup 按启动时的文件名决定运行哪个工具。现在固定的 Core 校验外部安装时,把可执行文件解析成规范路径~/.cargo/bin/rustup交回宿主;宿主用这个路径运行版本探针,实际跑的是rustup --version,输出对不上 cargo 的版本格式,安装被判为版本不满足。结果是在 macOS 和 Linux 上,用 rustup 装 Rust 的人:Windows 上 rustup 的代理是硬链接,不受影响。
改动 / Changes
scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION从72036de(main)升到8291f3c。这是 Lithe-core-rust#135 的分支提交,基于 main72036de,只多了 Check for Windows updates on startup #135 的修复:布局文件链接到另一个文件名时,Core 返回规范主目录下的布局路径(…/bin/cargo),不再返回链接目标(…/bin/rustup)。版本管理器的同名别名链接、Homebrew 的../libexec/bin/go这类文件名相同的链接,仍然返回规范路径,行为不变。desktop/internal/toolchain/multicall_link_other_test.go:用测试内联的合成工具定义(testdata/runtime.plugin.json),把jre/bin/vm链接到同目录的multiplexer。断言宿主加载工具链后选中的可执行文件是…/jre/bin/vm,版本 7.1 来自对vm的探针。Windows 上创建符号链接需要特权,所以这个文件只在非 Windows 上编译,和storage_link_other_test.go一样。不在本 PR 范围内 / Out of scope
类型专属:fix
复现与根因
~/.cargo/bin/cargo -> rustup),装一个声明cargo工具定义的插件,打开「构建、执行、部署 › 工具链」。实际:Cargo 一项没有安装,跟踪里是版本不满足。期望:列出~/.cargo/bin/cargo和它的版本,可以固定到项目。toolchaincrate 的checked_installation校验外部安装时,把规范路径作为 selection 的executable返回。git log -L追到 Core 的 1d632ab,这个函数从那时起就这样,不是最近的回归;第一个把 rustup 代理当作工具定义入口的插件(Rust Support)把它暴露了出来。检查项
desktop/internal/toolchain/multicall_link_other_test.go。修复前(Core main72036de)失败:trace reason = versionUnsatisfied、the linked installation was not selected;升到8291f3c后通过。 Core 一侧的回归测试是 Check for Windows updates on startup #135 里的toolchain_resolution_starts_a_multi_call_link_by_its_layout_name,去掉修复时也会失败。core.ToolchainSelection.Executable使用这个路径(探针、启动、固定),不自己解析链接;修复只改变“布局文件名与链接目标文件名不同”时返回的路径。canonicalize不改变文件名,没有这个问题;Windows 宿主用同一份 Core,不需要单独修复。.agents/notes/implemented/bug-fix/记录:规则写在 Core 契约toolchains/README.md和参考文档里(Check for Windows updates on startup #135),回归测试在 Core 和本仓库各一份。范围检查 / Scope checks
功能矩阵 / Feature matrix
N/A:不新增宿主能力,也不改变跨平台行为的定义,只是让已有的工具定义解析在 rustup 链接上得出正确结果。
插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空shared/i18n/;插件的构建步骤、资源路径和补丁没有写进docs/ci-builds.md、Agent Note 或 Skill./internal/projectgen的四个TestRustPlugin*通过,项目固定的 Cargo 是 rustup 的~/.cargo/bin/cargo;./internal/workbench的TestRustSupportPluginBuildsAndServesAPackage通过(构建、运行、Features、rust-analyzer 诊断),TestRustSupportPluginDownloadsCodeLLDBAndDebugsAProgram通过(按需下载并校验 CodeLLDB 1.12.3,先用 rustup 的 cargo 构建,停在断点、读到变量,继续后正常结束)。其他已发布插件的工具定义(Go 的 Homebrew../libexec/bin/go、JDK 的bin/java)链接前后文件名相同,返回值不变。UI 验证 / UI evidence
N/A:没有布局、控件、样式或文案变化。
统一日志系统 / Structured logging
N/A:没有新增或改动日志事件。
界面文案 / i18n
N/A:没有新增或修改用户可见文字。
逻辑归属 / Logic placement
refactorIssue:没有改平台层逻辑。性能与内存 / Performance and memory
N/A:不新增后台功能、子进程或缓存,也不改动启动、输入、滚动等路径。
设置 / Settings
N/A:不新增或修改设置项。
插件契约 / Plugin contract
toolchains/README.md补了一段说明,更新记录写在“待合入”)scripts/desktop/build-desktop-core.sh的PINNED_CORE_REVISION已升到包含该契约的 Core commit,桌面端测试经scripts/desktop/desktop-go.sh读到的就是这份契约node shared/plugins/scripts/sdk-e2e.mjs,所有官方 SDK 的示例后端仍能跑通:没改插件后端协议。发行包与资源 / Bundle and resources
N/A:不新增运行时资源、缓存、下载物或构建步骤。
无用代码与重构 / Dead code and refactoring
refactor标签的 Issue,没有在本 PR 顺手处理:没有发现。验证 / Verification
LITHE_CORE_RUST_DIR=<Core #135 检出> scripts/desktop/desktop-go.sh test ./internal/toolchain/... ./internal/projectgen/... -count=172036de(修复前)versionUnsatisfied,没有选中链接的安装rg插件归属自查命令./internal/projectgen -run '^TestRustPlugin',插件包 0.1.0,Core 为 #135./internal/workbench -run '^TestRustSupportPlugin(BuildsAndServesAPackage|DownloadsCodeLLDBAndDebugsAProgram)$',插件包 0.1.0,Core 为 #135未能执行的检查和原因:
./internal/toolchain由 CI 运行。提交前确认 / Final checks
main创建;目标分支:feat、fix、docs 为main,release 以发布流程要求为准.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏的日志或截图