[Bug] Windows 调试运行时测试直接比较路径字符串,等价分隔符导致误报失败

Open Beginner friendly
#2,432 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
testing

Research direction

Start with internal/workbench/debug_launch_test.go, especially the path assertion at line 142 in TestDebugRuntimeArgumentsComeFromTheToolDefinition; read how the test builds its expected executable path and compare it using Windows path semantics. Preserve the argument order and FICTIONAL_VM_HOME checks, and avoid printing the full launch environment in failure output. The issue is done when equivalent Windows paths pass while those checks remain, allowing the adapter lifecycle checks to run.

Written by the indexing model from the issue text.

Description

review: medium
Platform / 平台

Windows

Area / 模块

Test / 测试

Lithe version / Lithe 版本

源码测试构建:测试二进制启动时 checkout HEAD 为 4225299b1073f39e87ddc36caa20fd6da98bb0fb,含 #2425 的工作台测试修复。相关 debug_launch.go、debug_launch_test.go 相对 main 349f389ba027bedd003fbda2faf0e7f64d7e7f10 无差异。另用 main 的工作台源代码 overlay 得到同一失败,详见下文。这是源码测试失败,不是已发布应用的运行报告。

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

OS and architecture / 操作系统与架构

Windows 11 Pro,build 26300,原生 amd64 物理机,无架构仿真。

Environment / 环境信息
  • 发生于 2026-11-26(Asia/Shanghai)的本地 Windows 工作台分段测试。Go 1.27.4、GNU Rust 1.100.0、Git 2.56.1.windows.1;CPU Intel Core Ultra 5 125H,32 GiB 内存。
  • 默认固定 Core e8927412b6324636f2636b58c521758451d97fc4、Viva 448b0553faf8,无本地依赖覆盖。通过仓库的 Git Bash / desktop-go 构建与测试入口执行。
  • 测试使用本地临时目录、虚构工具定义与合成调试适配器;FICTIONAL_VM_HOME 指向测试生成的运行时目录,入口是该目录下的 jre/bin/vm.exe。它不依赖已安装的真实 Java 运行时或具体插件。
  • main 对照通过 Go overlay 将本分支相对基线有差异的 20 个 Go 源文件(含工作台和 i18n 生成文件)映射回 349f389ba,本次新增文件替换为空的 package workbench,使用相同固定依赖;这是该包的源码对照,不宣称重新验证了整个 main 仓库。
  • 不涉及真实用户项目、发布安装目录或原生 GUI;未采集磁盘占用等与已确认路径字符串断言无关的指标。没有将完整环境变量或原始私人路径放入本报告。
Steps to reproduce / 复现步骤
  1. 在 Windows 上准备上述源码与默认固定依赖,按仓库构建入口运行工作台测试。本轮实际由工作台分段测试触发。
  2. 用例可用 scripts/desktop/desktop-go.sh test -count=1 ./internal/workbench -run '^TestDebugRuntimeArgumentsComeFromTheToolDefinition$' 筛选;本报告没有为补材料额外执行隔离复跑。
  3. 用例创建合成运行时并调用 prepareDebugLaunch,在 debug_launch_test.go:142 比较可执行文件路径、参数及运行时环境变量。
Expected behavior / 预期行为

等价的 Windows 文件路径应通过断言,同时继续严格校验参数顺序与 FICTIONAL_VM_HOME,并执行后续调试适配器启动与生命周期检查。

Actual behavior / 实际行为

用例在路径字符串断言失败:Core 返回使用 / 的绝对路径,测试用 Go filepath.Join 生成使用 \ 的预期路径,随后直接比较字符串。对失败日志做本地最小字段解析后,实际路径与预期路径经 Windows 路径规范化相等,参数顺序完全相同;这不是参数顺序错误的证据。

当前工作台测试中该用例在 0.40s 失败;main 源码 overlay 中在 1.13s 以同一断言失败,两次均得到相同的路径等价性与参数比较结果。相关源码未被 #2425 修改,证据不支持将此失败归因于新增 taskGroup 或等待 helper。

建议在测试断言处按 Windows 路径语义比较可执行文件,保留参数和环境变量断言;失败信息仅输出必要字段,不再用 %+v 输出包含完整环境变量的 launch 对象。此次断言阻止了后续真实适配器生命周期部分,因此不能据此声称完整调试启动已经通过。

Logs or diagnostic output / 日志或诊断输出
# 当前测试构建(启动时 checkout HEAD 4225299b1)
--- FAIL: TestDebugRuntimeArgumentsComeFromTheToolDefinition (0.40s)
# 断言位置 debug_launch_test.go:142,失败输出位于 :143;原始 Environment 对象未附。

# main 349f389ba 工作台源码 overlay,相同依赖
--- FAIL: TestDebugRuntimeArgumentsComeFromTheToolDefinition (1.13s)

# 两份原始日志的本地最小字段解析结果;不是重新运行用例
raw_executable_path_equal=false
normalized_windows_executable_path_equal=true
arguments_equal=true
actual_executable_uses_forward_slashes=true
expected_executable_uses_backslashes=true

# 同一运行时入口的脱敏结构示例(非原始私人路径)
actual:   <TEMP>/jre/bin/vm.exe
expected: <TEMP>\jre\bin\vm.exe

上面断言说明已概括脱敏;原始 %+v 包含完整 Environment,因此没有附上原始行或原始日志文件。仅保留理解路径差异所需的信息。

Screenshots or recordings / 截图或录屏

不适用:命令行测试中的路径断言,无可见界面变化。

Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复报告。
  • I removed secrets and personal data from the report. / 我已从报告中移除敏感信息和个人数据。
Dominant language
TypeScript
Stars
1.8k
Forks
151
Avg merge
3h 48m
Merged PRs (30d)
571

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1lck/Lithe-IDEA

All issues in 1lck/Lithe-IDEA

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.