Skip to content

fix(toolchains): version permission and authority error codes - #182

Merged
1lck merged 3 commits into
mainfrom
lithe-support/issue-2260-toolchain-error-codes
Nov 23, 2026
Merged

1lck merged 3 commits into
mainfrom
lithe-support/issue-2260-toolchain-error-codes

Conversation

@lithe-support

@lithe-support lithe-support Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

问题与复现

工具链提供者的权限/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: 0 toolchainProviders: 1
plugin.toolchain.permissionDenied -32070 -32082
plugin.toolchain.authorityUnsupported -32071 -32083

当前桌面端声明 toolchainProviders 版本 0,继续兼容;本 PR 不升级桌面端 Core pin 或启用桌面端版本 1。现有 Go 消费者通过 json.Unmarshal 读取 registry,允许新增的 provider version 字段。

验证

已合并最新 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 SDK:node --test shared/plugins/sdk/node/test/*.test.mjs 89/89 通过(未在本地安装 node_modules,test:types 留待 CI)。
    • Go SDK:gofmt -l shared/plugins/sdk/go、go -C shared/plugins/sdk/go vet ./...、go -C shared/plugins/sdk/go test ./... 与 test -race ./... 通过。
    • Rust SDK(rustc 1.100.0):cargo test --locked --manifest-path shared/plugins/sdk/rust/Cargo.toml 91/91 通过(90 单测/集成 + 1 文档测试)、cargo clippy --all-targets -- -D warnings 通过(本地未安装 rustc 1.87.0,MSRV 留待 CI)。
    • Java SDK:mvn -B -ntp -f shared/plugins/sdk/java/pom.xml verify 80/80 通过并构建两个样例 jar(本地 JDK 17;Java 8 运行时留待 CI)。
    • 官方四 SDK E2E:node shared/plugins/scripts/sdk-e2e.mjs 12/12 通过(包括真实 Rust 版本 1 提供者返回 -32082 经 Core 解码为 plugin.toolchain.permissionDenied)。

Linux 与 Windows 原生运行测试、rustc 1.87.0、Java 8 运行时与 Node test:types 未在本机运行,交由 CI 验证;桌面宿主版本 1 集成不属本 PR 范围。

Refs 1lck/Lithe-IDEA#2260

@1lck
1lck marked this pull request as ready for review November 23, 2026 13:26
@1lck
1lck merged commit 9d2848f into main Nov 23, 2026
12 of 15 checks passed
@1lck
1lck deleted the lithe-support/issue-2260-toolchain-error-codes branch November 23, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant