Skip to content

test(adapters): hermetic coverage pack for mock, go, rust, and python adapters - #416

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

test(adapters): hermetic coverage pack for mock, go, rust, and python adapters#416
debugmcpdev merged 2 commits into
mainfrom
test/adapter-coverage-pack

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Part of the coverage-expansion sprint (follows the source-map-derive rewrite). Covers the four adapter files on the deficit leaderboard, entirely through the existing hermetic harnesses — no real go/dlv/cargo/python anywhere.

mock-debug-adapter (was 65% — the worst ratio on the board)

The gap was simply the IDebugAdapter surface never being called. Added: full-shape getCapabilities() assertions (the single largest uncovered block) for both a configured and a defaults adapter; buildAdapterCommand incl. the npx .cjs bundled fallback (fs routed through a controllable override — the ESM namespace isn't spy-able); handleDapEvent stopped/continued/terminated/exited state tracking; dispose(); invalid-transition throw; error-scenario initialize; connection delay; and the trivial config surface (transform/default configs, resolvers, install metadata, feature requirements).

go-debug-adapter

Scripted-spawn coverage of the validateEnvironment arms the happy-path tests never hit: Go-too-old (1.17), version-undetermined warning, Delve-without-DAP incl. the sanitized stderr hint; resolveExecutablePath caching; checkDelveVersion banner parse + cache; buildAdapterCommand's DEBUG logging flags; one CI=true test sweeping the six diagnostic console.error lines; trivia getters.

rust-debug-adapter (toolchain suite)

The toolchain harness (full-replacement vi.mock of every utils module) already existed but never called initialize(). Added: initialize success/warnings-logged/invalid-throws-ENVIRONMENT_INVALID/ERROR-state; dispose(); RUST_NOT_FOUND + CARGO_NOT_FOUND warnings; VALIDATION_ERROR catch; win32 dlltool discovery; neither-cargo-nor-rustc throw; the MCP_CONTAINER=true relaxed prebuilt mode; darwin search paths via the existing platform ctor param; resolveAutoSuggestGnu '0'/'false'/'no'; and the cargo.example/cargo.test/default-binary branches of transformLaunchConfig.

python (adapter + utils)

  • Adapter: validateEnvironment through the real private helpers (no monkey-patching): version-unknown warning, virtualenv detection incl. the spawn-error arm, checkPythonVersion cache-miss, checkDebugpyInstalled cache reuse; CI=true initialize diagnostics; platform-stubbed getDefaultExecutableName/getExecutableSearchPaths for all three arms; attach stopOnEntry propagation; dependency/feature metadata.
  • python-utils (WhichCommandFinder internals): the real Windows fixes that had zero tests — the ComSpec/COMSPEC fallback and the PATH ← Path copy; Store-alias-only candidate lists throwing CommandNotFoundError; the interpreter-validator spawn-error arm; env-var interpreter falling through to auto-detection on CommandNotFoundError; and one test each for the DEBUG_PYTHON_DISCOVERY=true success-side and failure-side diagnostic blocks (incl. the direct-spawn probe) — those two are coverage-value-only by design, one test per block, no refactor.

Not covered on purpose: mock buildAdapterCommand's fileURLToPath-throw fallback, python-utils' dead if (!candidate) continue guard (path.join can't yield falsy).

Full npm test green, npm run lint clean. Leaderboard deltas recorded after merge.

🤖 Generated with Claude Code

cynarlab and others added 2 commits August 22, 2026 10:52
… adapters

Covers the adapter files on the coverage-deficit leaderboard through the
existing hermetic harnesses (no real go/dlv/cargo/python):

- mock: full getCapabilities surface, buildAdapterCommand incl. npx .cjs
  fallback, handleDapEvent state tracking, dispose, invalid transitions
- go: validateEnvironment error/warning arms via scripted spawn, Delve
  path + version caching, DEBUG logging flags, CI diagnostics
- rust: initialize/dispose lifecycle, toolchain warning arms,
  MCP_CONTAINER relaxed mode, darwin search paths, cargo example/test/
  default-binary launch targets
- python: real-helper validateEnvironment (venv probe incl. error arm,
  version/debugpy caches), platform-stubbed search paths, and the
  WhichCommandFinder internals — ComSpec fallback, PATH<-Path copy,
  Store-alias-only rejection, validator error arm, env-var fall-through,
  DEBUG_PYTHON_DISCOVERY diagnostic blocks

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…der suite

The appended block had lost a backslash-escaping level (heredoc), which JS
then silently dropped at runtime; and CI's setup-python exports
pythonLocation/PYTHON_PATH, short-circuiting discovery before the finder
runs — both made the new tests pass locally and fail on Linux CI. Paths
now use proper escapes (and the allowlisted C:\Users\test), and the
suite neutralizes the discovery env vars in beforeEach.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@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!

@debugmcpdev
debugmcpdev merged commit 1588529 into main Aug 22, 2026
9 checks passed
@debugmcpdev
debugmcpdev deleted the test/adapter-coverage-pack branch August 22, 2026 15:05
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