test(adapters): hermetic coverage pack for mock, go, rust, and python adapters - #416
Merged
Conversation
… 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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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;buildAdapterCommandincl. the npx.cjsbundled fallback (fs routed through a controllable override — the ESM namespace isn't spy-able);handleDapEventstopped/continued/terminated/exited state tracking;dispose(); invalid-transition throw; error-scenarioinitialize; connection delay; and the trivial config surface (transform/default configs, resolvers, install metadata, feature requirements).go-debug-adapter
Scripted-spawn coverage of the
validateEnvironmentarms the happy-path tests never hit: Go-too-old (1.17), version-undetermined warning, Delve-without-DAP incl. the sanitized stderr hint;resolveExecutablePathcaching;checkDelveVersionbanner parse + cache;buildAdapterCommand'sDEBUGlogging flags; oneCI=truetest sweeping the six diagnosticconsole.errorlines; trivia getters.rust-debug-adapter (toolchain suite)
The toolchain harness (full-replacement
vi.mockof every utils module) already existed but never calledinitialize(). 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; theMCP_CONTAINER=truerelaxed prebuilt mode; darwin search paths via the existingplatformctor param;resolveAutoSuggestGnu'0'/'false'/'no'; and thecargo.example/cargo.test/default-binary branches oftransformLaunchConfig.python (adapter + utils)
validateEnvironmentthrough the real private helpers (no monkey-patching): version-unknown warning, virtualenv detection incl. the spawn-error arm,checkPythonVersioncache-miss,checkDebugpyInstalledcache reuse;CI=trueinitialize diagnostics; platform-stubbedgetDefaultExecutableName/getExecutableSearchPathsfor all three arms; attachstopOnEntrypropagation; dependency/feature metadata.WhichCommandFinderinternals): the real Windows fixes that had zero tests — the ComSpec/COMSPEC fallback and thePATH ← Pathcopy; Store-alias-only candidate lists throwingCommandNotFoundError; the interpreter-validator spawn-error arm; env-var interpreter falling through to auto-detection onCommandNotFoundError; and one test each for theDEBUG_PYTHON_DISCOVERY=truesuccess-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'sfileURLToPath-throw fallback, python-utils' deadif (!candidate) continueguard (path.joincan't yield falsy).Full
npm testgreen,npm run lintclean. Leaderboard deltas recorded after merge.🤖 Generated with Claude Code