Skip to content

fix: keep large-folder Git refresh off UI thread#169

Open
starSumi wants to merge 1 commit into
OlaProeis:0.3.1-experimentalfrom
starSumi:fix/large-folder-git-status-hang
Open

fix: keep large-folder Git refresh off UI thread#169
starSumi wants to merge 1 commit into
OlaProeis:0.3.1-experimentalfrom
starSumi:fix/large-folder-git-status-hang

Conversation

@starSumi

Copy link
Copy Markdown
Contributor

Summary

  • Move workspace Git status refreshes to a background worker so opening a large Git folder does not run repo.statuses() on the UI thread.
  • Keep file tree rendering on cached Git status data, build a pre-aggregated directory status index, and repaint when a background status refresh completes.
  • Cap per-frame file index and watcher message drains so large workspaces cannot monopolize a single repaint.

Details

The previous auto-refresh path could synchronously scan Git status from the app update path. On large repositories, especially with untracked files, that can make the window appear hung while the UI thread waits for status collection.

This change keeps status collection asynchronous and coalesced. Broad refreshes avoid recursive untracked-directory and ignored-file scans, while preserving untracked-directory semantics through parent status fallback and the existing single-file fallback path.

Symptom and environment

On Windows 11, opening a large Git-backed workspace from Ferrite could leave the window unresponsive during the initial workspace load. The local trace showed normal startup and first paints, then the hang appeared after the workspace was opened and automatic Git status refresh became eligible.

Requested review focus

Please review the async Git status boundary and the responsiveness tradeoff around broad ignored-file scanning. Ignored-file badges are no longer collected during the broad background scan; the goal is to keep the initial workspace UI responsive and avoid recursive ignored/untracked traversal on large folders.

Validation

  • cargo test --bin ferrite test_git_service
  • cargo test --bin ferrite status_for_path
  • cargo test --bin ferrite collect_all_files
  • cargo test --bin ferrite test_filter_events
  • cargo build --release

Human testing

Tested on Windows 11 with the previously hanging large-folder workflow. The window stayed responsive while opening the folder, and Git status badges appeared after the UI was already usable.

Move workspace git status scans to a background worker, keep file tree rendering on cached status snapshots, and cap per-frame workspace polling so large folders do not monopolize repaint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ffee17a3-a7f6-45b4-8492-6a325ef11635

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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.

@OlaProeis

Copy link
Copy Markdown
Owner

@starSumi very nice :) I will look into this and include it in the next release, currently on vacation, scheduled to mid or late August

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