Skip to content

WIP: feat(debugger): DAP frontend — protocol adapter over the session core (1.5.0 row 10) - #1892

Merged
caomengxuan666 merged 5 commits into
masterfrom
feat150/dap-frontend
Oct 27, 2026
Merged

caomengxuan666 merged 5 commits into
masterfrom
feat150/dap-frontend

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

WIP: 1.5.0 PLAN row 10 — DAP session (M2 depth). Do not merge; gates in progress.

Deliverables (PLAN row 10 + finalized design section 13):

  • DAP adapter: Content-Length framed JSON-RPC over stdio, hand-rolled JSON subset (no serde per PLAN §3); request set per the finalized list, capabilities claimed only where the underlying feature has landed.
  • Event mapping: session DE events → DAP stopped/output/breakpoint/terminated, breakpoint verified incl. row-7 Pending/Verified + DE-11 reported truthfully.
  • Watch wiring (row-8 residual): §5.4 stop-and-diff — diff_watch wired into the debugger_serve_stop pre-pass; watch hits produce a stop + diff presentation (DAP variables face + design event shape).
  • Protocol tests: scripted DAP client fixture, full session script (launch → breakpoint → hit → stack/scopes/variables → evaluate incl. rejected forms erroring over DAP → write-back → step → continue → terminate); §8 DAP scenarios pinned item by item.
  • KPI re-measure (row-9 residual): same caliber (4500 lines, release) step-echo cost through the real adapter, archived in the cluster REPORT; measure only.

Gates: pristine-baseline lib failure set equality (sole stock failure ownership_unary_operators_check_existing_file, measured on 015b4f9); -D warnings check clean; diffcorpus 306 ⊆ {ms10}; per-file rustfmt; CR=0; CI all jobs green (goldens are fully green on master since 40578706634 — no new red accepted).

… watch pre-pass (1.5.0 row 10)

The --dap protocol adapter over the landed session core (design
section 13): Content-Length framed JSON on stdio with a
hand-rolled JSON subset (no serde, PLAN section 3), a reader
thread whose only session access is the async stop flag, the
section 13 request set with capabilities claimed only where
the machinery exists, debuggee stdio captured into output
events, and the section 5.4 stop-and-diff watch wired into
debugger_serve_stop's pre-pass (row 8 residual). Tests follow
in the next commit.
… (1.5.0 row 10)

Scripted in-memory DAP conversations pin the section 8 golden
set item by item (handshake/capabilities, lifecycle, breakpoint
verdicts incl. the sourced-file Pending -> Verified DE-11 flip,
stepping with the stack cross-checked against FUNCNAME /
BASH_LINENO, scopes/variables with array children, evaluate
safe + rejected forms, output categories), plus the brief's
full session script (watch registration and stop-and-diff over
the protocol, setVariable write-back with the readonly refusal,
terminate, pause during a free run) and capability backing
fixtures (conditions, function breakpoints, attach refusal,
noDebug). Wiring pins cover the stop-and-diff pre-pass:
baseline, announce-at-a-breakpoint-stop, array element writes
through the snapshot rendering, disabled and rejected entries,
and the watch-only inert limit. KPI: the 4500-line step echo
through the real adapter, ignored harness, numbers in the
cluster REPORT.

Fixes folded in from fixture evidence: the watch pre-pass now
renders name watches from the stop's inspection snapshot (a
plain $NAME reading shows only element 0 and hides element
writes); watch-context evaluate normalizes a bare name to its
$-form; resume-class responses are preceded by the running
flag so an immediate pause cannot race the reader thread.
…se cost

Three fixture defects, all in the tests, none in the adapter:
- temp-path assertions compared the raw temp spelling against
  the server's canonical identity (macOS /var is a symlink to
  /private/var): stack source paths and the write-back
  diagnostic now compare canonical-to-canonical, and the
  sourced-file fixture sources the lib by its canonical
  spelling while the client still sends the raw one.
- the pause fixture's 400k-iteration loop costs ~100 s in a
  debug build and timed out on CI: 6000 iterations is seconds
  locally while leaving the reader thread ample scheduling
  window.
The sourced-file fixture still stalls on macOS and Windows CI
while passing locally (including under a local symlink-split
reproduction of the canonicalization gap), so the next CI run
needs evidence, not another guess: a stall now panics with the
full conversation transcript, and the fixture checkpoints its
awaits on stderr (nextest surfaces captured output on failure).
…al spelling

CI evidence (run 40594412133, macOS transcript): the breakpoint
entry was stored under the canonical identity while the fixture's
program sourced the lib under the raw temp spelling (/var/folders
vs /private/var, RUNNER~1 vs its long form), so the row-7 identity
contract — a file's identity is the spelling the engine reports —
never let the two meet: no DE-11 flip, no hit, script ran clean.
Linux temp paths are already canonical, which hid it locally.

The fixture now sources the lib by its canonical spelling (the
client still sends the raw path; the adapter canonicalizes), and
documents the contract plus the divergent-spelling residual:
canonical keying inside the session core, shared by both
frontends, is the mechanism-level home (row 11/12).

Also keeps the client stall instrumentation (transcript in the
panic message) that produced this evidence.
@caomengxuan666

Copy link
Copy Markdown
Member Author

Row-10 final state: head c6e8d266 — CI run 40596169590 all jobs success (Linux/macOS Rust tests, Windows GNU goldens + canaries, shell functionality, both cross-target checks); niu-canary 40596169480 success.

CI history (all reds were this row's new tests, none inherited; goldens never diverged):

  • 1cc4c912: cross-platform path-spelling failures (canonical vs raw temp spellings on macOS /private/var and Windows RUNNER~1) + an oversized pause fixture loop. Fixed in d3c72b31 (canonical-to-canonical fixture assertions, pause loop 400000 → 6000).
  • d3c72b31: one stall remained — the sourced-file fixture on macOS/Windows. Diagnosed from an instrumented transcript (6e353527, CI 40594412133): the engine registers a sourced file's syntax view under the spelling the script's . actually used (BASH_SOURCE stack top), while the fixture's program text used the RAW temp path and the adapter stored the breakpoint under the canonical form — on Linux raw == canonical, so it only failed where the temp path is symlinked/short-named. Fixed in c6e8d266 by sourcing under the canonical spelling in the fixture (client still sends the raw path; the adapter bridges), with the identity contract and the divergent-spelling residual documented in the fixture and REPORT §7/§8 (canonical keying inside the session core is the mechanism-level home, row 11/12 — no adapter-side heuristics).

Local gates on the final tree: lib 868 passed / 1 failed / 3 ignored, failure set identical by name to the pristine-master baseline (sole failure ownership_unary_operators_check_existing_file); -D warnings check clean; diffcorpus 306 = 305 pass + ps06 adjudicated timing flake. Full account: cluster REPORT.md (protocol table, DE→DAP event map, watch wiring, §8 pins, KPI 1.83–1.93 ms/stop vs row-9 bare-loop 1.77–1.90). Draft stays unmerged for captain review.

@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 27, 2026 22:53
@caomengxuan666
caomengxuan666 merged commit 231ffe1 into master Oct 27, 2026
9 checks passed
@caomengxuan666
caomengxuan666 deleted the feat150/dap-frontend branch October 30, 2026 01:41
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