Skip to content

Filter unrelated workspace events before Explorer defers them - #26265

Merged
nwparker merged 1 commit into
mainfrom
nwparker/perf-explorer-foreign-watch
Oct 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/perf-explorer-foreign-watch

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

While a file rename or drag is open, File Explorer can retain filesystem events from other workspaces. Hiding and reopening Files then refreshes the current tree unnecessarily. Those unrelated events are now filtered before they enter the deferred queue.

What Changed

The watch listener applies the same normalized workspace-root comparison already used by reconciliation, before deferring events for inline input or dragging. Current-workspace events still queue and replay in order. Disposed subscriptions keep their existing late-event resync handling.

Why

Reconciliation already ignores foreign workspace events, but its filter ran after deferred storage. Moving that existing admission check earlier removes both the retained payloads and the false resync trigger, without adding a queue cap, dropping current-workspace changes or changing transport batching.

A native macOS Parcel watcher emitted nine real batches containing 5,000 updates across 1,000 existing generated JavaScript paths in another owned workspace. With a rename open, all nine payloads remained reachable before; none remained reachable after forced GC with the fix. On reopening an ordinary tree with 20 expanded folders, directory reads fell from 21 to zero, with identical contents. This measures event retention and unnecessary work, not a cause for the intermittent Codex typing pause.

Linked Issue

Performance audit; no existing issue linked.

Visual Proof

Before:

before

After:

after

Hidden Electron/CDP check of the actual FileExplorer, tree, watch hook and private store: focus a real row, press Enter to rename, receive one explicitly generated foreign event, hide and reopen Files. Controlled directory IPC calls fall from 21 to zero. The rename input, expanded folders and rendered tree remain identical; the screenshots are byte-identical. This rendered received-event check is separate from the native producer proof above. The fixture used a fresh desktop build and isolated profile; its owned app, daemon and profile were removed.

Testing

  • Manually checked the actual rendered rename/reopen flow on macOS through Playwright CDP, with windows hidden.
  • Added six regression cases to the existing watch suite: rename, drag and native drag each reject foreign queued events while preserving current-root deferred refresh. Three fail on original production code; all ten cases pass after the fix, including the four existing subscription/resync cases.
  • All 273 sidebar test files and 2,330 tests pass. The ten watch cases also pass under Node.
  • Renderer typecheck, all-project build typecheck, fresh desktop build, formatting and two-file changed-code quality pass.
  • Combined validation with the preceding 37 PRs passes: all 2,330 sidebar tests, all-project typecheck, and zero new quality findings across 116 changed files.
  • Forty-two temporary paired actual-hook/tree controls preserve own-root event ordering, overflow, rename/delete handling, teardown and normalized POSIX, Windows and UNC spellings.

Native measurement was on macOS. Windows/Linux normalization is covered by the paired controls, not a local native run. SSH broadcasts and runtime RPC events enter the same listener; its existing root comparison and host ownership are unchanged. The fixture includes ordinary workspace paths and does not require Git.

Review

Independent reviews of the final production and regression diff found no blocker. No UI styling, wire fields, polling or watcher batching changes. Filtering uses exact root identity with existing normalization, so sibling paths are not accepted as the current workspace.

Agent skill upstream boundary

  • Not applicable.

Checklist

  • Small and focused: six production lines and existing regression coverage.
  • Explained the user-facing change, mechanism and choice of approach.
  • Before/after rendered proof attached with its controlled IPC scope.
  • Self-reviewed for correctness, security and performance.
  • Cross-platform, folder and SSH behavior considered.
  • Relevant tests, typecheck, changed-code quality and fresh build pass; all selected hosted CI checks pass (14 success, 16 skipped).

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 479125cc-408d-432d-895e-5569de43aa07
📥 Commits

Reviewing files that changed from the base of the PR and between 7d6d7ca and 61a324e.

📒 Files selected for processing (2)
  • src/renderer/src/components/right-sidebar/useFileExplorerWatch.pending-refresh.test.tsx
  • src/renderer/src/components/right-sidebar/useFileExplorerWatch.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

useFileExplorerWatch now ignores filesystem-change events whose normalized worktree path differs from the watched path. Tests cover foreign-root overflow events during rename and drag interactions, and verify that current-root events refresh after an interaction ends.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 61a32

Explorer now ignores filesystem events from other workspaces before queuing them, which cuts unnecessary retention and refresh work. Current-workspace events still replay after interactions. No merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description is detailed and covers the change, rationale, testing, visual proof, review notes, and checklist. However, the required Linked Issue section does not contain an actual issue reference … Add a valid issue reference in the Linked Issue section, such as Fixes #123, or attach a pre-existing issue as required by the repository template.
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly describes the main change: filtering unrelated workspace events before File Explorer defers them.
Full details: Description check

Explanation

The description is detailed and covers the change, rationale, testing, visual proof, review notes, and checklist. However, the required Linked Issue section does not contain an actual issue reference and explicitly states that no issue is linked.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker
nwparker merged commit 408aa13 into main Oct 8, 2026
30 checks passed
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