Skip to content

Windows: home-dir FileFinder scan triggers OneDrive sync, downloads cloud-only files #6

Description

@CudtMFrag

Problem

When pi opens a terminal on Windows and the working directory is C:\Users\<username> (no .git found), pi-fff's FileFinder indexes the entire home directory as the project root.

resolveProjectRoot() walks up from cwd looking for .git. When none is found, it falls back to cwd:

https://github.com/ShpetimA/pi-fff/blob/main/src/runtime-paths.ts#L18-L27

Then FileFinder.create({ basePath: projectRoot }) starts scanning all files under C:\Users\<username>:

https://github.com/ShpetimA/pi-fff/blob/main/src/fff-runtime.ts#L838-L845

Why this is a problem

On Windows, OneDrive Files On-Demand keeps cloud-only files as lightweight placeholders (reparse points). When FFF's background scanner/watcher accesses these files (even just stat + content indexing), the Windows filesystem triggers OneDrive's hydration — downloading the actual file content from the cloud.

This causes:

  • Unwanted bandwidth consumption
  • Disk space bloat (cloud-only files become local)
  • Slow scanning while OneDrive downloads large files
  • Unnecessary OneDrive sync activity

The OneDrive folder typically lives at C:\Users\<username>\OneDrive (or OneDrive - <Org> for business accounts).

Proposed fix

pi-fff should exclude OneDrive from the scan scope. Options:

  1. In pi-fff: Detect that cwd is the user home directory. If the OneDrive folder exists under it, either exclude it from indexing or refuse to index the home directory altogether (suggest cd into an actual project).

  2. In @ff-labs/fff-node: Add an exclude/ignore option to InitOptions so pi-fff can pass ignore patterns to the native scanner. (This is the deeper fix — the native scanner is what actually triggers the file access.)

  3. Quick mitigation: pi-fff could check if basePath === homedir() and refuse to initialize, prompting the user to navigate into a project directory first.

Steps to reproduce

  1. On Windows with OneDrive configured, open pi
  2. Ensure cwd is C:\Users\<username> (not inside a git repo)
  3. pi-fff initializes, starts scanning
  4. Observe OneDrive sync activity — cloud-only files get downloaded

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions