fix(pi-fff): skip the picker instead of erroring when cwd scanning is opted out (#857) - #858
fix(pi-fff): skip the picker instead of erroring when cwd scanning is opted out (#857)#858gustav-fff wants to merge 1 commit into
Conversation
… opted out (#857) Starting a session in $HOME with enableHomeDirScanning:false (or in / with enableFsRootScanning:false) still asked the native layer for a picker rooted there, so the opt-out surfaced as `FFF init failed: ... Can not run certain FFF features in a file system root or home directories`. In override mode that left the session with neither the FFF tools nor pi's built-in grep/find. Skip the main picker for an opted-out cwd, report it once as a warning naming the responsible setting, and keep the ffgrep/fffind names in override mode so pi's built-ins stay reachable. Closes #857
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe extension now skips FFF indexing when sessions start in an opted-out home directory or filesystem root. It shows a warning, preserves built-in search tools in ChangesScan opt-out handling
Priority: ➖ Normal — Impact reflects medium issue severity. Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Starting in an opted-out home directory or filesystem root now skips FFF indexing with a clear warning while keeping built-in search tools available. The covered behavior is ready to merge. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 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 |
Closes #857
Root cause
packages/pi-fff/src/index.ts:751calledensureFinder(activeCwd)unconditionally onsession_start. Withcwd === $HOMEandenableHomeDirScanning: false, the native guard atcrates/fff-core/src/file_picker.rs:881refuses the picker, andreportInitFailure()(index.ts:710) reported that refusal at"error"level — the opt-out behaved like a hard failure. TheisHomeDir()check atindex.ts:755ran only after the throw and only drove the high-CPU warning. Inmode: "override"the tools were already registered asgrep/find, so every search call returned the same init error and pi's built-ins were unreachable for the whole session.Fix
scanOptOutReason(cwd)covers both opt-outs ($HOME +enableHomeDirScanning: false,/+enableFsRootScanning: false).session_startskips the picker and notifies once at"warning"level naming the responsible setting;ensureFinder()rejects with the same message instead of the native text;prepareSession()keepsffgrep/fffindinoverridemode for an opted-out cwd so pi's built-ingrep/findstay registered. Aux pickers for explicit out-of-workspace paths are unaffected.Steps to reproduce
Setup (real native lib, no config file — env only, so nothing is written to the pi agent dir):
Trigger, on pre-fix
main:Actual (pre-fix), run aborts:
Expected: session starts, no error, FFF workspace search off, pi's built-in
grepstill usable.Native refusal on its own (
packages/fff-bun,bunscript callingFileFinder.create):How verified
packages/pi-fff/test/extension.test.ts: theFileFinder.createmock now mirrors the native guard instead of always succeeding — that is why this shipped green. Three regression tests added ($HOME opt-out,/opt-out, and $HOME still indexed when not opted out).Post-fix, same pi command from
$HOME:i.e. the session starts, the tool call goes to pi's built-in
grep, and noFFF init failednotification is emitted. No strayfffprocesses left behind.Automated triage via Gustav. Honk-Honk 🪿
Summary by CodeRabbit
New Features
Bug Fixes