Skip to content

fix(pi-fff): avoid blocking startup on initial scan - #836

Closed
leezenn wants to merge 1 commit into
dmtrKovalenko:mainfrom
leezenn:fix/pi-fff-nonblocking-scan
Closed

leezenn wants to merge 1 commit into
dmtrKovalenko:mainfrom
leezenn:fix/pi-fff-nonblocking-scan

Conversation

@leezenn

@leezenn leezenn commented Aug 29, 2026 •

Copy link
Copy Markdown

Summary

  • return the native finder immediately after successful creation
  • let the initial filesystem scan continue in the background
  • add regression coverage preventing waitForScan() from returning to the shared factory path

Why

Pi emits session_shutdown followed by session_start during /reload. The shared picker factory currently waits up to 15 seconds for the initial scan, so every reload can block on a fresh traversal.

The finder is usable while scanning; searches may temporarily return partial results. This trade-off avoids blocking Pi startup and reload while preserving scan progress reporting and lifecycle cleanup.

Verification

  • cd packages/pi-fff && bun run typecheck
  • cd packages/pi-fff && bun test test/ — 81 tests passed
  • focused live Pi reload A/B: stock 3.24 s; patched 30–114 ms
  • immediate search while isScanning was true returned a valid result

Summary by CodeRabbit

  • Improvements

    • File pickers are now available immediately while scanning continues in the background.
    • Reduced startup waiting time when creating a file picker.
  • Tests

    • Added coverage confirming picker creation does not wait for the initial scan to finish.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e48219bb-4365-45b9-b1f4-cb564f84ad9e

📥 Commits

Reviewing files that changed from the base of the PR and between ac62bdd and 218c686.

📒 Files selected for processing (2)
  • packages/pi-fff/src/file-picker.ts
  • packages/pi-fff/test/file-picker.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

FilePickerFactory.create now returns immediately after picker creation. Initial scanning runs in the background. A test verifies that waitForScan is not called.

Changes

File picker creation

Layer / File(s) Summary
Return picker before scan completion
packages/pi-fff/src/file-picker.ts, packages/pi-fff/test/file-picker.test.ts
FilePickerFactory.create no longer waits for scanning or uses SCAN_TIMEOUT_MS. The test verifies immediate return without calling waitForScan.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 218c6

Startup and reload no longer wait for the initial filesystem scan; searches may briefly return incomplete results while scanning continues. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: it prevents startup from blocking on the initial scan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@leezenn leezenn closed this Aug 29, 2026
@leezenn

leezenn commented Aug 29, 2026 •

Copy link
Copy Markdown
Author

excuse me and my сlanker for this mess
сорян 😄

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.

1 participant