0022: A UI-free DAP client crate with suspend generations
- Status: Proposed (implemented in Phase 2, task 015)
- Date: 2026-12-05
Context
Rust, C# and Python need a debugger. All three have maintained adapters that speak the Debug Adapter Protocol over stdio: lldb-dap, netcoredbg and debugpy. The protocol is asynchronous: adapters send events before the responses they relate to, answer launch at different points in the sequence, and may send requests of their own (runInTerminal, startDebugging) that would run commands. Values shown while paused are only valid until the program resumes, and some (lazy values, watch expressions) run program code when read.
Decision
- A new crate,
ide-debug, UI-free and language-free. It depends onide-process(supervision, shared bounded framing) andserde_jsononly.ide-coreowns at most one session and the breakpoints; the desktop renders and sends intents. Language providers supply the adapter argv,adapterIDand launch arguments inLaunchPlan. - Messages validated as data.
seq,typeand the fields of each type are checked; anything malformed ends the session. - A state machine following the specification's sequencing, tolerant of order:
initialize, thenlaunch; on theinitializedevent, breakpoints, default exception filters andconfigurationDone; running once bothlaunchandconfigurationDoneare answered. - Suspend generations. Every stop and resume changes the generation; inspection answers for an older generation are dropped, and the view is cleared on resume.
- Reverse requests refused. None are advertised; any that arrive get an error answer and are shown in the console.
- Nothing runs program code implicitly. No variables are fetched before the user opens a scope; watches are evaluated only on request; lazy values are marked. Snapshots for other consumers contain only fetched values, each with provenance and a safe-inspection flag.
- Source-match evidence. The core hashes the project's source files at launch (in the background, bounded) and keeps a built program's modification time, so a stop in changed code is reported.
- Bounded everything, timeouts per request, and a tree kill after
terminate/disconnectand a grace period.
Alternatives considered
- Extending
ide-languages. DAP is not language intelligence, and the crate is large already; a separate crate keeps the dependency direction clean. - An existing Rust DAP crate (
dap,dap-types). They provide types or a server side, not a bounded client with these sequencing and staleness rules; typed structs for every message would also be more code than validated JSON for the subset used. - Supporting
runInTerminalthrough the terminal service. Possible later behind trust; not needed by the three adapters with an internal console.
Consequences
- New crate
ide-debug; no new third-party dependency. - One session at a time; attach, conditional breakpoints and exception filter choice are not implemented.
- netcoredbg is installed and verified in CI only.