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

Đang mở
#2,368 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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,确认没有重复建议。
Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
151
Merge trung bình
3 giờ 48 phút
Pull request đã merge (30 ngày)
571

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của 1lck/Lithe-IDEA

Tất cả issue của 1lck/Lithe-IDEA

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.