Repository navigation
feat(plugins): 普通插件可声明 hostIntegration 与短工具 ID,冲突时争用即不归属 - #1763
Merged
xiaoyumuxi merged 2 commits intoNov 5, 2026
Merged
Conversation
- Core:languageServers[].hostIntegration 不再限 dev.lithe 命名空间;
toolchains.registry 输入去掉 verifiedOfficial,被多个已启用插件定义的
短工具 ID 不归任何一方,结果新增 conflicts: [{tool, pluginIDs}],其余
定义照常注册;插件 ID 重复仍整批拒绝。
- macOS:删除 ToolchainSettingsPluginSource.verifiedOfficial;设置页加载器
向 Core 取 conflicts,被争用的工具不列出并给出 i18n 诊断,provider 胶囊
同步过滤。
- 契约、rust-core-api、Agent Note 同步;新增 Rust 与 Swift 测试。
xiaoyumuxi
marked this pull request as ready for review
November 5, 2026 07:17
Lithe Review结论: ⛔ 有阻塞 Findings
Scope Check
Suggestions
SummaryCore 冲突算法清晰,相关纯数据测试覆盖了主要解析路径。开放宿主集成后仍沿用全局 JVM 选择,破坏了插件之间的资源隔离,需要先修复。 Verification
|
This was referenced Nov 5, 2026
Merged
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 5, 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.
背景
#1754 决定不再区分官方插件和普通插件:Java 插件改为普通插件
io.github.lithe-idea.java-support,签名要求none,工具短 IDjava保留。要让这个插件能装上并正常工作,宿主还有两处只认官方插件的限制,本 PR 去掉它们(Java 抽离计划 Q1 的两个前置条件)。改动
1. 语言服务器
hostIntegration对所有插件开放(Core + 契约)rust/lithe-core/src/plugins/declarative.rs:languageServers[].hostIntegration不再要求dev.lithe命名空间。删掉validate/validate_host_integration的official参数和 “Host integrations are reserved to official plugins.” 拒绝。宿主不认识的集成名仍返回plugin.integration.unsupported。hostIntegrationID查找,不看插件 ID,所以 Swift 不用改。invalid-manifests.json的 “host integration requested outside the official namespace” 用例,改为 Rust 测试community_plugins_may_declare_a_host_integration,证明社区插件可以声明;plugins/v1/README.md的 Host integrations 段落和错误码表同步更新。hostIntegration: maven仍然只限官方插件,代码和契约都没动。它会随 Maven 迁移整体删除,组织仓库的 Maven、Gradle 插件都不使用它。2. 普通插件可以定义短工具 ID,冲突时“争用即不归属”(Core + 契约)
toolchains.registry的输入从{plugins:[{manifest,verifiedOfficial}]}改为{plugins:[{manifest}]},宿主不再提供来源证明。<pluginID>:<id>的前缀必须是插件自己的 ID,插件之间不会冲突,只有短 ID 会冲突。conflicts: [{tool, pluginIDs}],按 tool 排序,pluginIDs 也排序。java这类常用短 ID。toolchains.discoveryPlan用的是同一个注册表,被争用的工具不会出现在计划里。消费方解析这个工具时,按“没有插件声明”处理。3. macOS 宿主
ToolchainSettingsPluginSource.verifiedOfficial,以及MacServiceContainer里根据OfficialPluginCatalog计算它的代码。discover 和 resolve 不再传这个字段。MacToolchainSettingsLoader以前在 Swift 里自行拒绝重复的工具 ID,整页报“声明无效”。现在改为调用 Core 的toolchains.registry取得conflicts:被争用的工具不显示,每个冲突给出一条诊断,提示只保留一个插件启用。诊断文案的中英词条已加入shared/i18n。冲突怎么判定只由 Core 决定,Swift 只负责读取和显示。4. 文档
shared/contracts/plugins/v1/toolchains/README.md、shared/contracts/rust-core-api.md:registry 的输入和输出。5. 其他
plugin_run_debug测试仍向 registry 传verifiedOfficial,已改为新的输入形状。registry(of:)调用,不另外拼装 Core 请求。java和 “Java subprocess / Lombok agent” 举例的地方改为中性的compiler和 “helper process / agents”,宿主契约里不再出现具体语言的例子。有意推迟
OfficialPluginCatalog的communityReplacementID,按 feat(plugins): Go 与 PHP Support 迁移为 Lithe Store 社区插件 #1357 的方式)推迟到 lithe-plugin-java 发布第一个 Release 时再做,否则会把用户引向一个还不存在的插件。合并后
node scripts/contract.mjs sync --revision <合并后的 preview commit>,并在reference/protocol-changelog.md登记:hostIntegration 放开、registry 输入去掉verifiedOfficial、新增conflicts。验证
cargo test --manifest-path rust/Cargo.toml(lithe-core 全量):2048 个单元测试和其余集成测试全部通过。cargo fmt --check(lithe-core)通过。zsh scripts/architecture/verify-shared-contracts.sh通过。node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check通过。node scripts/architecture/verify-no-host-language-specifics.mjs:没有上升项;invalid-manifests.json删掉官方命名空间用例后计数 22→21,已用--update-baseline锁定下降。新测试里的集成名和工具 ID 从 fixture 读取,契约 README 的例子用中性的compiler,没有为通过闸门放宽任何规则。scripts/macos/test/test-macos.sh --filter 'ToolchainSettingsLoaderTests|MacToolchainDiscoveryTests|MacBuildToolResolverTests|MacNativeBuildProviderIntegrationTests':4 个套件 74 个测试通过;9 个需要阶段 D Maven 开发包的集成测试按原有条件跳过。toolchain_resolution_contested_tool_id_is_unowned_for_every_consumer:两个插件定义同一个短 ID 时,toolchains.discoveryPlan的tools为空,版本检查返回rejected,解析结果为skip/definitionUnavailable;toolchain_definitions测试覆盖conflicts的内容和排序。