Skip to content

test(core): detach handler, evaluate default-frame, adoption edges + threshold ratchet - #417

Merged
debugmcpdev merged 2 commits into
mainfrom
test/core-coverage-pack
Aug 22, 2026
Merged

test(core): detach handler, evaluate default-frame, adoption edges + threshold ratchet#417
debugmcpdev merged 2 commits into
mainfrom
test/core-coverage-pack

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Closes out the coverage-expansion sprint (after the source-map-derive rewrite and the adapter pack). Three cohesive core gaps plus the threshold ratchet.

server.ts: the detach_from_process handler had zero tests

The entire handler body (~40 lines, the largest single uncovered block in server.ts) was untested. Added dispatch tests: success payload shape, success:false propagation, terminateProcess defaulting, the session-state McpError catch mapping to {success:false, state:'stopped'}, rethrow of unrelated errors, and the missing-sessionId guard.

session-manager: evaluateExpression default-frame resolution

The dense uncovered cluster was the frameId-omitted path. New suite pins: the not-paused guard, missing current-thread failure, top-frame anchoring via a stackTrace request (asserting the evaluate call carries the derived frameId), empty-stack failure, and stack-trace-rejection wrapping.

child-session-manager: adoption edges

  • The child-safe policy (previously 0%): children receive a policy with reverse-start disabled and, crucially, a handleReverseRequest wrapper that acknowledges-and-stops grandchild startDebugging requests while passing unhandled requests through — asserted via the policy the mocked child captures.
  • Adoption catch arms: failing setExceptionBreakpoints/setBreakpoints/configurationDone don't abort adoption.
  • handlePostAttachInit: a post-attach initialized replays stored breakpoints (new mock knob, mirroring emitStoppedAfterAttach).
  • The js-debug threadId === 0 double-pause quirk; threads-failure tolerance; death-latch re-entrancy (error followed by close); shutdown surviving a child whose own shutdown() throws.

Threshold ratchet

vitest.config.ts coverage thresholds move from statements: 80 (10+ points of dead slack — nothing was regression-guarded) to statements: 90, branches: 80, against measured post-sprint levels of 92.9 / 83.0 (margins absorb platform-specific branches).

Sprint result (full coverage run on this branch)

before sprint after
overall lines 90.6% 93.3%
statements 90.0% 92.9%
branches 80.4% 83.0%
functions 88.3% 91.0%

Every sprint target is off the deficit leaderboard: source-map-derive (was #1 at 8%) now 98.5%; the mock adapter (65%) and the go/rust/python adapters and child-session-manager no longer chart. The remaining top entries are the deliberately out-of-scope scatter (server.ts 91%, session-manager-operations 93%, dap-proxy-worker 91%).

Full npm test green, npm run lint clean.

🤖 Generated with Claude Code

cynarlab and others added 2 commits August 22, 2026 11:18
…on, and child-session adoption edges

- server: detach_from_process dispatch was entirely untested — success
  payload, failure propagation, session-state McpError mapping to a
  stopped payload, rethrow of unrelated errors, missing sessionId
- session-manager: evaluateExpression's default-frame resolution — the
  not-paused guard, missing thread id, top-frame anchoring via
  stackTrace, empty stacks, and stack-trace failures
- child-session-manager: the child-safe policy (grandchild reverse-start
  suppression and passthrough), adoption catch arms for failing
  configuration requests, post-attach initialized replay (new mock
  knob), the js-debug threadId-0 double-pause quirk, threads-failure
  tolerance, death-latch re-entry, and shutdown surviving a throwing
  child

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Measured after the sprint: statements 92.9, branches 83.0 (was 90.0/80.4
against a lone statements:80 threshold — 10 points of dead slack that
guarded nothing). Margins absorb platform-specific branches.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@debugmcpdev
debugmcpdev merged commit 107d0e2 into main Aug 22, 2026
8 checks passed
@debugmcpdev
debugmcpdev deleted the test/core-coverage-pack branch August 22, 2026 15:40
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants