Skip to content

feat(plugins): allow backends to run tests in the native Tests panel - #234

Merged
xiaoyumuxi merged 21 commits into
Lithe-IDEA:mainfrom
WhiteZeek:feat/2499-test-runners
Dec 1, 2026
Merged

xiaoyumuxi merged 21 commits into
Lithe-IDEA:mainfrom
WhiteZeek:feat/2499-test-runners

Conversation

@WhiteZeek

@WhiteZeek WhiteZeek commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Related issue 1lck/Lithe-IDEA#2499.

Changes

  • Grant two API-29 methods only to plugin sessions with tests.start and a host that advertises the service. Keep manifest, plugin function and canonical report versions unchanged. Rust, Go, Node and Java expose scoped calls.
  • Build-backed requests select the calling plugin's instance by context, root and build-system ID, then narrow scope by project, target, suite or case. Standalone plugins supply their own registered runner and declare supported rerun filters. The existing function protocol carries progress, cancellation and the final report.
  • Standalone reports require an explicit tests array. An empty array is valid. Core then applies the existing provider validation and outcome aggregation. Schema, fixture and contract describe ownership, limits, failure codes and callback-scoped pagination.
  • Record accepted, stop-requested and terminal states in the unified log using a host-issued run ID. Exclude paths, selectors and report contents.
原计划编号 方法 用途
API-29 lithe/host/tests/start Start a native test run owned by the plugin session and workspace.
API-29 lithe/host/tests/results Read a bounded page of per-case identities and statuses during completion.

Use lithe/host/getCapabilities for discovery. A Core version that predates tests.start rejects a manifest declaring it at installation with plugin.permission.unknown. Hosts that recognize the permission advertise the methods they support. A build target requires its project and returns plugin.host.invalidParams when the project is omitted. Unknown fields, invalid parameters, stale contexts, missing instances and busy workspaces use existing documented errors. The four SDKs reuse their standard function handlers, cancellation and error propagation.

Review by layer

Verification

At 45bd06c, the protocol changelog retains the entries for #234, #245 and #246. Both stack layers have the same file-level edits as before the sync. The contract documentation check, its two tests and the Node SDK type check passed. The Node SDK suite passed 91 tests and skipped four.

At 950e196, Windows x64 passed the affected lithe-plugin-rpc, lithe-build and lithe-diagnostics suites, the Go SDK tests, Node SDK tests and TypeScript type check. The target-without-project regression first reproduced the old forwarding behavior and now checks both rejection and a valid project–target pair.

The command-level regression for missing and empty tests passed with all 10 lithe-build tests on Windows x64 at 3e713356.

Permission and parameter checks, standalone report validation, contract/document links, the event catalog, Go SDK unit tests and Node host tests passed locally. All four SDK CI jobs and the Linux four-SDK end-to-end job passed at 205709bd. Local Clippy passed for lithe-build and lithe-plugin-rpc, including test targets. The Windows SDK end-to-end run stopped while starting the Java and Node native-build fixtures (lsp.waitEvents, sessionFailed); Windows E2E remains unverified. The desktop consumer and UI evidence are in the companion PR.

@WhiteZeek
WhiteZeek marked this pull request as ready for review December 1, 2026 03:31
devin-ai-integration[bot]

This comment was marked as resolved.

@xiaoyumuxi xiaoyumuxi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整体设计没问题,权限、请求格式和报告校验都在 Core。下面几处建议合入前处理:

  1. 旧宿主兼容说明与实际不符。 契约 shared/plugins/contract/v1/README.md 写的是 “A host without the methods refuses them as unavailable”,PR 描述也说 “An older host does not grant the new methods”。但旧 Core 的 rust/crates/plugin-manifest/src/permissions.rs 遇到不认识的权限会以 plugin.permission.unknown 拒绝整个清单,所以声明了 tests.start 的插件在旧桌面端上根本装不上,不只是方法不可用。建议:
    • 契约里写明旧宿主会拒绝安装;
    • protocol-changelog.md 这一行标为“0 内的补充”,写上旧宿主行为和首个支持的 Core revision(参照 #239 那行);
    • 同一行补上新权限 tests.start、新 Core 命令 build.decodeInlineTestResults 和新日志事件 run.tests.state_changed。
  2. 只传 target、不传 project 时两边不一致。 Core 的参数检查放行,桌面端因为 target.ProjectID != "" 返回 plugin.host.preconditionFailed。建议 Core 直接按 invalidParams 拒绝,或在契约里写明 target 必须和 project 一起传。
  3. 小问题:
    • shared/plugins/sdk/node/src/index.d.ts 里 /** Permission window.messages … */ 这行注释现在落在新加的 readonly tests 上面,tests 应挪到这行注释之前;
    • Go SDK 导出的 Tests.Start、Tests.Results 缺文档注释。

已核对:tests/results 的 offset ≤ 10000 和 MAX_TEST_CASES = 10_000 一致,没问题。

@xiaoyumuxi
xiaoyumuxi merged commit 5495f5e into Lithe-IDEA:main Dec 1, 2026
13 checks passed
@WhiteZeek
WhiteZeek deleted the feat/2499-test-runners branch December 1, 2026 15:28
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.

2 participants