Skip to content

feat: DAP groundwork — nudgec debug steps through traces - #30

Merged
NekomyaDev merged 4 commits into
mainfrom
feature/dap-groundwork
Jul 29, 2026
Merged

NekomyaDev merged 4 commits into
mainfrom
feature/dap-groundwork

Conversation

@NekomyaDev

Copy link
Copy Markdown
Owner

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 / disconnect lifecycle
  • setBreakpoints on trace record seq numbers; the entry stop honours pre-set breakpoints
  • next (step record-by-record), continue (to the next breakpoint or end of trace)
  • threads / stackTrace / scopes / variables — the current record's fields as inspectable variables
  • Unknown commands fail cleanly (success: 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 dispatch function, no stdio in tests.

@NekomyaDev
NekomyaDev merged commit 97520c3 into main Jul 29, 2026
2 checks passed
@NekomyaDev
NekomyaDev deleted the feature/dap-groundwork branch July 29, 2026 18:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/nudgec/src/dap.rs
let records = trace_src
.lines()
.filter(|l| !l.trim().is_empty())
.filter_map(|l| parse_json(l).ok())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread crates/nudgec/src/dap.rs
.iter()
.map(|l| {
obj(vec![
("verified", Json::Bool(true)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread crates/nudgec/src/dap.rs
return self.stopped("breakpoint");
}
self.pos = 0;
self.stopped("entry")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread crates/nudgec/src/dap.rs
"name",
Json::str(format!("{} seq {}", kind_of(rec), num(rec, "seq"))),
),
("line", Json::Num(num(rec, "seq"))),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant