Skip to content

fix(desktop): 没有运行配置时说明原因,“编辑运行配置…”不再无反应 - #2102

Merged
1lck merged 6 commits into
mainfrom
fix/2028-run-config-empty-state
Nov 17, 2026
Merged

1lck merged 6 commits into
mainfrom
fix/2028-run-config-empty-state

Conversation

@1lck

@1lck 1lck commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

关联 Issue / Linked issue

PR 类型 / Type

  • feat:新功能或用户可见的改进
  • fix:缺陷修复
  • docs:文档、Agent Note、Skill 等规则文件
  • release:稳定版发布准备

改动说明 / What changes

背景 / Why

项目没有运行配置时(例如 Maven 插件还没有声明运行项的 Spring Boot 项目),点标题栏下拉底部的“编辑运行配置…”没有任何可见反应。另外,旧版保存在 .lithe/run/local.json 的 java.main、spring-boot.maven 等配置被直接过滤,界面上看不出有配置被隐藏,也看不出原因。

改动 / Changes

  • desktop/internal/workbench/title_run.go
    • editRunConfigurations:配置已经读完、列表为空、读取也没有失败时,不再打开空的运行窗口,改为发一条提示:运行配置由构建插件根据项目模型生成,当前启用的构建插件没有为这个项目声明可运行的入口。有被隐藏的已保存配置时,提示里写明条数。构建模型读取失败时提示失败原因。列表不为空、正在读取或读取失败时,行为和以前一样。
    • 新增 noRunConfigurationsNotice、hiddenRunConfigurations。
  • desktop/internal/workbench/runconfig.go:runConfigState 新增 hidden,统计没有进入列表的已保存配置,两类:
    1. Core 解析出、但没有构建插件引用(extensions.build)的配置,例如 user: 开头、provider 是 spring-boot.maven 的条目;
    2. Core 报为 orphanedOverride 的条目,例如旧版生成的 java.main:… 覆盖项。现在的 Core 已不再生成这些配置,它们在解析阶段就被丢掉了。
  • desktop/internal/workbench/title_run_view.go:下拉显示“没有运行配置”时,如果 hidden > 0,下面再显示一行不可点的“已隐藏 N 条无法运行的已保存配置”。
  • i18n:新增 desktop.title.nothingToEdit、desktop.title.nothingToEditHidden、desktop.title.hiddenRunConfigurations 三条中英词条,并提交生成结果。
  • desktop/internal/workbench/build.go:运行和调试构建插件提供的目标时,宿主现在把已经解析出的构建工具路径作为 tool.executable 发给提供者的 lithe/build/prepareRun / prepareDebug。这条提示是契约里的可选字段,以前没有发送,提供者只能自己再查找一遍 Maven(会绕过用户在设置里指定的 Maven executable)。新增 addBuildToolHint,运行和调试两条路径都调用;解析失败时记一条 build_run_tool 后台失败日志,不带提示继续,由提供者自己查找,不会因此挡住运行。顺带把 resolveBuildExecutable 被插开的文档注释放回原位。
  • 功能矩阵 viva-title-run-debug:能力描述和验证动作补上空列表的提示和隐藏条数。
  • 测试:title_run_test.go 新增三个用例;build_command_record_test.go 新增 TestBuildRunPreparationCarriesTheResolvedTool:PATH 上有构建工具时请求带上它的路径,没有时不带提示;新增无头截图用例 title_run_empty_visual_test.go(vivahead 标签)。
  • 截图放在 docs/assets/run-config-empty/。

用真实 Maven 插件实测后补的 4 个宿主缺陷(提交 8f690d0)

用 Maven 插件 PR(Lithe-IDEA/lithe-plugin-maven#28)的发行包加上 Java Support 4.0.1 发行包,在真实 Spring Boot 双模块工程上跑端到端测试,发现宿主有 4 处跟契约不一致,都已修复:

  1. 依赖树来源(pluginservice/builds.go、workbench/build_dependencies.go):声明了 provider 进程、但依赖树用 command 读取的构建系统,宿主以前按“有没有 provider”决定走哪条路,走了提供者路径,Core 报 This command writes to a file; pass outputFile.。现在解析清单里的 dependencies.source,由它决定路径;BuildDependenciesDeclaration 新增 Source。提供者路径拿到命令计划时返回明确错误。
  2. 模型来源(workbench/build.go、settings_plugin_sources.go):设置页的构建源编辑器对 command 模型也去问提供者。新增 buildModel 统一按 ModelSource 分派,loadBuildModelWith 和设置页共用。
  3. 运行项命名(pluginservice/builds.go、runconfig.go、build_tree.go、build_menus.go):契约规定 run.name 缺省时条目以目标命名,宿主以前把缺省名填成 run ID,界面显示成 spring-boot ShopApplication。现在不再填默认值,新增 EntryName / ActionName。
  4. 运行准备的构建输出(workbench/build.go):lithe/build/prepareRun 期间提供者推送的编译输出和进度以前被丢掉,编译失败时控制台是空的。新增 awaitProviderOperation,转发输出和状态后再等待结果,runProviderOperation 和运行准备共用。

另外合并了最新 main(Core 固定版本随之升到 cf2f26095bb352f69d248f840dd7d6126747482e),没有冲突。

不在本 PR 范围内 / Out of scope

类型专属:fix

复现与根因

  • 复现步骤、实际结果、期望结果:打开一个构建插件没有声明 run 的项目(测试里用合成构建实例,System.Runs = nil),等配置读完,点标题栏下拉的“编辑运行配置…”。实际结果:只调用 openToolWindow(itemRun);运行窗口在列表为空时什么也不画,titleConfiguration() 为 nil,所以也不打开编辑器,看起来就是没有反应。期望结果:说明为什么没有可编辑的配置。
  • 根因:editRunConfigurations 在 42d6fb9(feat(desktop): #1794 标题栏运行/调试接入,调试工具窗口按 IntelliJ IDEA 布局重做 #1837,标题栏运行/调试接入)引入,没有处理“列表为空”的情况;finishRunConfigurations 过滤非构建插件配置时只删除、不计数;旧版生成的覆盖项又在 Core resolve 中作为 orphanedOverride 诊断返回,桌面端没有读取。
  • 影响平台:macOS、Windows(同一份 Viva 代码)。

检查项

  • 已先写回归测试,确认它在修复前失败、修复后通过;测试路径与修复前的失败输出:desktop/internal/workbench/title_run_test.go 的 TestEditRunConfigurationsWithoutAnyExplainsWhy 和 TestEditRunConfigurationsCountsTheConfigurationsNoBuildPluginStarts。临时去掉新加的提示分支后,两个用例都失败,输出 notice = "", want "这个项目没有可编辑的运行配置。…";恢复后通过。TestEditRunConfigurationsOpensTheChosenOnesEditor 确认有配置时仍然打开运行窗口和编辑器。
  • [N/A] 无法自动化时,已写明手动复现与验证步骤:已自动化
  • 已搜索被修改函数、类型、契约字段的全部调用方(含另一平台、插件、SDK、脚本和按字符串分发的调用):editRunConfigurations 只有标题栏菜单一个调用方;BuildPlanRequest.Tool 已经存在、Core 原样转发给提供者,只是宿主以前不填;runConfigState 新增字段,不改已有字段;orphanedOverride 只读取 Core 已有的诊断,不改契约
  • [N/A] 已检查另一平台是否有同类缺陷:Viva 是 macOS 和 Windows 共用的一份代码,旧客户端已经移除
  • 只改了修复所需的代码,没有夹带重构;修复过程中发现的其他问题已提交 Issue:[Feature] 构建提供者的服务运行支持按配置类型连接调试(Spring Boot 运行配置可直接点调试) #2107(provider 服务运行的连接调试)、[Feature] 没有在 POM 里写明主类的 Java main 类可以直接运行,并保存为运行配置 #2104(运行任意 main 类)、[Bug] 完整桌面测试负载下 TestWSLScriptStartsTheLoginShellInTheStartFolder/bash 等首个提示符 10 秒超时 #2108(全量测试负载下 TestWSLScriptStartsTheLoginShellInTheStartFolder/bash 偶发超时,单独跑 3/3 通过)
  • 4 个实测缺陷的回归测试都先确认修复前失败:TestBuildProviderSystemReadsItsTreeWithAFileCommand(修复前报 pass outputFile)、TestProviderRunPreparationShowsItsBuildOutput(修复前控制台为空)、TestBuildProviderSystemReadsItsModelWithItsCommand、TestParseBuildSystemsKeepsDependencySourceAndUnnamedRuns
  • [N/A] 修复改变了行为约束或容易复发,已在 .agents/notes/implemented/bug-fix/ 记录:只补了空状态提示,没有改变行为约束

范围检查 / Scope checks

功能矩阵 / Feature matrix

  • 已更新 shared/platform-feature-matrix/features/viva-title-run-debug.json,两端验证状态仍为 pending
  • 已运行 ./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(validated 197 platform capabilities)和 verify-platform-feature-matrix-change.sh origin/main HEAD(passed)
  • 没有提交 .artifacts/ 下生成的矩阵视图
  • [N/A] 没有更新矩阵的,理由:已更新

插件归属 / Plugin ownership

  • 已在仓库根目录运行 develop-lithe 第三节“插件归属与宿主零依赖”的自查命令,结果为空
  • 新增或修改的测试只使用测试内联的合成插件、Core 契约 fixture 或插件市场索引快照:测试用的是合成构建实例 dev.example.engine,local.json 里写的 java.main、spring-boot.maven 只是 provider 字符串,用来模拟旧版保存的数据,没有读取任何插件
  • 没有为具体插件提供的能力新建或更新宿主功能矩阵条目
  • 插件文案没有写进 shared/i18n/
  • [N/A] 修改了通用扩展点、可能影响已发布插件的:没有改扩展点

UI 验证 / UI evidence

  • 已运行受影响场景的 Viva 无头测试,生成并检查截图:LITHE_VISUAL_OUTPUT_DIR=<dir> scripts/desktop/desktop-go.sh test -tags vivahead ./internal/workbench/ -run TestVisualTitleRunWithoutConfigurations -count=1,提交 904e1d9160f4dadf595ffcbb95c29dbeef99cdeb,1280×800,scale 1;场景:亮色/中文、暗色/英文,各截下拉菜单和点击“编辑运行配置…”之后的画面
  • 已在本 PR 嵌入截图:
下拉菜单 点击“编辑运行配置…”后
  • 布局与视觉变化有改动前后对照……:改动前,下拉菜单只有“没有运行配置”一行,点击后画面不变(没有提示),所以没有单独截“改动前”。目标平台原生窗口验收:pending

统一日志系统 / Structured logging

  • 空列表提示是信息级,不是警告或错误;构建失败的情况沿用已有的 p.build.failed,失败日志由原处理边界记录。
  • 运行准备期间提供者推送的进度和输出现在转发到运行控制台和状态栏(awaitProviderOperation),失败仍由原处理边界记录,没有新增日志事件。
  • 新增的降级路径:解析构建工具失败时,addBuildToolHint 用 backgroundFailedIn(ctx, "build_run_tool", err) 记一条后台失败日志(沿用运行请求的上下文和插件字段),然后不带提示继续。

界面文案 / i18n

  • 宿主文案都走共享 i18n:新增三条中英词条,运行了 generate-i18n.mjs 并提交生成结果
  • [N/A] 插件提供的文字:不涉及
  • 已运行 node scripts/i18n/verify-app-language-localization.mjs(passed)和 node scripts/i18n/generate-i18n.mjs --check(passed)

逻辑归属 / Logic placement

  • 可共享的逻辑在 Rust Core:哪些配置被隐藏的判定直接沿用 Core 的结果(解析出的配置有没有 extensions.build,以及 orphanedOverride 诊断),平台层只计数并呈现
  • [N/A] 修改平台层已有的可共享逻辑时已迁入 Core:没有改动过滤规则本身,只加了计数
  • 宿主和 Core 没有按工具名加分支

性能与内存 / Performance and memory

N/A:没有新增后台功能、子进程、缓存或定时器;计数只在配置读完时遍历一次已有列表。

设置 / Settings

N/A:没有改设置。

插件契约 / Plugin contract

N/A:没有改契约、能力版本或宿主方法。

发行包与资源 / Bundle and resources

N/A:没有新增运行时资源。

无用代码与重构 / Dead code and refactoring

  • 本次改动导致变成无用的代码已在本 PR 删除:没有产生无用代码
  • 本次之前就存在的无用代码或可重构之处,已提交带 refactor 标签的 Issue:本次没有发现

验证 / Verification

命令或操作 平台 结果
scripts/desktop/desktop-go.sh test ./internal/workbench/ ./internal/i18n/ -count=1 macOS arm64 ok(workbench 201s)
scripts/desktop/desktop-go.sh test ./internal/workbench/ -run 'TestBuildRunPreparationCarriesTheResolvedTool|TestEditRunConfigurations|BuildCommand|PrepareRun|Debug.*Provider' -count=1(工具提示提交之后重跑) macOS arm64 ok
scripts/desktop/desktop-go.sh vet ./internal/workbench/、gofmt -l macOS arm64 无输出
用这个分支的 Core 校验 Maven 插件新的 plugin.json(pluginhost.Validate + Declared(),临时测试,未提交) macOS arm64 接受
回归测试在修复前失败、修复后通过(见上文) macOS arm64 已确认
scripts/desktop/desktop-go.sh test -tags vivahead ./internal/workbench/ -run TestVisualTitleRunWithoutConfigurations macOS arm64 ok,生成 4 张截图
node scripts/i18n/generate-i18n.mjs --check、verify-app-language-localization.mjs macOS passed
功能矩阵两个门禁 macOS passed
合并 main 后全量 scripts/desktop/desktop-go.sh test ./...(8f690d04a) macOS arm64 除 #2108 的偶发超时外全部 ok;该用例单独跑 3/3 通过
合并 main(964cfd57c,新 Core)后 test ./internal/workbench/ ./internal/pluginservice/ ./internal/i18n/ ./internal/core/ ./internal/buildprovider/ macOS arm64 全部 ok(workbench 214s)
真实端到端:Maven 插件 #28 的 TestOfficialMavenPluginBuildsAReactor、TestOfficialMavenPluginRunsASpringBootApplication(真实 mvn、Spring Boot 3.5.13 双模块工程、Java Support 4.0.1 发行包) macOS arm64 在 964cfd5 上 PASS(47.8s、6.1s):下拉只有 ShopApplication;编辑器保存的 JVM 参数、程序参数、环境变量都进入了进程,/hello 返回 Hello, Lithe from eu-west;控制台有反应堆编译和 Tomcat 启动输出;停止后端口释放;插件包未被改写;测试结束后没有 java / Lithe 进程残留。测试文件只是临时复制进来,跑完已删除

未能执行的检查和原因: 没有在 Windows 虚拟机和 macOS 原生窗口里交互验收;改动在共用的 Viva 代码里,不涉及平台适配,功能矩阵验证状态保持 pending。

提交前确认 / Final checks

  • 分支从最新的 main 创建;目标分支 main
  • 以 Draft 提交,本地验证通过后才标记 ready
  • 没有无关改动,没有提交产物,没有凭据、个人路径和未脱敏的日志或截图
  • 本次测试没有启动 Lithe 应用(只跑了无头测试和 harness 端到端),Spring Boot 进程由运行停止结束,确认没有进程残留

🤖 Generated with Claude Code

1lck and others added 3 commits November 17, 2026 03:16
…lent Edit Configuration (#2028)

Edit Configuration… opened the Run window and an editor only when the title
bar had a configuration, so on a project without one the press showed
nothing. Once the configurations are read and none is listed it now posts a
notice saying that build plugins generate them and none declared a runnable
entry for the project.

Saved configurations that no build plugin starts (user entries of another
provider, and overrides Core reports as orphanedOverride, such as the
java.main entries an earlier version generated) were dropped without a
trace. The list counts them; the menu and the notice say how many are
hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd its notice (#2028)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 17, 2026
…preparation

Dependency and test requests to a build provider carry the build executable
the host resolves (tool.executable), but run and debug preparation did not,
so a provider that builds before launching could not use the user's Maven
wrapper or configured executable. Both now add the hint; when nothing
resolves the request goes without it and the reason is logged.

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

1lck commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

Maven 插件侧的配套改动:Lithe-IDEA/lithe-plugin-maven#28(导出可运行的 target、声明 provider run、实现 lithe/build/prepareRun;它会使用本 PR 发送的 tool.executable)。

1lck and others added 2 commits November 17, 2026 04:39
…and preparation output

Found by running a real Spring Boot project through a build plugin whose
provider process only prepares runs:

- Dependencies follow the dependency declaration's source, not whether the
  system declares a provider. A provider system's command that writes its
  tree to a file got no output file, which Core refused ("pass outputFile").
- The settings source editor loads the model through the same buildModel
  helper as the Build window, by the model's source; it asked the provider
  process, which serves no model.
- A run without a name is named after its target, as the contract's
  run.name says; the host defaulted the name to the run ID, so every
  configuration read "spring-boot ShopApplication".
- Run preparation forwards the provider's progress to the run's console and
  status, through the loop provider tasks already used; a compile error the
  provider printed before failing never reached the user.

Refs #2074

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1lck
1lck marked this pull request as ready for review November 17, 2026 12:52
@1lck
1lck merged commit 75edb96 into main Nov 17, 2026
2 of 6 checks passed
1lck added a commit to Lithe-IDEA/lithe-plugin-maven that referenced this pull request Nov 17, 2026
…ost that supports it

- TestOfficialMavenPluginRunsASpringBootApplication installs the Maven and Java Support
  archives, saves JVM/program arguments and an environment variable in the run
  configuration editor, runs ShopApplication, checks /hello and the console, then stops it.
- The archive helper wires the tool resolvers like the app and can install several plugins
  into one service; run console output is read from the operation's session.
- lithe-host.json pins 75edb9674 (1lck/Lithe-IDEA#2102) and requires
  LITHE_TEST_JAVA_PLUGIN_ARCHIVE.
- README and feature matrix: debugging waits for host support (1lck/Lithe-IDEA#2107).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck added a commit to Lithe-IDEA/lithe-plugin-maven that referenced this pull request Nov 17, 2026
* feat(extension): export runnable applications and run classpaths

The model now lists Spring Boot applications (@SpringBootApplication
classes, or spring-boot-maven-plugin) and applications whose main class
exec-maven-plugin or the jar manifest names as targets tagged
spring-boot / java-application with a mainClass property. Reading stays
compile-free: only source heads and POM configuration are read, within
fixed bounds.

With -Dlithe.runOutput and -Dlithe.runProject the extension writes, after
the build, the project's runtime classpath (output folder plus compile,
runtime and system dependencies, reactor siblings from their output
folders) and the compiled classes with a main method, marking the
@SpringBootApplication ones. A failed build writes nothing.

Refs 1lck/Lithe-IDEA#2074

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

* feat(maven): run and debug applications through a build provider

plugin.json declares a build provider process (lib/lithe-maven-provider.jar,
built with the vendored Java SDK for Java 8) and two provider runs:
spring-boot (service, debuggable through a registry java adapter) and
application. prepareRun compiles the project with -pl -am process-classes
using the Maven Lithe resolved (or mvnw, MAVEN_HOME, PATH), reads the run
document the extension wrote and returns java -cp <classpath> <main class>
on the project's JDK. Long classpaths go into a manifest-only jar under
target/lithe-run/. A debug request adds a suspending JDWP agent on the
host's port.

Refs 1lck/Lithe-IDEA#2074

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

* test: prepare, launch and debug runs of the fixture reactor; document runs

The fixture gains a Spring Boot service module (a local stand-in for the
annotation, no download) and a jar-manifest main class in app. The
integration lane checks the targets, then starts the packaged provider,
prepares runs and launches the returned commands, and checks the reactor
classpath, main class discovery, debug arguments and a failed build.

README and the feature matrix describe the new maven-run-applications
capability.

Refs 1lck/Lithe-IDEA#2074

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

* test(e2e): run a real Spring Boot reactor through the host; pin the host that supports it

- TestOfficialMavenPluginRunsASpringBootApplication installs the Maven and Java Support
  archives, saves JVM/program arguments and an environment variable in the run
  configuration editor, runs ShopApplication, checks /hello and the console, then stops it.
- The archive helper wires the tool resolvers like the app and can install several plugins
  into one service; run console output is read from the operation's session.
- lithe-host.json pins 75edb9674 (1lck/Lithe-IDEA#2102) and requires
  LITHE_TEST_JAVA_PLUGIN_ARCHIVE.
- README and feature matrix: debugging waits for host support (1lck/Lithe-IDEA#2107).

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

* fix(provider): find a bare Maven command on PATH, with PATHEXT on Windows

Java starts a command without a directory through the operating system, which on Windows
finds only .exe files, so `mvn` (mvn.cmd there) failed to start and the preparation ended
as "The plugin backend failed unexpectedly". The provider now resolves such a name on the
PATH of the build environment, trying each PATHEXT extension on Windows, and reports
maven.run.noMaven when nothing matches.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@xiaoyumuxi
xiaoyumuxi deleted the fix/2028-run-config-empty-state branch November 20, 2026 01:32
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.

[Bug] 没有兼容运行配置时“编辑运行配置…”静默无反应

1 participant