Skip to content

fix: detect fish shell via FISH_VERSION when login shell differs#264

Merged
rafa-thayto merged 2 commits intomainfrom
fix-doctor-shell-detection
May 6, 2026
Merged

fix: detect fish shell via FISH_VERSION when login shell differs#264
rafa-thayto merged 2 commits intomainfrom
fix-doctor-shell-detection

Conversation

@rafa-thayto
Copy link
Copy Markdown
Contributor

Summary

  • Fix clerk doctor shell detection for fish users whose login shell ($SHELL) is zsh — now checks FISH_VERSION env var as a fallback
  • Fix clerk update showing an irrelevant hash -r hint to the same users
  • Add delete process.env.FISH_VERSION guard in test beforeEach to prevent contamination when running tests from fish

Details

On macOS, $SHELL reflects the login shell from /etc/passwd, not the active shell. Fish doesn't overwrite $SHELL — it sets FISH_VERSION instead. This caused two bugs:

  1. clerk doctordetectShell() read only $SHELL, so fish users with a zsh login shell saw zsh completion diagnostics
  2. clerk updatehashHint() checked $SHELL for fish, missed it, and showed a hash -r hint (fish auto-rehashes, so this is noise)

The fix checks $SHELL first for bash/zsh (which don't export their version vars to children), then falls back to FISH_VERSION. This handles both the primary case (fish with zsh login shell) and the edge case (bash/zsh launched from within fish, where FISH_VERSION is still inherited).

Test plan

  • New test: detects fish via FISH_VERSION when SHELL is unset
  • New test: trusts SHELL over FISH_VERSION when SHELL is bash or zsh (bash-inside-fish edge case)
  • New test: skips when SHELL points to an unrecognized shell (/bin/csh)
  • Existing fish/zsh/bash tests still pass (48/48)
  • beforeEach clears FISH_VERSION so tests are stable regardless of runner shell

On macOS, $SHELL stays /bin/zsh even when running fish, causing
`clerk doctor` to report zsh output and `clerk update` to show an
irrelevant `hash -r` hint. Check FISH_VERSION (always exported by
fish) as a fallback when $SHELL doesn't say fish.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 6, 2026

🦋 Changeset detected

Latest commit: 13e515e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
clerk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@rafa-thayto has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 45 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eea7dd10-7934-474e-b110-88fce18cefbb

📥 Commits

Reviewing files that changed from the base of the PR and between ec06679 and 13e515e.

📒 Files selected for processing (4)
  • .changeset/doctor-shell-detection.md
  • packages/cli-core/src/commands/doctor/checks.ts
  • packages/cli-core/src/commands/doctor/doctor.test.ts
  • packages/cli-core/src/commands/update/index.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dmoerner
Copy link
Copy Markdown
Contributor

dmoerner commented May 6, 2026

!snapshot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Snapshot published

npm install -g clerk@1.1.3-snapshot.g7082776
Package Version
clerk 1.1.3-snapshot.g7082776

Published from 7082776

Comment thread packages/cli-core/src/commands/doctor/checks.ts Outdated
@rafa-thayto rafa-thayto requested a review from dmoerner May 6, 2026 20:35
@rafa-thayto rafa-thayto merged commit 955c98b into main May 6, 2026
10 checks passed
@rafa-thayto rafa-thayto deleted the fix-doctor-shell-detection branch May 6, 2026 20:38
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.

2 participants