Repository navigation
feat(debug): #1210 实现普通 TCP 调试连接与有界生命周期 - #1538
Merged
Merged
Conversation
Unify hosted and external DAP byte streams behind a replaceable connection provider; reserve the seam for future network routes without adding proxy or tunnel behavior. Add explicit endpoint validation, per-connection remote consent, a one-shot launch/attach entry, bounded startup/write buffering, generation-fenced callbacks, and bounded disconnect draining. Keep the debuggee target separate and external resources user-owned. Cover routing, cancellation, queue limits, cleanup and real loopback Core DAP initialize/attach/disconnect. Update shared fixtures, localization, architecture notes and the platform capability matrix. Windows host and real debugger acceptance remain out of scope.
xiaoyumuxi
marked this pull request as ready for review
October 27, 2026 13:42
Lithe Review结论: 未发现需要阻塞合并的问题。本次静态审查未发现达到证据门槛的新增代码缺陷;界面改动仍需补充截图。 Scope Check
Suggestions
Summary传输层、平台组合根与 DAP 协议层的职责划分清晰。静态调用链支持显式端点不回退本地进程、attach 断开不终止目标,以及停止后拒绝旧连接回调的设计。新增测试覆盖主要传输边界,但这些证据尚不能替代真实适配器兼容性与完整 UI 工作流验收。 Verification
|
- 被拒绝或不可达的端口立即以系统原因失败,不再停在 .waiting 等满超时 - 端点发现与建连各自独立计时:发现 120 秒(语言服务器冷启动),建连 10 秒 - 外部适配器会话初始化期限改为 10 秒建连加 10 秒握手,不再抢在建连之前结束 - 连接对话框在连接启动前保持打开,失败原因留在对话框内并保留已填内容 - connectExternalDebugAdapter 返回失败原因,不再静默丢弃请求 - 当前文件没有调试提供方时,"连接调试适配器…"菜单项不可用;主机名先去除首尾空白 - 删除宿主端口传输中无人使用的错误分支 - 补充发现/建连两段期限与真实回环拒绝连接的测试,同步 Agent Note 与功能矩阵
连接状态转换、取消规则、代次令牌与过期结果拒绝、只结束一次、 建连/写入/排空期限、待发字节与消息预算、单个在途写入,原先都写在 macOS 的 MacTCPDebugAdapterTransport 里,Windows 接入要重写并重新 证明同一套规则。现在这些规则由 Core 的独立状态机持有,平台只做 I/O。 Core(rust/lithe-core/src/debug/transport_lifecycle.rs) - 与 DAP 协议状态机独立,按 transportId 登记。 - 新增命令 debug.transport.policy / handle / release:平台发送事件, Core 返回新代次、阶段、结果和有序效果(发现端点、设置或取消计时器、 连接、写入、投递数据、关闭、报告失败、通知终止)。 - Core 没有时钟,只决定期限长短和到期后的转换;待发数据只以字节数 越过 JSON 边界,真实字节、socket 与计时器句柄留在平台。 - 共享 fixture shared/fixtures/debug/transport-lifecycle-v1.json 覆盖 约 28 个场景,Rust 逐步回放;已登记到 v1-baseline。 macOS - 新增 RustDebugTransportCore.swift 类型化桥接。 - MacTCPDebugAdapterTransport 只拥有 NWConnection、端点发现任务、待发帧 字节和系统计时器,并执行 Core 返回的效果;core 参数贯穿托管端口、 插件和外部端点三条传输,会话初始化期限改读 Core 策略。 - 计时器触发后也释放句柄,避免排空计时器继续持有传输。 - Core 调用本身失败时本地静默拆除并向所有者报告一次。 已接受的行为差异:观察者在错误输出回调里调用 stop() 时,终止通知 现在仍会送达(旧实现把它当作生命周期被替换而吞掉);重启仍会使旧 通知作废。 文档:更新 Agent Note、功能矩阵与 rust-core-api 契约。
合并 preview 并解决共享 i18n 冲突,保留 TCP 连接与反汇编的双方词条并重新生成语言资源。 桥接故障后立即清理 socket、计时器与缓冲,重启使用新登记 ID,隔离旧回调和终止通知。外部连接表单等待 DAP 初始化,失败保留输入,取消仅停止本次会话。 补齐回归测试、契约说明、Agent Note 与功能矩阵。验证:Swift 332/332、Rust 1313/1313、i18n 35/35,以及边界、矩阵和 bundle 只读检查。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景与范围
Refs #1210,接续 #1520、#1525。本 PR 包含实际 TCP 实现,不是仅设计文档。
本轮只交付普通 TCP 直连与生命周期;代理、SSH、隧道、端口转发另做方案,不在本 PR 实现。
功能改动
MacTCPDebugAdapterTransport,复用 Apple Network;已有语言服务器托管端口与显式外部 DAP 服务共用字节流生命周期。DebugAdapterConnectionProviding可替换连接接口,目前唯一实现为直连,不增加代理配置、认证或辅助进程。adapterEndpoint独立于 DAP 参数,明确区分 IDE → DAP 适配器与适配器 → debuggee。显式端点不回退到本地进程,不误用 JVM JDWP / gdbserver 地址。debug.validateAdapterEndpoint和 28 项共享端点 fixture;校验主机、端口及回环分类。非回环连接逐次确认,默认取消,明确提示裸 TCP 不加密、不认证;确认在网络期限开始前完成。terminateDebuggee=false。外部会话不默认宣称支持未知子会话端点。验证
明确未包含 / 待验收
按仓库规则先提交 Draft,避免提前占用 macOS/Windows runner。