Skip to content

test: DAP/JSON channel marker-leak golden cell (Refs #3018) - #3073

Merged
caomengxuan666 merged 3 commits into
masterfrom
test/3018-dap-marker-golden
Nov 8, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
test/3018-dap-marker-golden

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Refs #3018

What this is

Test-only: the E6 per-channel golden enumeration in tests/marker_leak_golden.rs had exactly one §2.1 channel with no cell — the debugger/JSON (DAP) face, recorded as an explicit gap in the file's header comment (sweep Q2). This PR closes that gap with a real cell and removes the gap note; every §2.1 channel now carries a cell.

The harness

A lock-step DAP client inside the golden file drives the shipped binary the way an editor would: it spawns rubash --dap with a sanitized environment (mirroring the file's run_clean_env), speaks Content-Length framed JSON over the child's stdio, and runs a full session — initialize → launch → initialized → setBreakpoints → configurationDone → stopped (breakpoint) → stackTrace → scopes → variables (Globals + array children) → evaluate → continue → exited/terminated → disconnect. The client shape follows the in-process fixtures of src/debugger/dap_tests.rs; it carries a minimal JSON value type because the debugger module is crate-private. A stalled conversation panics with the transcript instead of hanging (120 s per-read timeout), and the cell asserts the debuggee actually ran (its stdout arrives as an output event, exit code 0, server exits 0).

The finding: the DAP channel leaks storage encoding (cell pinned inverted)

The fixture program binds marker-carrying values — a typed U+E314 char, a raw ESC byte, raw C0 bytes, and an array holding both — and the cell reads them back through the variables and evaluate faces. On the current tree both faces render internal storage encoding instead of the decoded values every other channel produces:

face variable actual (storage form) correct (decoded)
variables pua U+E400 U+E314 U+E314
variables esc A U+E000 U+E01C B A ESC B
variables c0 a U+E000 U+E012 b U+E000 U+E020 c a 0x11 b 0x1F c
variables (children) arr[0] U+E400 U+E314 U+E314
variables (children) arr[1] x U+E000 U+E012 y x 0x11 y
evaluate $pua / $esc / $c0 same storage forms same decoded forms

Localization (read-only; no product code touched): the snapshot face captures storage forms — Executor::capture_variable in src/executor/state_views.rs builds scalar values from the raw env mirror / typed store — and the DAP value renderers print them verbatim; no decode step (the sanctioned decoder family used by the output channels) runs on this face. The one rendering the channel already gets right is pinned as the control: the parenthesized array summary renders decoded, exactly like declare -p (([0]="<U+E314>" [1]=$'x\021y')).

Following this file's registry-test precedent (the #3038 / #3040 legs in the same file), the value assertions are pinned inverted: they assert the current broken renderings and will flip red the moment a fix decodes the face. The transcript leg is likewise inverted for the carrier codepoints (U+E400 / U+E000 present today); the named-marker transcript leg (__RUBASH_*) is a straight assertion and passes. Fail-first evidence: the cell with correct assertions fails on this tree — left: "\u{e400}\u{e314}" vs right: "\u{e314}" at the first value assertion (full repro, codepoint tables and localization in the lane REPORT, ~/workspace/fix-3018/REPORT.md). The leak itself is not fixed here — this lane is test-only by assignment; the follow-up fix needs its own issue.

Verification (lane-run; UNVERIFIED-BY-CAPTAIN)

本 PR 删除了什么

Nothing is deleted from the product or the suite. The only removal is the header comment's known-gap paragraph in tests/marker_leak_golden.rs (the debugger/JSON channel is no longer a gap — that is the point of the change). Pure test PR: +793 / −5 in one test file, src/ untouched.

UNVERIFIED-BY-CAPTAIN

Drives a real --dap session over the binary's stdio (lock-step client in-file) and reads marker-carrying values back through variables + evaluate. The channel renders storage encoding today, so the value legs are pinned inverted per this file's registry precedent; the finding, repro and localization are in the lane REPORT. Header gap note removed: every section 2.1 channel now carries a cell. Test-only; src/ untouched.
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