Repository navigation
feat: DAP groundwork — nudgec debug steps through traces - #30
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb42524a3a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let records = trace_src | ||
| .lines() | ||
| .filter(|l| !l.trim().is_empty()) | ||
| .filter_map(|l| parse_json(l).ok()) |
There was a problem hiding this comment.
Reject malformed traces before starting replay
When a trace contains an invalid JSON line, filter_map silently omits that record and starts a seemingly valid debugging session over an incomplete timeline. This can cause stepping to skip the corrupted event and breakpoints to behave misleadingly; the existing tracecheck::validate path already detects these errors and the trace viewer refuses to start on them, so the debugger should likewise report the invalid trace rather than alter it.
Useful? React with 👍 / 👎.
| .iter() | ||
| .map(|l| { | ||
| obj(vec![ | ||
| ("verified", Json::Bool(true)), |
There was a problem hiding this comment.
Mark nonexistent sequence breakpoints unverified
When the client requests a line that does not correspond to any record seq (including a typo or an out-of-range line), this always reports the breakpoint as verified even though neither entry_stop nor continue can ever hit it. The client therefore displays an active breakpoint and replay runs past it to termination; verification should depend on finding a matching record, with unsupported lines returned as unverified.
Useful? React with 👍 / 👎.
| return self.stopped("breakpoint"); | ||
| } | ||
| self.pos = 0; | ||
| self.stopped("entry") |
There was a problem hiding this comment.
Terminate immediately when the trace has no records
When the input is an empty trace—which tracecheck::validate currently accepts—configuration emits a stopped event even though there is no current record. The client then sees a paused thread and a fabricated stack frame at line 0 until the user manually steps or continues; this session has already finished and should emit terminated instead of reporting an entry stop.
Useful? React with 👍 / 👎.
| "name", | ||
| Json::str(format!("{} seq {}", kind_of(rec), num(rec, "seq"))), | ||
| ), | ||
| ("line", Json::Num(num(rec, "seq"))), |
There was a problem hiding this comment.
Include the trace source in stack frames
When this adapter is used from a graphical DAP client, each stack frame supplies a line but no source path or source reference, so the client cannot associate the stopped frame with the trace JSONL file and stepping or selecting the frame cannot highlight the current record. The CLI has the trace path in main, but it is discarded before constructing Dap; retain it and include a DAP Source in the frame.
Useful? React with 👍 / 👎.
What
Roadmap v1.2 DAP groundwork spike:
nudgec debug <trace.jsonl>speaks the Debug Adapter Protocol over stdio (Content-Length framing, same pattern as the LSP module). The program under debug is a recorded run — time-travel over the trace at zero token cost (design §6).Supported surface:
initialize/launch/attach/configurationDone/disconnectlifecyclesetBreakpointson trace record seq numbers; the entry stop honours pre-set breakpointsnext(step record-by-record),continue(to the next breakpoint or end of trace)threads/stackTrace/scopes/variables— the current record's fields as inspectable variablessuccess: false+ message)Live-run attach lands with the spanned AST; the protocol surface won't change.
Tests
3 unit tests: full step-to-end session, breakpoint continue + entry-stop honouring, unknown-command failure — all on the pure
dispatchfunction, no stdio in tests.