Repository navigation
feat(toolchain): 工具定义可用 executableLinksOutsideHome 接受链接到主目录外的程序 - #177
Merged
Merged
Conversation
项目外虚拟环境的 bin/python3 链接到基础解释器,Homebrew 的 libexec/bin/python3 链接到 libexec 外的 framework,以前都以 unsafePath 拒绝(1lck/Lithe-IDEA#2316)。 - toolDefinitions 0 内的补充:可选布尔字段 executableLinksOutsideHome,不升版本。 - 写 true 后,程序的链接目标可以在主目录外;主目录到程序之间的目录必须被观察到、 规范路径在主目录内且不在工作区内,目标也不能在工作区内。 - 这类程序的探针和启动用规范主目录下的布局路径,不用链接目标。 - 固定、fixed、homeVariable、发现和提供者报告走同一处检查;项目候选不受影响。
This was referenced Nov 23, 2026
xiaoyumuxi
marked this pull request as ready for review
November 23, 2026 04:45
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.
背景
1lck/Lithe-IDEA#2316:项目外的虚拟环境(
python -m venv、uv、Poetry 等在 macOS 和 Linux 上建的环境)和 Homebrew Python 都选不进「工具链」页。前者的bin/python3链接到环境外的基础解释器,后者的libexec/bin/python3链接到libexec外的 framework。checked_installation要求链接目标在规范主目录内,所以两者都以unsafePath拒绝。就算接受了也不能用链接目标启动:Python 按启动路径找pyvenv.cfg,从目标启动就跑成了基础解释器,丢掉环境里的包。改动
executableLinksOutsideHome,是toolDefinitions0 内的补充,不升版本。不写或写false时行为不变,其他值以plugin.manifest.invalid(字段toolDefinitions.executableLinksOutsideHome)拒绝。query.rs的checked_installation:true才接受,并且主目录到程序之间的每级目录(如bin)都必须被观察到是目录、规范路径在规范主目录内且不在任何工作区内(新函数contained_parents)。返回的executable是规范主目录下的布局路径,不是链接目标。fixed:{home}、homeVariable、发现规则和提供者报告都经过这一处,项目候选走projectKind的规则,不受影响。toolchains/README.md、reference/domains/toolchains.md(中英)写明字段、检查规则、启动路径、宿主需要观察中间目录,以及旧宿主的 Core 会拒绝写了它的清单。宿主那边记录主目录的布局程序时还没有观察中间目录;缺这些事实时 Core 按原样拒绝,不会放宽。桌面端接入(观察中间目录、换固定版本)另开 PR。
宿主方法
验证
tool_definitions_may_let_their_program_link_outside_the_home_within_version_0:requires.toolDefinitions: 0时接受,注册表保留字段;"true"、1、null被拒绝。toolchain_resolution_starts_an_environment_linked_outside_its_home_from_its_layout:没有字段时unsafePath;有字段时fixed:{home}和JAVA_HOME两条路线都选中环境,executable、导出和pathPrepend都用环境路径,未探针时的待探针路径也是布局路径。toolchain_resolution_accepts_a_program_linked_to_a_sibling_of_its_home:Homebrew 式主目录经发现和经opt别名的固定都选中规范主目录下的布局路径。toolchain_resolution_refuses_links_outside_the_home_that_reach_the_workspace_or_skip_bin:目标在工作区内、bin链接到别处、bin没有被观察到,三种都以unsafePath拒绝。cargo test --locked -p lithe-toolchain -p lithe-core:全部通过(lithe-core单元测试 903 个)。cargo clippy --locked -p lithe-toolchain -p lithe-core --all-targets --all-features -- -D warnings、cargo fmt --check。cargo clippy --locked -p lithe-toolchain --all-targets --target x86_64-pc-windows-msvc -- -D warnings(lithe-core的 Windows 目标在本机编不了 sqlite,交给 CI)。node shared/plugins/scripts/verify-docs.mjs、node scripts/rust-core/verify-platform-tests.mjs、scripts/rust-core/verify-rust-core-comments.sh。