[Feature] 统一 hosted 调试初始化超时测试到确定性触发通道并清理 debugInitializeWindow

Open
#2,368 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
go
Domain
testing

Research direction

Start with watchDebugInitialize in desktop/internal/workbench/debug_start.go and find where App.debugInitializeTrigger is read and closed in app.go. Move TestDebugTCPAdapterThatNeverInitializesTimesOut in debug_tcp_test.go and TestDebugHostedAdapterThatNeverAnswersIsRecordedAsATimeout in debug_adapter_start_test.go onto that trigger, then grep the repo for other debugInitializeWindow uses. Done when both tests pass without the 300ms timer and the field is removed if nothing else reads it.

Written by the indexing model from the issue text.

Description

refactor review: high
Problem to solve / 要解决的问题

desktop/internal/workbench 中仍有两项既有的 hosted 调试初始化超时测试依赖固定实时定时器 h.app.debugInitializeWindow = 300 * time.Millisecond:

  • desktop/internal/workbench/debug_tcp_test.go:TestDebugTCPAdapterThatNeverInitializesTimesOut
  • desktop/internal/workbench/debug_adapter_start_test.go:TestDebugHostedAdapterThatNeverAnswersIsRecordedAsATimeout

两处通过 300ms 真实计时器触发 watchDebugInitialize(desktop/internal/workbench/debug_start.go),在慢速 CI 机器或竞态检测下每次测试至少等待 300ms,并且存在 beginDebug / serveHostedAdapter 建连与 300ms 定时器竞争的风险,同时使得 App.debugInitializeWindow(desktop/internal/workbench/app.go)继续作为第二套测试超时控制机制与 App.debugInitializeTrigger 并存。

Proposed solution / 建议方案

将 TestDebugTCPAdapterThatNeverInitializesTimesOut 和 TestDebugHostedAdapterThatNeverAnswersIsRecordedAsATimeout 统一迁移到确定性触发通道 App.debugInitializeTrigger(在确认 serveHostedAdapter 收到连接且会话进入初始化后关闭触发通道),并随后检查全仓库是否仍有其他 debugInitializeWindow 调用方;若无剩余调用方,一并清理 App.debugInitializeWindow 字段及其读取分支。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

Debug / 调试

Priority / 优先级

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

Alternatives considered / 已考虑的替代方案

继续保持两项 hosted 超时测试使用 debugInitializeWindow = 300 * time.Millisecond,仅在发生慢机超时误报时临时放大窗口;但这不符合 write-stable-tests 的确定性同步原则,也会保留两套测试超时控制字段。

Additional context / 补充信息
  • 相关代码位置:
    • desktop/internal/workbench/app.go:App.debugInitializeWindow、App.debugInitializeTrigger
    • desktop/internal/workbench/debug_start.go:watchDebugInitialize
    • desktop/internal/workbench/debug_tcp_test.go:TestDebugTCPAdapterThatNeverInitializesTimesOut
    • desktop/internal/workbench/debug_adapter_start_test.go:TestDebugHostedAdapterThatNeverAnswersIsRecordedAsATimeout
  • 来源:#1962 / PR #2341 审查时按 develop-lithe 第九节记录既有的独立可重构项,未在同一 PR 中顺手修改无关测试。
Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
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.