Repository navigation
fix(toolchains): version permission and authority error codes - #182
Merged
Merged
Conversation
…260-toolchain-error-codes # Conflicts: # shared/plugins/reference/protocol-changelog.md
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.
问题与复现
工具链提供者的权限/authority 错误和插件函数中转共用了 JSON-RPC
-32070/-32071。旧能力版本已经发布,直接更换旧版号码会破坏现有提供者。在旧基线
4880022be16c862c6faa6ac18e13c0de61432177上先加入回归:合法的版本 1 权限应答被拒为plugin.api.unsupported,预期是plugin.toolchain.permissionDenied,修复前测试失败。另通过未改生产代码的 C ABI 实跑四条对照,确认数字冲突成立。实测也澄清了 Issue 中的一个影响描述:Core 原先已严格校验
error.data.code和请求身份,原样转发的plugin.function.failed/plugin.function.invalidResult会得到plugin.toolchain.invalidReply,不会被接受为权限/authority 错误。本次修复的是跨协议的数字重号。改动与兼容性
toolchainProviders: 0toolchainProviders: 1plugin.toolchain.permissionDenied-32070-32082plugin.toolchain.authorityUnsupported-32071-32083toolchainProviders: 1/litheToolchains版本 1;权限/authority 错误改为独立数字-32082/-32083(避开已在main合入的 feat(plugins): 插件后端可保存、关闭文档和新建、重命名、复制、移到废纸篓(API-11) #183 宿主错误码-32080plugin.host.alreadyExists与-32081plugin.host.diskChanged),稳定字符串码与其余数字保持不变。Core 从重新校验的清单构造 provider 的version,据此解码,两个版本互相拒绝对方的号码。rpc_code的版本 0 语义,新增显式的rpc_code_for_version。四个 SDK 的公开plugin.function.*和plugin.host.*映射不变。Backend::toolchain_provider调用继续使用版本 0,单独升级/重编 SDK 不会改变已发布插件的协议。声明版本 1 的插件显式调用toolchain_provider_version(ToolchainProviderVersion::V1);旧宿主未提供版本 1 时不启用提供者。rust/fixtures/toolchains/error-code-versions.json共 15 项 fixture 覆盖旧版、新版、跨版本混码拒绝、宿主-32080/-32081拒绝、函数错误转发拒绝和未知能力版本。补充宿主能力准入、LSP 协商、lithe_plugin_rpc::codes全部服务端/中转/宿主号码唯一性校验、SDK 源码兼容与真实 SDK/Core 错误传输回归。当前桌面端声明
toolchainProviders版本 0,继续兼容;本 PR 不升级桌面端 Core pin 或启用桌面端版本 1。现有 Go 消费者通过json.Unmarshal读取 registry,允许新增的 providerversion字段。验证
已合并最新
origin/main(9c8e89a)并解决冲突及-32080/-32081撞号问题,当前本地验证提交为e2ff09c932a9d62cd04a84a03401fa4557d4cea4(macOS,rustc 1.100.0):cargo fmt --manifest-path rust/Cargo.toml --all -- --check与cargo fmt --manifest-path shared/plugins/sdk/rust/Cargo.toml --all -- --check通过,git diff --check origin/main HEAD通过。node --test scripts/rust-core/*.test.mjs(16/16)、node scripts/rust-core/verify-platform-tests.mjs(52 crates)、node scripts/logging/generate-log-events.mjs --check(149 events)、verify-test-stability.sh --base origin/main、./scripts/rust-core/verify-rust-core-comments.sh(全部工作区 crate)通过。cargo clippy --locked --manifest-path rust/Cargo.toml --workspace --all-targets --all-features -- -D warnings与LIBSQLITE3_SYS_USE_PKG_CONFIG=1 cargo clippy --locked --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings通过。node scripts/rust-core/affected-crates.mjs --base origin/main选中--workspace --features lithe-remote/server,lithe-remote/motty;在 macOS 上完整执行env -u GIT_EDITOR cargo test --locked --manifest-path rust/Cargo.toml --workspace --features lithe-remote/server,lithe-remote/motty:2664 通过、0 失败、0 忽略(共 126 个测试/文档测试套)。shared/plugins与四 SDK 本地验证:node --test shared/plugins/scripts/*.test.mjs(2/2)、node shared/plugins/scripts/verify-docs.mjs通过。node --test shared/plugins/sdk/node/test/*.test.mjs89/89 通过(未在本地安装node_modules,test:types留待 CI)。gofmt -l shared/plugins/sdk/go、go -C shared/plugins/sdk/go vet ./...、go -C shared/plugins/sdk/go test ./...与test -race ./...通过。rustc 1.100.0):cargo test --locked --manifest-path shared/plugins/sdk/rust/Cargo.toml91/91 通过(90 单测/集成 + 1 文档测试)、cargo clippy --all-targets -- -D warnings通过(本地未安装rustc 1.87.0,MSRV 留待 CI)。mvn -B -ntp -f shared/plugins/sdk/java/pom.xml verify80/80 通过并构建两个样例 jar(本地 JDK 17;Java 8 运行时留待 CI)。node shared/plugins/scripts/sdk-e2e.mjs12/12 通过(包括真实 Rust 版本 1 提供者返回-32082经 Core 解码为plugin.toolchain.permissionDenied)。Linux 与 Windows 原生运行测试、
rustc 1.87.0、Java 8运行时与 Nodetest:types未在本机运行,交由 CI 验证;桌面宿主版本 1 集成不属本 PR 范围。Refs 1lck/Lithe-IDEA#2260