Skip to content

refactor(#265): consolidate CodeLLDB platform-dir/candidate-path logic - #272

Merged
debugmcpdev merged 1 commit into
mainfrom
fix/265-codelldb-resolver-consolidation
Aug 6, 2026
Merged

refactor(#265): consolidate CodeLLDB platform-dir/candidate-path logic#272
debugmcpdev merged 1 commit into
mainfrom
fix/265-codelldb-resolver-consolidation

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

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 root scripts/check-adapters.js). They had already drifted once (version fallback), and the sync copy carried a live latent bug.

Changes

  • New shared helpers in codelldb-resolver.ts (kept in adapter-rust — no other package needs them): getCodeLLDBPlatformDir, getCodeLLDBExecutableName, buildVendorCandidatePaths, resolveCodeLLDBExecutableSyncImpl, SUPPORTED_CODELLDB_PLATFORM_DIRS.
    • Parameterized on package root — the two consuming source files compile at different depths (dist/ vs dist/utils/), the exact subtlety called out in the issue.
    • Platform/arch parameters default to process.platform/process.arch read 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', …)).
  • Async resolver + version reader: identical 4-candidate behavior (existing candidate-count/order assertions pass unchanged); the "intentionally duplicated" comment is gone along with the duplication it defended.
  • Sync path bug fix: the old private copy's monorepo candidate resolved one level above the repo root (only valid for a long-gone layout) and it lacked the package-root candidate. It now shares the unified list. resolveCodeLLDBExecutableSync remains as a thin private delegator so the five vi.spyOn seams in existing tests keep working.
  • Vendor script + check-adapters.js: stay as plain-JS tables (not importable from shipped TS; script isn't shipped at all) but are now drift-guarded by PLATFORMS-keys tests next to the existing version drift guard.
  • New unit tests: platform-dir matrix, candidate order/rooting, and the full sync walk (previously zero-covered), hermetic via an injected existence probe.

Testing

  • packages/adapter-rust: 123/123 (35 in the resolver suite, 19 new)
  • Full pre-push suite: 2815 passed
  • Live e2e mcp-server-smoke-rust.test.ts: 2/2 against the real vendored CodeLLDB (Windows/GNU)

🤖 Generated with Claude Code

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

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ckages/adapter-rust/src/utils/codelldb-resolver.ts 97.56% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@debugmcpdev
debugmcpdev merged commit ef686a9 into main Aug 6, 2026
10 checks passed
@debugmcpdev
debugmcpdev deleted the fix/265-codelldb-resolver-consolidation branch August 6, 2026 03:39
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.

adapter-rust: consolidate triplicated CodeLLDB platform-dir/candidate-path logic

2 participants