fix(ssh): fix support for remotes that use fnm#2641
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved Straightforward bug fix modifying fnm shell initialization in SSH tunneling scripts. Limited scope, clear intent, and test coverage updated to match. You can customize Macroscope's approvability policy. Learn more. |
Summary
fnm env --shell shusage withfnm env --shell bash.fnm useonce after environment initialization so remote Node resolution matches the one-shot activation pattern used for other version managers.Why
fnm env --shell shis not a supported fnm shell value, so the existing remote bootstrap could silently fail to initialize fnm in non-interactive SSH sessions.We also avoid
fnm env --use-on-cd --shell shbecause--use-on-cdemits hook code containing Bash-style[[ ... ]]conditionals, which are not supported bydashor POSIXsh. The remote runner is a#!/bin/shscript, so one-shotfnm useis a better fit than installing directory-change hooks.Test Plan
bun --filter @t3tools/ssh test -- src/tunnel.test.tsbun fmt && bun lint && bun typecheckMade with Cursor
Note
Low Risk
Low risk: small, isolated change to the generated remote shell bootstrap for
fnm, plus test expectation updates; main risk is behavior differences on systems wherefnm env --shell bashisn’t available.Overview
Fixes remote Node bootstrapping for hosts using
fnmby replacing the unsupportedfnm env --shell sh/--use-on-cdinitialization witheval "$(fnm env --shell bash)"and then running a one-shotfnm use(--silent-if-unchangedwith fallback todefault).Updates tunnel script tests to assert the new
fnmactivation andfnm usecommands in the generated remote runner.Reviewed by Cursor Bugbot for commit 7434d75. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix fnm support in SSH remote node path setup
The
ensure_remote_node_pathfunction in tunnel.ts previously tried to initialize fnm usingshwith--use-on-cdbut never calledfnm use, so the correct Node version was not activated.fnm env --shell bashand explicitly runsfnm use --silent-if-unchanged, falling back tofnm use defaulton failure.>/dev/null 2>&1) and guarded to avoid errors on remotes where fnm is absent.Macroscope summarized 7434d75.