refactor(#265): consolidate CodeLLDB platform-dir/candidate-path logic - #272
Merged
Merged
Conversation
The platform/arch -> vendor-dir mapping and the vendored candidate-path walk existed in four runtime copies (async resolver, version reader with an "intentionally duplicated" note, the adapter's private sync copy, and the vendor script) plus a fifth in scripts/check-adapters.js. The copies had already drifted once (version fallback) and the sync copy carried a live latent bug: its monorepo candidate resolved one level above the repo root, and it lacked the package-root candidate entirely. - Extract getCodeLLDBPlatformDir / getCodeLLDBExecutableName / buildVendorCandidatePaths / resolveCodeLLDBExecutableSyncImpl in codelldb-resolver.ts, parameterized on package root (callers compile at different depths) and platform/arch (preserves the issue #186 constructor-injection test seam; defaults read at call time). - resolveCodeLLDBExecutable / getCodeLLDBVersion keep their exact 4-candidate order; the sync path now shares it (gaining the pkg-root candidate and a corrected monorepo hop). - resolveCodeLLDBExecutableSync stays as a thin private delegator so existing vi.spyOn test seams keep working. - Vendor script and check-adapters.js keep their plain-JS tables (not importable from shipped TS), now guarded by PLATFORMS-keys drift tests alongside the existing version drift guard. - New unit coverage for the previously untested sync walk. Fixes #265 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 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.
Summary
Fixes #265.
The CodeLLDB platform/arch → vendor-dir mapping and candidate-path walk existed in five copies (the issue listed three; exploration found two more:
getCodeLLDBVersion's own copy carrying an "intentionally duplicated" comment, and rootscripts/check-adapters.js). They had already drifted once (version fallback), and the sync copy carried a live latent bug.Changes
codelldb-resolver.ts(kept in adapter-rust — no other package needs them):getCodeLLDBPlatformDir,getCodeLLDBExecutableName,buildVendorCandidatePaths,resolveCodeLLDBExecutableSyncImpl,SUPPORTED_CODELLDB_PLATFORM_DIRS.dist/vsdist/utils/), the exact subtlety called out in the issue.process.platform/process.archread at call time, preserving both existing test seams (the adapter's constructor platform override from Migrate adapter-package tests off process.platform/version mutation (follow-up to #183) #186, and the resolver tests'vi.stubGlobal('process', …)).resolveCodeLLDBExecutableSyncremains as a thin private delegator so the fivevi.spyOnseams in existing tests keep working.Testing
packages/adapter-rust: 123/123 (35 in the resolver suite, 19 new)mcp-server-smoke-rust.test.ts: 2/2 against the real vendored CodeLLDB (Windows/GNU)🤖 Generated with Claude Code