Skip to content

feat(windows): #1495 阶段 D 的 Windows Build、Provider Run 与服务 Debug(从 #1558 拆出) - #1722

Closed
xiaoyumuxi wants to merge 98 commits into
previewfrom
codex/issue-1495-windows
Closed

xiaoyumuxi wants to merge 98 commits into
previewfrom
codex/issue-1495-windows

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Collaborator

从 #1558 拆出的 Windows 部分(issue #1495 阶段 D):同一 Core 上的 Windows 原生 Build 工具解析、发布者验签、Provider Run、Agent Build、本机 Build 选项与服务 Debug,以及对应的 Windows CI 入口、测试稳定性脚本、Windows 声明式插件宿主笔记、功能矩阵 Windows 状态和 69 条 Windows 专用 i18n 词条。

依赖 #1558,请在它合入后再评审和合入。 本分支在 #1558 拆分提交 2f581dc31 之上只加一个提交 e5dcd3dde,把上述内容恢复到拆分前 8a52a4b52 的状态。#1558 合入 preview 之前,GitHub 显示的差异包含 #1558 的全部改动;合入之后只剩 Windows 内容。

改动

  • Windows 新增同一 Core 上的原生 Build 工具解析基础:目录 pin、声明扫描、Shell 变量/命令、版本和文件身份重查;只向 RPC 转发声明导出与明确输入,固定值不依赖低层。工具 Provider 查询复用 Core 后端协商、协议、期限与进程树,同一准备操作内复用进程,结束前全部停止;回复引用的原生文件事实与版本证据交 Core 校验,不猜官方来源。删除 Windows 新增的 project-maven-jdk 特例,共享消费 fixture 用两个命名空间工具和显式版本证明通用性;产品准入保持关闭。
  • Windows 原生发布者验签复用现有包签名格式、相同公钥和共享向量,由 ring 执行 Ed25519 校验。导入准备/确认/激活、扫描和启动复核已签名内容;签名消失、无效或文件改变均撤销旧证据,无签名记录不获得官方身份。按次后台验证不创建缓存或改写包;仍不开放 packageTrust/Build/Debug 准入。跨语言 Unicode 排序保留原始文件名字节。
  • 修复 Windows 暂存路径身份:普通盘符/UNC 与等价 verbatim 路径保持一致,设备路径、DOS 保留名、尾点/尾空格和流路径仍在读写前拒绝;保留原生源、链接和安装根保护。修复新增前端测试漏必填 name,并按 invoke 已归一化的 Error 对象翻译工具/签名失败。
  • Windows 工具准备先登记窗口绑定令牌再派发,AbortSignal 贯穿模型、私有 Run scope 和启动前校验。取消早于派发仍拒绝,窗口销毁撤销自己的操作,其他窗口不受影响;活跃租约保留到后端/状态清理结束。扫描、查询和最终发布检查当前性,已启动探测保留原五秒上限。只有有界内存登记,没有新增可复用资源。
  • Windows Provider Run 删除从 Maven languageImport、旧 Maven 路径及应用 runtime 表补齐程序的逻辑,改为当前 resolvedExecutables 工具 ID 绑定;缺失或跨根冲突明确失败。Rust Serialize 与真实 TypeScript Run 编排共用原生上下文 fixture,保留 argv、环境、代次、校验和清理。
  • Windows Agent 的 Build inspect/reload/execute 接到现有工作区 controller、当前领域模型和 Provider;只读查询不探测工具或启动后端。任务精确核对项目、目标、模型任务及模板,领域层再次从当前模型取目标,Core 校验作用域;argv 保持数组。输出/状态/停止复用原有有界操作记录及精确 UUID,列表不复制日志,MCP 撤销不误杀已接受的 IDE 操作,工作区关闭等待清理。本轮已接通配置写入并暴露 lithe_build_configure(见下),产品准入和旧 Maven 消费者继续保留各自门槛。
  • Windows 本机 Build 选项:Core 校验团队/本机合并、声明类型、实例范围、显式空选择及兄弟选项保留;原生 app-data 文档做两层版本检查、条件原子替换与回读。Build 面板与 Agent configure 共用 controller,编辑只产生草稿,隐藏重开保留草稿;保存、取消、恢复继承、冲突和撤销分别处理。无改动重置不创建文件,团队文档不写入。
  • Windows 服务 Debug:Build 目标提供显式“保存并调试”;原生 Registry 按公开类型与完整身份选出唯一接受的适配器,重查包签名、设置、目录与注册代次;Core 展开连接参数。类型化选择经同一 Provider Run,复用 stdio/同包语言服务器、原 DAP 与断点流程,保留完整参数、初始化身份和禁用能力。端口请求取消等待 Core 确认并保留共享服务器;Run 退出/替换、包撤销、Stop 和迟到回执按精确执行清理,失败保留重试所有者。旧数字端口仍拒绝进入 Provider 路径。
  • 新状态位于平台用户存储,独立 adapter/workspace 和 operation/workspace 生命周期已登记资源复用拒绝清单;同步中文决策笔记、功能矩阵、两条 UI 翻译与 Windows CI 调试测试入口。完整 Build/Debug 准入仍关闭。
  • 从共享条目中拆出的 Windows 部分:测试结果行标记保留兼容别名;Run 保存携带独立通用选项快照,参数文本与 macOS 使用同一共享 fixture;拒绝把旧数字 debugPort 静默当成普通运行;宿主把工具证据身份纳入模型失效,摘要不含继承秘密。
  • 工具查询接受有界字符串和正整数 JSON-RPC ID,回复必须保持类型和值;Build 不能传完整直接启动模板时在探测前拒绝额外 flag,也不把运行时安装依赖发布为直接程序绑定,避免静默丢参数。
  • Windows Build 按当前贡献身份读取通用消费偏好(含 inherit:tool),经定义/版本/文件事实链验证并在探测后重查字节;Windows 设置写入、全局默认及旧默认转换仍待完成。

验证

  • e5dcd3dde 相对拆分前 8a52a4b52 只差计划文档里的一段拆分说明,Windows 代码、CI、脚本、笔记、矩阵和 i18n 逐字节一致;i18n 生成检查与 14 项静态检查在本分支通过(中英各 10185 条)。
  • 以下为拆分前在原 PR 上完成的 Windows 验证:
    • 最近共享实现 96f10837e 的 Windows CI 41558993167 五个 job 全部通过,覆盖前端、Rust 与真实 JDT;同提交 Core 全量 1636 项、Project 108 项及相关 macOS 回归本地通过。SDK/Maven 协议和源码未改,固定组合通过记录如下。
    • cc6fc7d8f 的 Windows CI 41550723054 全部通过,覆盖 Windows 前端、原生 Rust 与真实 JDT。该批保留 Draft;SDK/Maven 协议未改变,既有固定组合通过记录如下。
    • 当前 aa8a4a7e1 单次新验证:Windows 41466245542、SDK 41466252742、Maven 41466259510,全部通过;Windows host 398/3 跳过、Project 107/1 跳过、Core 与真实 JDT 各 1595 项。报告前缀 stage-d-tool-preferences-*。
    • 当前本机:Run/Build/LSP/界面 555 项,DAP/生命周期 14 项,错误映射 2 项;类型检查与生产 bundle 全通过。资源复用 33 项、i18n 35 项,以及共享契约、架构/Windows 边界、bundle 只读、Notes、矩阵及两端稳定性检查通过。host 生产/测试编译在 macOS 仅有两项原生 Windows API 基线错误;不计作 Windows 通过。
    • Build 本机选项固定检查点:Core 1623 项、Project 104 项、macOS 130 项、前端 520 项、broker 14 项与真实 MCP stdio 3 项通过;SDK 的 Node/工具 97、Java 62、Rust 38 加 1 文档用例及 6 项真实 E2E 通过。
    • f51968cf4 的 Windows CI 41435122086 全通过:Project 104/1 跳过,host 394/3 跳过,Core 与真实 JDT 各 1587 项。对应 SDK 41435126121 和 Maven 41435128254 也全通过;Java 8 两种 Maven、真实配置、13 步 TypeScript/Agent、框架 JDI 与包字节不变均覆盖。
    • 当前 b810a0abe 单次新验证:Windows 41440877663、SDK 41440952515、Maven 41440957155 全部通过;Windows 计时产物验证 host 398/3 跳过、Project 104/1 跳过、Core/真实 JDT 各 1587 项,Run 366、Build 132、Debug 14、LSP 86 项。

剩余退出条件

Windows 完整插件准入、官方适配器、Windows 设置写入与全局默认、Windows 实机 UI/安装包验收;完整 Build/Debug 准入仍关闭。

Mucheen and others added 30 commits October 26, 2026 23:31
…sue-1495-workspace-capabilities

# Conflicts:
#	macos/Resources/en.lproj/Localizable.strings
#	macos/Resources/zh-Hans.lproj/Localizable.strings
#	macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift
#	shared/i18n/messages.json
Mucheen and others added 18 commits November 2, 2026 16:00
…-stage-d-integration-b87

# Conflicts:
#	shared/contracts/plugins/v1/README.md
#	shared/i18n/locales/en-US.json
#	shared/i18n/locales/zh-CN.json
#	shared/i18n/messages.json
Merges origin/preview (5705732) into the stage D branch. Conflict decisions:

- MavenService.swift and MacMavenDependencyOutputStore.swift stay deleted; the
  preview logging v2 wiring they received has no replacement path because the
  Build Provider owns those flows now.
- Generated i18n outputs (Localizable.strings, shared.generated.ts, locales,
  messages.json) were regenerated from the merged shared/i18n sources.
- Feature matrix, rust-core-api.md, docs/ci-builds.md, worktree resource
  registry and reuse script keep both sides' entries.
- ci-windows.yml keeps the preview queueing structure and re-adds the Build
  provider and plugin-native-errors test entries from this branch.
- Swift conflicts (RustCoreBridge, MacServiceContainer, AppModel+RunConfiguration,
  MacBuildToolResolver, IdeCapabilitiesFeatureModel, PluginTypes) keep the
  preview structured logging changes together with the Build Provider and
  toolchain wiring from this branch.

Follow-ups required by preview rules and by this branch's last commits:

- Satisfy the new log-usage verifier: record build option encoding failures in
  IdeCapabilitiesFeatureModel, and mark the two expected-missing / already
  recorded catch sites in MacRunConfigurationStore and MacBuildToolResolver.
- LegacyMavenConfigurationMigrationTests: the storage double now fails the
  metadata-preserving replace that the run store uses since cc6fc7d.
- ProjectGenerationTests: the split Java Support fixture drops debugAdapters and
  toolDefinitions from the template half and declares the debug permissions
  the language half's adapter needs.
- cargo fmt on the lithe-core files this branch touches.
Merges the three preview commits after 5705732 (git ownership resolution,
log window test deadlines, git/Core/user action traces).

- RunView keeps this branch's staleProviderModel condition and preparing-run
  stop branch inside the preview UserActionTrace wrappers.
- git/mod.rs takes the new command_trace module; lithe-core re-formatted.
- Localizable.strings regenerated from the merged shared/i18n sources.

The remaining-plan document records this integration, the two stale test
fixtures fixed in the previous merge, and why the tool-default migration exit
condition is bound to the Java consumer migration of stage E rather than to
this branch.
prepareCurrentProviderGeneration threw CancellationError whenever the
build-systems feature was absent, so a javaMain run with no enabled build
plugin silently never launched. Skip the Provider model refresh in that case
and keep validating provider generation; an enabled plugin whose feature is
not active still cancels. Fixes the five deferred-run RunEntryPointTests and
corrects the cause recorded in the stage D plan.
…ges to a separate PR

Restore windows/, the Windows CI workflow, the Windows test-stability
script and reference, and the Windows declarative plugin host note to
the preview base 9e1a270. Feature-matrix Windows entries return to
their base state (new capabilities recorded as missing on Windows), and
69 Windows-only i18n messages are removed while shared messages added
in this PR are scoped to macOS. Shared contracts, fixtures, the resource
reuse manifest and docs/ci-builds.md stay because they describe both
platforms. The Windows changes will be restored in a follow-up PR.
…plit from #1558

Bring back, byte for byte from 8a52a4b, the Windows parts that #1558
dropped to stay macOS and Core only: windows/ (native Build tool
resolution, publisher signature verification, Provider Run, Agent Build,
local Build options, service Debug), the Windows CI workflow, the
Windows test-stability script and reference, the Windows declarative
plugin host note, Windows feature-matrix entries and the Windows-only
i18n messages.
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 4, 2026
xiaoyumuxi added a commit that referenced this pull request Nov 5, 2026
- toolchains/README.md 状态段原说 Windows 已有目录固定、声明式扫描、shell 候选和提供者查询的 Build 管道;这些代码在未合入的 Draft #1722,preview 的 Windows 宿主没有工具链适配器,也不声明 toolDefinitions、toolchainProviders。改为如实说明,并写明 Core 在 Windows 上拒绝需要这两项能力的包。
xiaoyumuxi added a commit that referenced this pull request Nov 5, 2026
* docs(contracts): 插件契约 fixtures 按功能分目录并修正能力版本表

- fixtures/ 下的平铺文件按契约领域移入 manifest、languages、backend、editor、ui、
  settings、build-systems、build-providers、debug-adapters、vcs、keymap-import、
  project-generators、toolchains、package-trust、marketplace 子目录
- toolchains.md 移为 toolchains/README.md,proposals/toolchains/ 并入
  toolchains/proposal/(示例与用例在 fixtures/toolchains/proposal/)
- 项目生成器模板移入 fixtures/project-generators/templates/,Java 示例原样保留
- 三个顶层 schema 路径与 $id 不变
- verify-shared-contracts.sh 新增检查:fixtures/ 根目录不得有散落文件、
  fixture 文件名在各子目录间唯一(用例文件只按文件名引用基础清单)
- Rust Core、macOS、Windows 测试与 Agent Note、功能矩阵证据路径同步更新;
  Windows plugin_host 测试改为按文件名在子目录中查找 fixture
- 契约 README 能力版本表:serverProcess 补版本 2,合并重复的
  executableResolution 行,补 keymapImportProviders 行,API 级别补 4;
  schema 的 requires.buildSystems 枚举补 4

* docs(contracts): 注明 serverProcess 2 只有 Core 支持,两个宿主只声明 1

macOS 的 PluginManifest.hostCapabilities 与 Windows 的 host_capabilities() 都只声明 serverProcess 1,需要 serverProcess 2(debugAdapters 的 runSelectedRuntime)的插件目前在两个平台都会被宿主拒绝。

* docs(contracts): litheBuild 协商版本列表补到 11

构建提供者一节写的宿主提供版本还停在 [8…1],与同文件前文和 Core build_provider.rs 的 SUPPORTED_VERSIONS(11…1)不一致;补上 9(语义测试选择器)、10(类型化运行选项与服务/任务运行准备)、11(注册表连接调试)的说明。

* docs(contracts): 修正工具链、快捷键导入、VCS 与 Windows 宿主现状的过时说明

- 契约目录表和工具链 fixtures 说明:macOS 已为设置页、Build 与运行工具使用插件工具链,Windows 未接入
- 工具链一节:Build 工具和运行计划里指向插件定义工具的 toolchain 可执行文件走独立的新鲜解析
- 能力表 toolDefinitions/toolchainProviders/executableResolution 的宿主说明同步
- Shared executable candidates 锚点改为 -12(两处)
- 快捷键导入:macOS 已声明能力,三个官方 SDK 已实现
- Current Windows availability:Windows 声明 ui 1、2,不声明 3、4
- 工具链提案 README 的示例目录改为 fixtures/toolchains/proposal/
- vcs-provider-v1 状态行:macOS 已启动提供者

* docs(contracts): 工具链契约去掉 preview 上不存在的 Windows Build 管道说明

- toolchains/README.md 状态段原说 Windows 已有目录固定、声明式扫描、shell 候选和提供者查询的 Build 管道;这些代码在未合入的 Draft #1722,preview 的 Windows 宿主没有工具链适配器,也不声明 toolDefinitions、toolchainProviders。改为如实说明,并写明 Core 在 Windows 上拒绝需要这两项能力的包。

* docs(contracts): Windows 市场现状与 Lua 模板平台说明对齐 Core 的 validateIndex 规则

Core 的 plugins.marketplace.validateIndex 只在 darwin-* 平台把没有 requires 的级别 2 版本标为可用,Windows 只支持从磁盘安装声明式插件、没有市场浏览入口。Lua 模板第 5 步原写可列 macOS 和 Windows,改为只列 darwin-*;顶部工具链说明不再写死命令数量。

* docs(contracts): 按 Windows 已合入的磁盘安装实现改写其现状说明

Windows #1424 已实现私有快照、installReview 和用户确认的磁盘安装,原文仍写 Windows 没有这套流程。改为写明它做了什么,以及与 macOS 的差距:不验证发布者签名、只比对 plugin.json、不记录已批准程序和来源、没有市场安装入口。

* docs(contracts): 签名向量的说明不再声称 Windows 已有签名模块

Windows 的签名验证还在未合入的 Draft #1478,preview 上只有 macOS 的 PluginPackageSignature 测试使用这组向量。
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 5, 2026 05:50
@lithe-code-review

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

Copy link
Copy Markdown

Lithe Review

结论: ⚠️ 有建议
范围: preview ← codex/issue-1495-windows · head: e5dcd3d

未发现需要阻塞合并的问题。以下均为 P2 建议,涉及准入仍关闭的新链路。

Findings

  1. [P2] 将项目工具的显式执行许可传递到原生解析器
    windows/tauri/src/features/build/services/build-provider-workspace.ts:254

    • 实际影响:readConfiguration(instance, true) 仍以 false 调用 begin。原生 build_tools.rs:77 将此值用作 explicit,再于第 224 行传入 project_code_allowed。因此,用户点击“使用项目工具读取”后,插件工具定义中的项目 Wrapper 仍被拒绝,无法读取配置。
    • 触发条件:在受控准入环境中,Build 引用命名空间工具定义,且当前可用选择是项目 Wrapper 或项目内固定可执行文件。
    • 复现步骤:沿用 defined_toolchain/tests.rs:491 的 Wrapper 与 marker 输入,通过真实原生工具端口调用 readConfiguration(instance, true);Core 的 project_selection 因 projectCodeAllowed=false 拒绝选择,Provider 请求不会发出。第 168 行的模型准备和第 431 行的 Run 重验也固定传入 false,存在同一许可传递缺口。
    • 来源:本次引入。现有前端测试忽略 _checkVersions,直接返回已解析工具,未覆盖此跨层行为。
  2. [P2] 避免已绑定的 Provider Run 再次探测无关 JDK
    windows/tauri/src/features/run/services/build-provider-run-launch.ts:108

    • 实际影响:这里已取得当前准备操作的具体程序路径,却仍调用通用 resolveRunLaunch。生产接线进入 run.rs:728,无条件执行自动 JDK 解析;java_home_candidates 包含项目的 .lithe/toolchains/jdk,随后运行其中的 Java 启动器。即使 Provider 没有 Java 依赖,也会执行未参与本次工具选择的程序,并增加串行探测延迟。该 IPC 没有传递本次取消信号。
    • 触发条件:受控环境中的 Provider Run 使用独立工具定义,同时机器或工作区存在可探测的 Java 启动器。
    • 复现步骤:配置只依赖非 Java 工具的 Provider Run,在 .lithe/toolchains/jdk/bin/java.exe 放置会记录调用的测试启动器;启动该 Run,最终解析阶段仍会调用它的 -version。现有 Run 测试 mock 了 resolve,无法发现这次额外执行。
    • 来源:本次引入。通用解析器原有此行为,本次新增的 Provider 调用方将它带入了已完成工具绑定的新链路。
  3. [P2] 将 Run 选择和参数协议判断收敛到 Rust Core
    windows/tauri/src/features/build/services/build-run-preparation.ts:8

    • 实际影响:新函数在 TypeScript 中决定项目、目标、Run 声明匹配及歧义拒绝,并在第 23 行决定使用旧 opaque 参数还是新版 launchOptions。同一规则又由 Swift 的 BuildSystemService.swift:1220 和 RunConfigurationContracts.swift:443 实现,当前形成两份跨平台契约判断。
    • 触发条件:准备任意保存的 Provider Run,尤其是仍使用协议 4 参数通道的 application。
    • 复现路径:prepareConfigurationRun → configurationRunSelection → build.prepareRunPlan;调用 Core 前,平台层已经作出了选择和协议分支决策。这些判断仅依赖共享数据,不需要系统或界面 API,违反本次审查政策第 10 条的 Core 归属要求。
    • 来源:本次引入;上述 TypeScript 函数及 Swift 兼容判断均在本范围新增。

Scope Check

  • 关联需求:[Feature] macOS 存量重构计划:清理废弃实现,将 Maven/Java 领域逻辑完整迁入插件后端 #1495;本 PR 是阶段 D 的部分交付,不能据此关闭整个迁移 Issue。
  • 已检查范围:Windows 工具解析、验签、Build 配置、Provider Run/Debug、取消与清理链路,以及直接相关的共享 Core、契约、测试和部分 macOS 消费者。
  • 未完成范围:完整 Windows 准入、设置写入与全局默认、实机 UI 和安装包验收,PR 已明确列为后续工作。
  • 能力复用:主要复用现有 Core、Provider 会话、Run 进程和 DAP;Finding 3 指出仍重复持有的通用决策。
  • 三项 Finding 均由本次新增代码或新增调用路径引入,属于本次职责范围。

Suggestions

  1. 将“允许项目代码”和“重新探测版本”拆成独立参数;让显式读取、显式 Run 的准备及重验保留同一操作许可,自动读取继续拒绝执行项目代码。补充贯穿前端与原生解析器的 Wrapper 回归用例。
  2. 为 Provider 已绑定路径提供不进行工具发现的原生启动解析入口,仅处理路径、工作目录和环境;用真实原生调用验证非 Java Provider Run 不启动 Java 探针。
  3. 在 Core 中统一返回项目/目标/Run 选择及参数通道,两端消费同一结果,并以共享 fixture 覆盖旧 application、新版 service、歧义和截断模型。
  4. 补充受影响 Build、配置编辑和 Run/Debug 界面截图;已有界面提供前后对比。所给上下文没有截图。

Summary

新链路对操作身份、取消、迟到结果和清理已有较完整的保护。主要缺口是显式许可在跨层传递时丢失、最终启动仍触发旧工具发现,以及部分共享语义尚未进入 Core。

Verification

  • 静态审查固定 4c69621...e5dcd3d,包含继承的共享和 macOS 变更,未缩减为最后一个提交。
  • 已取得完整文件清单;本次按高语义调用链重点审查,未逐行覆盖全部 445 个文件。
  • 提供的 head 检查中,CI tooling、共享 i18n、Agent Notes 等成功;Windows 前端、Windows Rust、真实 JDT、Swift 和 Rust Core 测试任务均为 skipped。gate 成功不能替代这些测试的执行结果。
  • PR 正文提供了其他提交的历史测试结果;未独立核验其与 head 的等价性。建议补充 head 对应的平台测试及 bundle 只读检查证据。
  • 按只读要求,未运行仓库代码、测试、i18n 或 bundle 检查,未启动应用、访问网络或发布评论;视觉效果及实机行为尚未验证。

@lithe-code-review

Copy link
Copy Markdown

Lithe 运行验收

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

执行未完成:GitHub API GET /repos/1lck/Lithe-IDEA/pulls/1722 - 401: {
"message": "Bad credentials",
"documentation_url": "https://docs.github.com/rest",
"status": "401"
}

本次未形成完整验收结果,详见执行原因。
详细步骤和原始证据保存在服务器受限目录(14 天、总计不超过 1 GiB);当前没有公开下载链接。

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.

3 participants