Repository navigation
Fix ripgrep resolution for Nix installs - #3946
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR adds a user-configurable ChangesCustom ripgrep binary path support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (13 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Greptile SummaryThis PR fixes ripgrep discovery for Nix installs by replacing two independent ad-hoc resolver functions (in
Confidence Score: 5/5Safe to merge — the resolver is well-isolated, all three locales are covered, the configuredPathNotExecutable path is surfaced correctly in both Find and session search, and the previous review issues are fully addressed. The change consolidates two previously divergent resolver implementations into a single, dependency-injectable RipgrepExecutableResolver. The session search path changed from a one-time static-let to per-call resolution, which is intentional (settings changes take effect immediately) and the overhead is trivial (stat calls). Localization, JSON schema, managed import, allowlist, search index, and settings UI are all updated in lockstep. Seven new resolver unit tests and one settings-import integration test cover all meaningful code paths. No blocking primitives, no actor-isolation regressions, no sensitive data in logs. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Search triggered\nFind or Session] --> B[RipgrepExecutableResolver.resolution]
B --> C{configuredPath\nnon-empty?}
C -- Yes --> D{isExecutable\nconfiguredPath?}
D -- Yes --> E[.found — use configured binary]
D -- No --> F[.configuredPathNotExecutable]
F --> G{Caller?}
G -- FileSearchController --> H[Emit localized error\nin Find UI]
G -- SessionIndexStore --> I[os_log warning\nfall back to Foundation scan]
C -- No --> J[Check default paths\n/opt/homebrew, /usr/local,\n/opt/local, /usr/bin,\nNix profile paths ×5]
J --> K{Any path\nexecutable?}
K -- Yes --> E
K -- No --> L[Walk PATH entries]
L --> M{rg found\nin PATH?}
M -- Yes --> E
M -- No --> N[.notFound]
N --> O{Caller?}
O -- FileSearchController --> P[Emit rg-not-installed\nerror in Find UI]
O -- SessionIndexStore --> Q[Fall back to\nFoundation substring scan]
Reviews (13): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
Closes #3657
Summary
automation.ripgrepBinaryPathsetting for cmux.json and Settings > AutomationVerification
/etc/profiles/per-user/nixuser/bin/rgavailable: observednil, expected the Nix rg path.git diff --checkand JSON parsing forResources/Localizable.xcstringsandweb/data/cmux.schema.json.Note
Medium Risk
Medium risk because it changes how
rgis located for both project Find and session indexing, which can alter search behavior or introduce new failure paths when the configured binary is invalid.Overview
Fixes ripgrep discovery by introducing a shared
RipgrepExecutableResolverthat prefers a user-configuredautomation.ripgrepBinaryPath(with~expansion), adds common Nix install locations, and falls back to PATH.Adds a new managed setting surfaced in Settings → Automation and
cmux.json(schema/template/JSON-path allowlist/search aliases/localizations), shows a localized error in Find when the configured path is not executable, and logs a warning + falls back for session search. Includes regression tests covering resolver precedence, nix paths, tilde expansion, invalid overrides, and settings-file import.Reviewed by Cursor Bugbot for commit 84eb661. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds a managed
automation.ripgrepBinaryPathand a shared resolver to findrgfor Find and session search. It prefers the configured path (with~), then macOS defaults, Nix profiles, then PATH; Find shows a localized error for non-executable overrides, and session search logs a warning and falls back. Fixes #3657.New Features
automation.ripgrepBinaryPathincmux.jsonand Settings → Automation (schema, template default, JSON-path allowlist, managed import, localizations, settings search alias, UI field).Bug Fixes
RipgrepExecutableResolvershared by Find and session indexing. Precedence: configured path (~supported) → macOS (/opt/homebrew/bin/rg,/usr/local/bin/rg,/opt/local/bin/rg,/usr/bin/rg) → Nix (/etc/profiles/per-user/<user>/bin/rg,/run/current-system/sw/bin/rg,/nix/var/nix/profiles/default/bin/rg,~/.nix-profile/bin/rg,/nix/var/nix/profiles/per-user/<user>/profile/bin/rg) → PATH. Find surfaces a localized “not executable” error; session search logs a warning and falls back to substring search. Tests cover precedence, Nix paths (including Home Manager/per-user), tilde expansion, invalid overrides, message text, and settings import.Written for commit 84eb661. Summary will update on new commits. Review in cubic
Summary by CodeRabbit