Repository navigation
refactor(build): 删除 KNOWN_RUNTIME_TOOLS,go、node 运行时依赖按工具定义解析 - #69
Merged
Merged
Conversation
构建系统的 runtimeDependencies 原来把 go、node 当作宿主管理的运行时:
计划返回 { kind: runtime } 候选和 Core 自带的版本参数(go version、
node --version),checkToolVersion 用 reported_version 读版本,清单里
不许给它们写 executables。这是 Core 认识具体工具的写死逻辑。
现在 Core 不认识任何具体运行时:没有 executables 的运行时一律是同 ID
工具定义的隐式引用,计划返回 toolchain 候选、version 为 null,版本由
工具定义检查;写了 executables 的按普通运行时校验。
- build:删除 KNOWN_RUNTIME_TOOLS、is_host_managed、宿主运行时校验分支、
host_runtime_version_arguments 和计划里的 hostManaged 字段
- plugin-model:删除只服务于它的 reported_version
- 测试:go、node、vm 走同一条路径;自己描述的运行时按自己的 pattern 读版本
- 契约:README、build-plans 与 invalid-manifests fixture、build-systems
参考页和协议更新记录;三处 runtime_tools 注释改成准确描述
Refs 1lck/Lithe-IDEA#1856
xiaoyumuxi
marked this pull request as ready for review
November 16, 2026 11:25
…-tool-definitions # Conflicts: # shared/plugins/reference/protocol-changelog.md
17 tasks done
15 tasks done
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
#1856 要求把 Core 里剩下的 5 类语言专属默认值移出 Core。本 PR 只做第 3 项(
go、node运行时)。第 5 项在 #66,第 2 项在 #68;第 1、4 项(忽略目录、运行发现)不在本 PR,#1856 保持打开。PR 类型 / Type
改动说明 / What changes
背景 / Why
构建系统的
invocation.runtimeDependencies原来把go、node当作“宿主管理的运行时”(build/src/manifest/invocation.rs的KNOWN_RUNTIME_TOOLS = ["go", "node"]):build.invocationPlan给它们返回{ "kind": "runtime" }候选、hostManaged: true,以及 Core 写死的版本参数:go是["version"],node是["--version"];build.checkToolVersion用reported_version从输出里取第一个点分数字;executables或version。这是 Core 认识具体工具的写死逻辑,违反“Core 对语言和工具零特判”。其他运行时早就能按同 ID 的工具定义解析,只有这两个例外。
改动 / Changes
buildKNOWN_RUNTIME_TOOLS、RuntimeDependency::is_host_managed和校验里的宿主运行时分支。names_tool_definition()现在就是“没有executables”,checked_by_tool_definition()也不再排除 go、node。host_runtime_version_arguments。runtime()不再为 go、node 生成{ "kind": "runtime" }候选,运行时计划删掉hostManaged字段。check_version只用清单声明的version.pattern。没有探测、按工具定义解析的运行时(现在也包括 go、node)照旧以plugin.build.unavailable拒绝。plugin-model:删除只有上面这处在用的reported_version(连同lib.rs的导出)。行为:
runtimeDependencies里不写executables的运行时,一律是同 ID 工具定义的隐式引用:{ "kind": "runtime", "runtime": "go" }{ "kind": "toolchain", "toolchainID": "go", "root": <root> }version{ "arguments": ["version"] }nullhostManagedtruepathVariableLITHE_GO_PATHreported_versionminimumVersionexecutablesplugin.manifest.invalid(“由宿主发现”)测试(
core/src/tests/build_runtime_versions.rs)vm、go、node在三个平台上走同一条路径:都得到 toolchain 候选、version: null、LITHE_<ID>_PATH;checkToolVersion都以plugin.build.unavailable拒绝。described_runtime_reads_its_own_probe:叫go但自己写了executables和version的运行时,按它自己的 pattern 读版本,并判断是否满足下限。reported_version。契约
contract/v1/README.md:工具链小节和构建系统字段表里的runtimeDependencies一行,去掉 “nodeandgoare host-managed” 和hostManaged,写明 Core 不认识任何具体运行时。build-plans.json:go 的计划用例改为 toolchain 候选;两个 go 版本用例合并成一个“版本由工具定义检查”的拒绝用例;gradle 两个用例去掉hostManaged: false。invalid-manifests.json:“host-managed runtime with its own executables” 改名为 “runtime minimum version with a command candidate but no probe”。它现在因为通用规则被拒绝(有minimumVersion的 command 候选需要探测),期望结果不变。reference/domains/build-systems.md中英两行、protocol-changelog.md(API-23,buildSystems0 内的修正)同步。build、vcs、debug三处runtime_tools字段的注释还写着 “host runtimes or tool-definition IDs”,实际只有requiresTools里的工具定义 ID,改成准确描述。兼容性与发布顺序 / Compatibility and rollout
runtimeDependencies: [{ "id": "go", "minimumVersion": "1.21" }],它自己在toolDefinitions里提供go,并在requiresTools里列出。is_tool_id("go")成立,所以清单照常通过;计划里的 toolchain 候选解析到插件自己的go工具定义,版本下限由它检查。仓库里没有声明node运行时依赖的已发布插件。"toolchain"候选(resolveToolchainSelection(..., minimum));version为null时不再额外探测;hostManaged一直只解码、不使用。合入后只需要升级PINNED_CORE_REVISION,同一个桌面端 PR 里顺手删掉已经不用的BuildRuntimeRequirement.HostManaged,以及"runtime"候选里查不到runtimes时退回工具定义、再退回PATH的分支(Core 校验保证"runtime"候选一定指向已声明的运行时依赖,而运行时依赖自己不会再是"runtime"候选)。go或node运行时依赖,却既没有提供也没有依赖同名工具定义。原来桌面端会退回PATH上的go、node,现在报“找不到可执行文件”。这正是 #1856 要求的:运行时依赖一律引用工具定义 ID。不在本 PR 范围内 / Out of scope
类型专属:fix
复现与根因
go运行时(例如用自己的executables指向特定位置),清单会以“go is discovered by the host”被拒绝;node、go的版本探测参数和读法写死在 Core 里,插件改不了。KNOWN_RUNTIME_TOOLS把两个具体工具写死在 Core 里。检查项
KNOWN_RUNTIME_TOOLS、is_host_managed、host_runtime_version_arguments、reported_version、hostManaged的全部调用方:Core 里只剩本 PR 改掉的这些;桌面端只有desktop/internal/core/build.go的HostManaged字段,没有读它的代码。范围检查 / Scope checks
插件契约 / Plugin contract
shared/plugins/contract/v1/:README、fixture 都在本 PR;协议更新记录已登记(buildSystems0 内的修正,API-23)。schema 里runtimeDependencies没有提到 go、node,不用改。hostManaged一个字段,唯一的宿主(Viva 桌面端)不读它。逻辑归属 / Logic placement
无用代码与重构 / Dead code and refactoring
reported_version、host_runtime_version_arguments和宿主运行时校验分支已删除;桌面端两处随之变成死代码的地方,在升级固定版本的 PR 里删除(见上)。其他组(功能矩阵、UI、日志、i18n、性能、设置、发行包):N/A,Core 这边没有涉及。
验证 / Verification
cargo fmt --all --checkcargo test -p lithe-build -p lithe-plugin-model -p lithe-corecargo clippy --workspace --all-targets --features lithe-remote/server -- -D warningsbash scripts/rust-core/verify-rust-core-comments.shnode scripts/rust-core/verify-platform-tests.mjsnode shared/plugins/scripts/verify-docs.mjsnode scripts/rust-core/affected-crates.mjs --base origin/main--workspace;macOS、Windows:lithe-platform 一组main(b6b4a49,固定本分支的基点 957a349):LITHE_CORE_RUST_DIR=<本分支> scripts/desktop/desktop-go.sh test -count=1 ./internal/core ./internal/pluginbackend ./internal/marketplace ./internal/pluginservice ./internal/workbenchmain4d10cd1,已发布的清单原样打包)的宿主 e2e:LITHE_CORE_RUST_DIR=<本分支> node scripts/e2e-host.mjs --ref b6b4a490191beb35525d28b3357b418f32a954c9TestOfficialGoPluginBuildsAndServesAModule用go运行时依赖做了真实的 build、vet、run,并覆盖 Go 可执行文件设置)未能执行的检查和原因: 完整的
cargo test --workspace由 Draft 的 Linux CI 运行。Windows 没有在本机执行,ready 后由 CI 覆盖。node运行时依赖没有已发布插件可以做 e2e,由runtime_without_executables_becomes_a_toolchain_candidate和runtime_named_by_tool_definition_has_no_core_probe两个单元测试覆盖。提交前确认 / Final checks
main(957a349)创建,目标分支main