Skip to content

feat(plugin-api): 插件后端发起原生运行与调试,声明调试适配器行为与输出链接(API-22/23/30) - #1746

Merged
xiaoyumuxi merged 26 commits into
previewfrom
feat/1495-plugin-run-debug-api
Nov 5, 2026
Merged

xiaoyumuxi merged 26 commits into
previewfrom
feat/1495-plugin-run-debug-api

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #1495

这个 PR 做了什么

让插件后端可以请求宿主在 Run 窗口运行一个进程、启动调试会话,并在清单里声明调试适配器的行为和控制台输出中的链接。执行和展示仍由宿主负责,插件只提交请求。宿主和 Core 没有按适配器名新增分支。唯一带 Java 字样的新名字是 legacy_java,它把 preview 原有的 Java 判断收窄到旧适配器上,见下文“原有的 Java 特例”。

API-23:run/* 与工具 ID 引用

  • 新增宿主方法 lithe/host/run/start、lithe/host/run/stop 和通知 lithe/host/run/didExit。需要 requires.serverProcess: 4 和权限 run.start。
  • 可执行文件只能是两种之一:
    • 工具 ID:用户在工具链层级里选中的安装。
    • 插件包内的文件。
  • 工作目录必须在工作区内。环境变量由插件显式给出,优先于工具导出的变量。
  • 支持三项附加功能:
    • 临时文件:Core 校验并替换 ${temporaryFile:<name>},运行结束后删除。
    • 连接式调试附加。
    • 再次运行:调用插件声明的函数。
  • 工具找不到或不可用时,返回新错误码 -32025 plugin.host.toolUnresolved,details 为 {tool, reason},reason 是 notFound 或 unusable。
  • Run 会话在 process.run 之上加了宿主的展示:Run 窗口条目、停止、再次运行。
  • 新增 Core 命令 toolchains.instantiateLaunch(按用户选中的安装展开工具定义的启动模板)和 run.decodeStart。

API-30:debug/start 与适配器的 features、defaults

  • 新增 lithe/host/debug/start,需要权限 debug.start,只能使用调用方插件自己声明的适配器。配置由 Core 校验,noDebug 和以 __ 开头的键是保留键。
  • debugAdapters 升到 3。features.hotCodeReplace、features.stepFilters 和 defaults.stepFilters 由共享的 Core 调试引擎执行,宿主不再按适配器名识别这些行为。
  • 适配器声明了热代码替换后,调试工具栏会出现“应用代码变更”:先保存已修改的文档,再发送声明的请求。
  • 新增 Core 命令 debug.decodeBackendConfiguration。

API-22:输出链接匹配器

  • 新增 outputLinkMatchers 1。插件在清单里声明正则,Core 负责匹配并决定链接指向哪里,宿主只负责加样式和转发点击。scope 可写 run 或 test,不写表示两处都生效。
  • 匹配器分两种:
    • 不带 resolve:直接捕获 path/line/column 分组,目标文件存在时才显示为链接。
    • 带 resolve:点击时调用插件函数取得位置。
  • 只声明匹配器的插件不需要后端,启用和停用都不用重启。Core 的声明式校验有两处“插件什么都没声明”的检查,第二处原来没把 outputLinkMatchers 算作贡献,会以 “declares no language server or execution provider” 拒绝这种插件;现已补上,并加了 Rust 测试,契约 README 的 “Output link matchers” 一节也写明了。
  • 新增 Core 命令 outputLinks.match 和 outputLinks.decodeResolution。

契约与文档

  • shared/contracts/plugins/v1/:
    • README 新增 “Run and debug sessions” 一节。
    • schema 已扩展。
    • 新增 fixtures(按 docs(contracts): 插件契约 fixtures 按功能分目录并修正能力版本表 #1747 的分目录放置):fixtures/run/run-start.json、fixtures/run/output-link-matchers.json、fixtures/run/tool-reference-launch.plugin.json、fixtures/debug-adapters/debug-start.json、fixtures/debug-adapters/debug-adapter-features.plugin.json。README 顶部的 fixture 表在这两个目录的行里写明了它们。
    • 顺带修正 README:run/start 和 debug/start 带 context,run/stop 不带。
  • 平台功能矩阵新增三条记录:plugin-backend-run-start、plugin-debug-start-and-adapter-features、plugin-output-link-matchers。macOS 为已实现、待验证,Windows 为未实现。
  • docs/development/macos-plugin-api-plan.md 的 API-22、23、30 三行已更新。没有新增 API 编号。

其他小改动

  • 工具解析结果新增 home,即用户所选安装的根目录,工具定义的启动模板可以用 ${home} 引用它。按可执行文件选中的工具没有 home。
  • 把交给 Core 的工具注册表的构建抽成 MacToolchainDiscovery.registry(of:),原有工具解析和新的启动模板展开共用。
  • 新代码中三处只返回或丢弃失败的尽力而为分支,补了 log-exempt 理由。
  • PluginRunWindowPort 的闭包参数在协议、AppModel 实现和测试替身里都显式写成 @MainActor @Sendable。原来测试替身跨模块实现这个协议时,两边推断出的 Sendable 属性不一致,测试编译不过。
  • run/stop 测试里带未知字段 force 的请求,期望从 invalidParams 改为 unsupportedOption,并断言 details.option 为 force。宿主的实现本来就是这样回答的,与契约 README 中“方法未定义的字段返回 -32018”的规定一致,原来是测试写错了。

原有的 Java 特例

这个 PR 只增加通用机制,不删除 Java 特例。下面这些原有逻辑要等 Java 插件接上新接口后再删:

  • Java 运行、JDWP 调试启动、热代码替换、步进过滤、堆栈链接。
  • preview 里调试引擎原本对 adapter_id == "java" 有三处判断:stepFilters、Launch 和 RedefineClasses。本 PR 把它们收窄为只对没有声明 features 的旧适配器(legacy_java)生效,已声明 features 的适配器一律走声明。
  • 适配器声明了 features.hotCodeReplace 时,GenericDebugFeatureModel 只显示“应用代码变更”,原有的“更新服务”(canUpdateJavaService)只留给没有声明的适配器。这与调试引擎里 legacy_java 的收窄规则一致,同一个会话不会同时出现两个按钮,新增测试 aDeclaredHotCodeReplaceReplacesTheHostServiceUpdateSoOneButtonShows 覆盖这一点。
  • 内置 java 适配器工厂、步进过滤界面和 DevTools vmArg 本 PR 不动。

已知限制

  • macOS 的 hostCapabilities 暂不宣告 serverProcess 4,因为语言服务器启动和 runSelectedRuntime 还不能解析工具 ID。使用工具 ID 的插件要等 Java 迁移时一并宣告。
  • debug.target {kind:"launch"} 暂不支持,返回 plugin.host.unsupportedOption,details.option 为 debug.target。
  • 连接式调试要求该 configurationType 下恰好有一个支持 attach 的适配器。attach 在 run/start 返回之后异步进行。
  • 同一时间一个插件只有一个 Run 条目。
  • 需要 ${entry} 的工具定义不能通过 run/start 的工具 ID 运行。
  • 用户点 Stop 时,didExit 不带退出码或信号。
  • 热代码替换现在只保存文档并发送声明的请求,宿主没有构建或准备钩子。后续可以用 features.hotCodeReplace.prepareFunction 补上。
  • 输出链接按每次渲染的文本块匹配。插件的 .ask 链接不参与上一处/下一处导航。
  • run/stop 按调用方插件 ID 限定,需要 run.start 权限。所以只有 debug.start 权限的插件,不能通过 API 停掉自己的调试会话。
  • Windows 未接入。Core 校验通过不代表 Windows 能执行这些请求。

合并顺序与后续事项

需要确认的问题

  1. 插件通过 run/start 运行进程时,是否需要首次授权确认?现在只靠 run.start 权限和插件包签名。
  2. macOS 是否要支持 debug.target {kind:"launch"},即由适配器自己启动进程?
  3. 只有 debug.start 权限的插件,是否应该能通过 run/stop 停掉自己的调试会话?
  4. 插件稍后安装时,后端会话的热登记由哪个 PR 负责?

entitlements 和 Info.plist 都没有改。

验证

合入 preview c5c6812 后的复验

以 merge 方式依次合入 ef6f853、5665e6e59 和 c5c6812,带进了 #1744(Core 生成文件 URI)、#1747(插件契约 fixtures 按功能分目录)、#1748(Git watcher)、#1750(协议登记规则)、#1729(Windows 终端停靠宽度)、#1740(项目生成器工具字段,含 rustfmt 修正)、#1751(宿主方法按 API 编号登记)、#1752(删除工具链契约草案)和 #1730(编辑器 Provider 与编辑器动作第 2 版)。

前两次合并的冲突及处理:

  • 本 PR 的 5 个 fixture 用 git mv 移到 fixtures/run/ 和 fixtures/debug-adapters/。引用这些 fixture 的 Rust 测试(declarative_plugins.rs、plugin_run_debug.rs)、Swift 测试(DeclarativeDebugAdapterConsoleTests)、契约 README 和三条功能矩阵记录都改到了新路径;仓库里没有残留旧路径。
  • PluginOutputLinkTests 中“没有匹配器的插件”和“resolve 匹配器需要后端”两个测试,原来按 fixtures 根目录拼接 editor-actions.plugin.json,改为 editor/editor-actions.plugin.json。
  • 能力表在 README、schema、capabilities.rs 和 Swift hostCapabilities 里两边取并集:
    • projectGenerators 用 preview 的 [1, 2];
    • debugAdapters、outputLinkMatchers、serverProcess 保留本分支的版本;
    • macOS 仍不宣告 serverProcess 4,见“已知限制”。
  • 免重启判断的模块集合取并集:preview 的 projectGenerators、toolchains,本分支的 outputLinks,以及原有的 debugAdapters、grammars。

合入 c5c6812 的冲突及处理:

  • MacServiceContainer:preview 的编辑器 Provider 服务和本分支的 Run 宿主服务、输出链接服务都保留;判断模块是否可用的闭包提成局部常量 isModuleUsable,同时给插件回调和输出链接来源使用。
  • shared/contracts/rust-core-api.md:保留本分支新增的 toolchains.instantiateLaunch、run.decodeStart、debug.decodeBackendConfiguration、outputLinks.match、outputLinks.decodeResolution 五个操作及其说明。
  • invalid-manifests.json:两边的用例都保留。
  • scripts/architecture/language-specifics-baseline.json:preview 删除了工具链契约草案,plugin-editor-actions.ts 等文件的计数也下降了,基线随之更新;plugin-manifest.schema.json 的 schemaEnums 降到 5,并用 --update-baseline 锁定。

已知的 preview 问题:scripts/architecture/verify-core.sh 的服务边界检查要求每个 AppModel 扩展不超过 600 行,而 preview 的 AppModel+CodeNavigation.swift 已有 627 行,本 PR 没有改这个文件,所以本地这一项不通过。CI 工作流不运行 verify-core.sh。

复验结果(macOS、Apple Silicon 本地):

  • scripts/rust-core/verify-rust-core-static.sh(与 CI 相同,cargo fmt --check 只查 lithe-core):通过。
  • cargo test -p lithe-core:共 1909 个测试,完整运行时 1900 个通过。另外 9 个 remote::sessions::integration_tests 失败,原因是两个工作树同时跑完整检查,本地 socket 报 EAGAIN(os error 35);单独重跑这一组,18 个全部通过。
  • scripts/macos/test/test-macos.sh --filter,覆盖 PluginOutputLink、PluginRunHostService、PluginDebugAdapter、DeclarativeDebugAdapterConsole、DebugModule、PluginManagementPresentation、PluginEditorProvider、PluginEditorAction:11 个套件 258 个测试全部通过。
  • 宿主语言特例闸门及其单测:通过("Ratchet verified")。
  • 以下检查全部通过:
    • verify-shared-contracts.sh、verify-module-boundaries.sh。
    • i18n 两项检查。
    • 功能矩阵及其变更检查。
    • Agent Note、日志用法与日志事件、Rust 注释规范、Java 语义基线、调试 v1 基线、git diff --check。
  • .agents/skills/write-stable-tests/scripts/verify-test-stability.sh --platform all --base c5c68126b --head HEAD:通过。

更早的验证

分支先 rebase 到 preview 的 c63bcd2,之后以 merge 方式合入 dbe8441(#1727)。合入时 docs/development/macos-plugin-api-plan.md 有冲突:本 PR 已交付的 API-22、23、30 行用本分支内容,API-29 行用 preview 内容,插件自有语言服务器 PR 的 setStatus 备注保留。

合入 #1727 后的复验(#1727 不改 Rust,合入时本 PR 的改动只涉及 Swift、契约 README 和基线):

  • node scripts/architecture/verify-no-host-language-specifics.mjs:每项计数与基线一致。
  • scripts/architecture/verify-core.sh、scripts/architecture/verify-module-boundaries.sh、node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check、日志用法与日志事件、git diff --check:全部通过。
  • scripts/macos/test/test-macos.sh --filter 'PluginOutputLinkTests|PluginRunHostServiceTests|PluginDebugAdapterTests|DeclarativeDebugAdapterConsoleTests|DebugModuleTests|PluginManagementPresentationTests':9 个套件共 233 个测试全部通过。

合入 #1727 之前的验证(均在 macOS、Apple Silicon 本地完成):

  • cargo test -p lithe-core:1908 个通过,0 失败(单元测试 1875 个,集成测试 33 个)。
  • scripts/macos/test/test-macos.sh --filter 'PluginOutputLinkTests|PluginRunHostServiceTests|PluginDebugAdapterTests|DeclarativeDebugAdapterConsoleTests|DebugModuleTests':覆盖输出链接、Run 宿主服务、插件调试适配器、声明式调试适配器控制台、调试模块等套件,共 225 个测试(8 个套件)全部通过。
  • 静态检查全部通过:
    • scripts/architecture/verify-shared-contracts.sh、Rust Core 注释规范、Agent Note、功能矩阵及其变更检查。
    • node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check。
    • 日志用法与日志事件、Java 语义基线、调试 v1 基线。
    • 服务边界(含 scripts/macos/verify/verify-runtime-bundle-immutability.sh)、模块边界。
    • git diff --check,以及改动的 .rs 文件的 rustfmt。
  • lithe-plugin-docs 的 node scripts/sdk-e2e.mjs --source <本工作树> --ref feat/1495-plugin-run-debug-api:构建、Java、Node、Rust 四组共 9 个测试全部通过。这一项是在 rebase 前的 896defbbb 上跑的;rebase 只带进 preview 中与本 PR 无关的 Git 颜色、跳转到行和 AutoBuild 改动。之后的 Core 修复只放宽了“只声明输出链接匹配器”的清单校验。
  • 在 macOS 上运行 cargo check --bin lithe-windows:只有 preview 原有的两个 Windows 专属错误(project_window_registry.rs 的 os::windows 和 as_raw_handle),本 PR 没有新增。Windows 实际构建以 CI 为准。
  • 本次没有启动 Lithe 应用,没有做真机验证,所以功能矩阵标为“已实现、待验证”。

Adds the Core side of the plugin-initiated Run and debug API (Refs #1495):

- serverProcess 4: launches, runtime dependencies and runSelectedRuntime
  name tool definitions by ID, listed in the manifest's requiresTools;
  toolchains.instantiateLaunch expands a definition's launch template.
  Versions 1 and 2 keep their closed runtime lists.
- run.decodeStart and debug.decodeBackendConfiguration validate the params
  of lithe/host/run/start and lithe/host/debug/start; run/stop and the
  run/didExit notification join the plugin-function host protocol with the
  run.start and debug.start permissions and plugin.host.toolUnresolved.
- debugAdapters 3: adapter features (hot code replace, step filters) and
  defaults drive the debug engine instead of recognising an adapter by ID.
- outputLinkMatchers 1: outputLinks.match and outputLinks.decodeResolution
  find console links from patterns the plugin declares.

Fixtures cover each new request, rejection and manifest.
…output links

README, schema, toolchains.md and rust-core-api.md describe serverProcess 4
tool references, run/start, run/stop, debug/start, run/didExit, debugAdapters 3
features and defaults, and outputLinkMatchers 1 (Refs #1495).
RunService starts a plugin run like a build provider run, reports its end
exactly once, and keeps the output and the plugin's rerun action after it
ends. The Run tool window shows such a run even without generated Run
configurations, and Restart goes back through the plugin.
A plugin whose only contribution is console links still needs a module so
the user can enable it and startup finds a factory. The module has no
contributions, so such a plugin also activates without a restart.
…k matchers

Rust Core matches the lines the console renders against the matchers of the
enabled plugins. A located file opens like the host's own console links; a
link with a resolve function asks the plugin's backend on click. Without any
matcher the console does no extra work. The host now advertises
outputLinkMatchers 1 and debugAdapters 3.
…code changes

Adds the shared English and Chinese entries for the messages the plugin
run host, the debug start and the generic Apply code changes action show,
and regenerates the string tables.
…put links

Add the three capability records, mark API-22, API-23 and API-30 in the plugin API
plan with what this change opens, and correct the contract README: run/start and
debug/start take a context, run/stop takes none.
…ink code

The log usage check requires a reasoned log-exempt marker where a catch only
returns or a try? discards the failure.
…run window port

The test window could not conform to PluginRunWindowPort: the compiler
inferred different sendability for the main-actor closure parameters of
the async requirements across modules. The protocol, AppModel and the
test window now all name them @mainactor @sendable.
Core's second empty-plugin check did not count outputLinkMatchers, so a
plugin with nothing but console link matchers was refused as declaring no
language server or execution provider. The contract now says matchers alone
are a complete plugin.

The run/stop test expected invalidParams for an unknown option; the contract
and the host answer unsupportedOption with details.option, so the test now
checks that.
- Plan doc: keep this PR's delivered API-22/23/30 rows, take preview's
  API-29 rows, and keep the C-LS setStatus note.
- A declared features.hotCodeReplace now wins over the host's legacy
  service update, which only remains for adapters that declared nothing,
  matching the legacy_java narrowing in the debug engine. Adds a test
  that one button shows.
- Contract README no longer names runtimes when describing the closed
  tool lists of serverProcess 1 to 3.
- Lock the lowered counts: engine.rs nameComparisons 6 -> 5 and the
  manifest schema's schemaEnums 13 -> 5.
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 5, 2026 05:18
@lithe-code-review

lithe-code-review Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Lithe Review

结论: ⚠️ 有建议
范围: preview ← feat/1495-plugin-run-debug-api · head: 4610f88

未发现需要阻塞合并的问题。以下四项均为非阻塞的 P2 建议。

Findings

  1. [P2] debug/start 丢失适配器声明的默认启动参数
    rust/lithe-core/src/debug/backend_start.rs:114

    • 实际影响:返回的 configuration 原样采用请求内容,没有合并 configurations.launch/attach.arguments。随后 AppModel 直接构造 DebugLaunchConfiguration,Debug 会话管理器和协议会话也不补这些默认值,实际 DAP 参数与契约承诺不一致。
    • 触发条件:适配器声明默认参数,而后端请求省略该参数。
    • 复现步骤:声明 configurations.launch.arguments.stopOnEntry: true,通过 debug/start 只传入 program;发出的 launch 请求不会包含声明的 stopOnEntry。
    • 来源:本次引入。
  2. [P2] 匹配器启停后没有使已有控制台链接失效
    macos/Sources/Lithe/Views/Workbench/OutputTextView+PluginLinks.swift:11

    • 实际影响:新增装饰器只在文本渲染时读取当前匹配器,但 OutputTextView.swift:1045 对未变化的输出直接返回;追加输出也只装饰新增片段。因此停用插件后,已有直接文件链接仍保留并可点击;重新启用也不会恢复已有文本中的链接。这不满足功能矩阵中“禁用后链接立即消失,再启用恢复”的验收要求。
    • 触发条件:控制台已有匹配结果时安装、更新或启停匹配器,输出和主题保持不变。
    • 复现步骤:声明匹配 SOURCE=(?P<path>\S+\.script):(?P<line>\d+) 的匹配器,输出指向现存文件的一行,确认链接后停用插件;旧链接不会撤销,即使随后追加普通日志也仍保留。
    • 来源:本次引入;新增动态装饰器没有接入现有渲染缓存的失效条件。
  3. [P2] 两个启动方法对未知选项返回了错误的协议错误码
    macos/Sources/Lithe/Application/Features/PluginRunHostService.swift:322

    • 实际影响:run/start 和 debug/start 都让 Core 严格解码,再将拒绝统一映射为 invalidParams。协议 3 要求未知字段返回 unsupportedOption(-32018)及 details.option,供后端去掉选项后重试;当前返回值无法支持这条兼容路径。
    • 触发条件:有效启动请求包含宿主尚未实现的字段。
    • 复现步骤:给任一有效启动 fixture 的 params 添加 futureOption: true。run_start.rs:97 或 backend_start.rs:61 会将未知字段归为无效参数,最终响应没有 details.option。run/stop 已使用正确的独立校验方式。
    • 来源:本次引入。
  4. [P2] 临时文件在 MainActor 上同步写入和清理
    macos/Sources/Lithe/Application/Features/PluginRunHostService.swift:195

    • 实际影响:该服务整体隔离于 MainActor,创建目录、构造文件数据和原子写入都同步执行;生产 MacFileStorage 直接调用文件系统。运行启动会占用 UI 线程等待磁盘,结束时的同步删除也存在同样问题,期间取消和其他界面操作无法及时处理。
    • 触发条件:run/start 携带临时文件,尤其内容较大或临时目录存储较慢时。
    • 复现步骤:通过有效请求传入约 512 KiB 的临时文件,追踪 startRun → writeTemporaryFiles → MacFileStorage.writeData → Data.write,整条写入链均在 MainActor 执行;不需要超过协议请求限额即可进入此路径。
    • 来源:本次引入,违反新增文件 I/O 必须离开主线程的要求。

Scope Check

  • 关联 [Feature] macOS 存量重构计划:清理废弃实现,将 Maven/Java 领域逻辑完整迁入插件后端 #1495:本 PR 交付阶段 C 中 API-22/23/30 的部分基础能力,不代表 Maven/Java 迁移计划完成。
  • 已完成范围:新增 Core 校验、工具启动模板、适配器行为声明、输出匹配及 macOS 接线,并补充契约、fixture、i18n 和功能矩阵。
  • 未完成范围:Windows 接入、真实产品验收及后续 Java/Maven 迁移;工具 ID 路径仍受 macOS 未宣告 serverProcess 4 的能力闸门限制。
  • 上游复用:复用了现有 RunService、Debug 会话管理与 DAP 引擎,未发现新增平行项目语义模型。
  • 四项 Finding 均由本次新增路径引入,属于本 PR 职责范围。

Suggestions

  1. 在 Core 中按请求类型合并适配器默认 arguments,再由后端 configuration 覆盖;补充默认值保留和显式覆盖的 fixture。
  2. 将匹配器变更代数纳入控制台渲染失效条件,更新已有链接属性;补充输出不变时启用、停用及更新匹配器的验证。
  3. 保留未知字段的结构化分类,映射为 unsupportedOption 并返回字段名;覆盖两个启动方法。
  4. 通过原生适配器在后台执行临时文件创建、写入和删除,并在交回 MainActor 后检查取消及上下文有效性,保留失败清理。
  5. 补充受影响 Run/Test 链接和 Debug 工具栏的截图;已有界面提供前后对比。当前上下文未附截图,视觉效果尚未验证。

Summary

实现复用了现有执行与调试基础设施。建议补齐默认参数、动态链接失效、协议错误分类及 I/O 线程边界;现有 Core 和服务替身测试没有覆盖这些完整生产路径。

Verification

  • 静态检查了固定提交范围内的主要实现、契约、fixture、相关测试、i18n 源数据和功能矩阵;追踪了 Core → Swift bridge → dispatcher → AppModel → Run/Debug 会话,以及匹配器注册 → 装饰器 → AppKit 渲染缓存的调用链。
  • 作者报告合入 base 后 233 个 macOS 测试及相关静态检查通过;Rust 1908 个测试和 SDK 9 个测试来自此前版本。当前 head 暂无 Check Run 结果。
  • 本次按只读约束未运行任何代码、测试或检查脚本,未启动应用,未访问网络。
  • 尚缺真实 macOS 工作流、视觉截图、性能基线及当前 head 的 SDK 验证;Windows 功能尚未接入。作者提供的 bundle 只读检查结果未由本次审查独立复验。

…un-debug-api

# Conflicts:
#	rust/lithe-core/src/lsp/interface/mod.rs
#	rust/lithe-core/src/tests/declarative_plugins.rs
#	scripts/architecture/language-specifics-baseline.json
#	shared/contracts/plugins/v1/README.md
#	shared/contracts/plugins/v1/plugin-manifest.schema.json
…un-debug-api

# Conflicts:
#	macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift
#	macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift
#	rust/lithe-core/src/plugins/capabilities.rs
#	rust/lithe-core/src/tests/declarative_plugins.rs
#	shared/contracts/plugins/v1/README.md
#	shared/contracts/plugins/v1/fixtures/manifest/invalid-manifests.json
#	shared/contracts/plugins/v1/plugin-manifest.schema.json
# Conflicts:
#	macos/Sources/Lithe/Platform/MacOS/MacServiceContainer.swift
#	scripts/architecture/language-specifics-baseline.json
#	shared/contracts/plugins/v1/fixtures/manifest/invalid-manifests.json
#	shared/contracts/rust-core-api.md
@lithe-code-review

Copy link
Copy Markdown

Lithe 运行验收

版本:b1574205f321107339af57e99b095fa99c1cab13;状态:partial。
本报告独立于代码审查;只报告实际执行的场景,不代表所有问题均已修复。

对照:共同祖先 c5c68126bdf1d203f0c1aeb056a053482b1f6d2e → PR head;当前目标分支合并适用性:未运行。

  • 条件不足,未验证:Exercise the real backend → host → RunService path with deterministic fixture data: packaged execution, temporary-file substitution and cleanup, natural exit, owner versus foreign-plugin Stop, and rerun callback. Separately verify tool-ID selection and explicit environment precedence when the production capability gate permits that path.
    • Requires macOS, an interactive desktop, a trusted fixture plugin and a packaged fixture executable. Windows has no implementation. Additionally, macOS advertises serverProcess [1], so the supplied serverProcess:4 tool-reference plugin is rejected before execution; acceptance must not bypass that gate.
  • 条件不足,未验证:Start debugging through the real plugin host using an adapter declaring launch defaults, hotCodeReplace and stepFilters. Inspect the adapter's recorded DAP transcript and native toolbar behavior. Include explicit configuration overrides, foreign-adapter rejection and reserved configuration keys. This specifically addresses the reported loss of adapter default arguments.
    • Requires macOS, an interactive desktop, a trusted backend plugin and a deterministic packaged DAP adapter fixture. Neither the macOS application nor those executable fixtures are supplied. Windows does not implement this host workflow; frontend substitutes cannot establish it.
  • 条件不足,未验证:Through the actual Core JSON/C ABI, validate a frozen plugin declaring only outputLinkMatchers with no backend. Match deterministic console lines containing an emoji prefix, workspace-relative paths and run-only versus unscoped matchers. Check traversal exclusion, resolve-result decoding, the eight-link limit and the 4096-byte scan boundary. Use identical literal inputs on baseline and head.
    • The inventory supplies cargo/rustc but no native C compiler, linker or Windows SDK, and no revision-matched Core DLL. Core's locked tree-sitter and ring dependencies require native compilation. A supplied build environment or separately built Core DLL for each revision is needed before freezing an executable probe.

未覆盖:

  • All runtime requirements remain unverified, including every expected outcome in the three blocked scenarios.
  • API-23: actual user-selected tool installation, launch-template expansion including home, missing home for executable-only selections, required-entry incompatibility, undeclared tools, and toolUnresolved -32025 reasons notFound/unusable.
  • API-23: packaged executable existence/executability and containment, workspace-directory enforcement, argument/environment limits, temporary-file limits and invalid references, and cleanup after setup failure or cancellation.
  • API-23: connection debugging after listener readiness, breakpoint execution, ambiguous/missing attach adapters, attach failure cleanup, and debug.target launch rejection before spawning.
  • API-23: rerun failure presentation, one Run entry per plugin, cancellation, context closure, remote-authority rejection, permission enforcement, and notification isolation after backend replacement, exit or plugin disablement.
  • API-30: native launch and attach completion, session ownership and stopping, the current run.start requirement for stopping debug sessions, configuration-size limits and malformed-input error mapping.
  • API-30: full hot-replacement success/error lifecycle, user filter precedence, undeclared-adapter behavior and legacy Java compatibility. Existing Java functionality is retained scope, not a completed migration.
  • Protocol compatibility: run/start and debug/start unknown options must return unsupportedOption -32018 with details.option before side effects; run/stop must preserve that behavior.
  • API-22 native macOS console behavior: existing-file filtering, styling, click navigation, missing files, Run/Test scope, backend resolver invocation/context/failure feedback, and exclusion of resolver links from previous/next navigation.
  • API-22 live lifecycle: installation/update, disable immediately removing existing links, re-enable restoring unchanged output, restart-free matcher-only activation, backend registration limitations and the no-matchers fast path. These require macOS desktop acceptance.
  • Performance: temporary-file I/O responsiveness and matching/rendering costs. No prespecified statistical protocol or thresholds were supplied; a single run cannot establish these.
  • Runtime package immutability, native process/resource cleanup, localized messages and visual/accessibility behavior remain unverified.
  • Contract/schema compatibility, existing serverProcess version semantics, SDK interoperability, platform capability advertisement, documentation and post-merge plugin-docs synchronization/registration remain unverified. Windows host integration is explicitly outside this PR's implemented scope.
  • First-run authorization policy, future debug.target launch support, debug-only stop permission and ownership of backend hot registration remain unresolved product decisions.

工作副本与运行状态已清理;可复用编译缓存按 12 GiB / 7 天预算保留。
详细步骤和原始证据保存在服务器受限目录(14 天、总计不超过 1 GiB);当前没有公开下载链接。

合入 #1742(插件函数中转)。冲突全部是两边在同一位置各自新增:
plugins 模块声明、HOST_METHODS 表(run/debug 与 functions 方法并存)、
错误码表(-32025 与 -32027..-32071 不重叠)、manifest 字段、
provider_query_trigger 与 runtime_tools、capability 列表、契约 fixture。
preview 合入了 #1745(插件自有语言服务器会话与后端决定启动方式)。冲突处理:

- serverProcess 版本改为累积语义:选中运行时的调试适配器需要 2,后端
  决定启动方式的语言服务器需要 3,requiresTools 需要 4;4 覆盖 2 和 3,
  清单仍须声明覆盖所用特性的最低版本。capabilities 列表为 [1, 2, 3, 4],
  schema、契约 README 同步说明。macOS 宣告的版本保持 preview 的 [1, 3]。
- 主机通知沿用本分支的 grant 字段与 admitted(),admitted() 改用 #1745
  的 holds_service,按方法授予的服务也能收到对应通知;run/didExit 与两个
  languageServer 通知并存。
- 权限、错误码(-32022..-32026 按序)、通知参数校验、README 章节、契约
  fixture、MacServiceContainer 的宿主服务注册、计划文档 API-22 行均取并集。
@xiaoyumuxi
xiaoyumuxi merged commit 69bc354 into preview Nov 5, 2026
11 of 16 checks passed
1lck added a commit that referenced this pull request Nov 5, 2026
#1746 新增的 makeDeclaredFeature 仍用旧的 GenericDebugFeatureModel(sessions:) 初始化,
而本 PR 给初始化器增加了必填的 paging 参数,补上 paging: LinkedCoreDebugPaging()。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck added a commit that referenced this pull request Nov 5, 2026
* feat(core): #1662 车道 C 运行/调试下沉(RUN-03/06/07/14)

- RUN-03:Core 新增 build.resolveTestRunOutcome 通用归约(超时/取消不声明测试结果,失败优先于退出码,
  退出码 0 但没有执行选中测试判为失败);macOS LanguageTestService 与 Windows maven.store 改为调用,删除旧的按退出码判定
- RUN-06:Core 新增 debug.planVariablePage / reduceVariablePage;macOS 删除本地分页状态机;
  Windows 保留 named/indexed 数量,只自动请求非 expensive Scope(expensive 改为手动加载),请求携带 filter/start/count 并提供加载更多
- RUN-07:Windows 栈帧完整消费 sourceReference / instructionPointerReference / isFiltered,sourceReference 帧不再当磁盘文件打开
- RUN-14:Core 新增 debug.planDisassemblyWindow / reduceDisassemblyPage;macOS 删除本地窗口二分、负偏移回退与耗尽判定;Windows host 未开放 disassemble/readMemory,功能矩阵标明
- 共享 fixture、i18n 词条、rust-core-api 说明、功能矩阵与 v1 baseline 条目一并更新

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(macos): RUN-03 测试按新判定断言终态

带失败用例期望 .failed,零测试期望 .failed 并断言“没有找到任何测试”文案,正常通过仍期望 .passed。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* 修复 rebase 后 DebugModuleTests 编译错误

#1746 新增的 makeDeclaredFeature 仍用旧的 GenericDebugFeatureModel(sessions:) 初始化,
而本 PR 给初始化器增加了必填的 paging 参数,补上 paging: LinkedCoreDebugPaging()。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant