fix(ruby): apply launchConfig.cwd to the debuggee spawn options (#320) - #322
Merged
Merged
Conversation
Sibling of the #318 env fix: rdbg -c starts the debuggee at adapter-spawn time, so cwd in the DAP launch request is a dead letter and the debuggee silently inherited the proxy's working directory. Route launchConfig.cwd through a new optional AdapterCommand.cwd field into the ruby policy's spawn config — the spawn layer already supported cwd, nothing delivered it. Covered by unit tests (adapter command carries cwd, policy routes it) and a hard e2e test launching with dapLaunchArgs.cwd and evaluating the working directory at a breakpoint. The e2e evaluates only the path tail because the #237 redaction masks home-rooted paths as <redacted:sensitive-name>. 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.
Fixes #320. Sibling of #318 (env, PR #321) — completes the family of spawn-time launch options for ruby.
Problem
cwdpassed viadapLaunchArgswas silently dropped on the ruby launch path: withrdbg --open -c -- ruby <script>the debuggee starts at adapter-spawn time, so the cwd carried in the later DAPlaunchrequest is never applied and the debuggee inherits the proxy worker's working directory instead. The spawn layer already supportedcwd(dap-proxy-adapter-manager.tssetsspawnOptions.cwdwhen provided) — nothing delivered the value to it.Fix
Route
launchConfig.cwdthrough the same channel as the #318 env fix:AdapterCommandgains an optionalcwdfield (packages/shared/src/interfaces/debug-adapter.ts), mirrored onAdapterSpawnPayload.adapterCommand.RubyDebugAdapter.buildAdapterCommandsets it fromlaunchConfig.cwd.adapter-policy-ruby.ts); theAdapterSpawnConfigunion already declaredcwd?.Optional field end to end — no other adapter or policy changes behavior (their debuggees get cwd via the DAP launch request as before). Attach mode untouched.
Tests
mcp-server-smoke-ruby.test.ts): launch fizzbuzz withdapLaunchArgs: { cwd: <examples/ruby> }, evaluate the working directory at a breakpoint. Red before the fix (debuggee sat in the repo root), green after. The expression evaluates only the path tail (Dir.pwd.split('/').last(2)) because the [FEATURE] Secret redaction + least-privilege variable inspection #237 redaction — on by default — masks home-rooted paths as<redacted:sensitive-name>.cwd(and staysundefinedwhen unset); policy routesadapterCommand.cwdinto the spawn config.validateAdapterCommand's error doc updated to mention the optional field; docs section extended to cover cwd alongside env.🤖 Generated with Claude Code