Repository navigation
Move shared file watches when the selected remote host changes - #26632
Conversation
70bf530 to
61f4d6c
Compare
e4d139a to
a4d4c9f
Compare
a4d4c9f to
40378b3
Compare
61f4d6c to
5d183f4
Compare
40378b3 to
804f466
Compare
5d183f4 to
4e3f196
Compare
|
Review fix: the watch-target selector took the watched root from the first worktree or folder row with a matching ID. When two hosts publish the same ID at different roots, the selected host's watch used the other host's root, and the Explorer rejected every batch. Each target now resolves its worktree, repo, folder and project-group rows on the owner's execution host (new editor-external-watch-target-rows.ts), and falls back to the first row only when no row matches that host. Tests cover worktrees and folders with different roots, per-owner open files, and an adapter-to-Explorer refresh (useFileExplorerWatch.host-root.test.tsx). |
4e3f196 to
c366458
Compare
3d577f3 to
4b49611
Compare
c366458 to
8f3d6a1
Compare
|
Round 2 fix (8f3d6a1): the selected folder host was being applied to every open editor without a runtime owner, so a local editor could have its watch moved onto a same-id direct-SSH folder. Watch consumers now carry their own execution host: each open file uses the host captured when it was opened (or its SSH target / runtime owner), and only the sidebar consumer follows the selected host. Targets are deduplicated by their full key. Added a regression test (local file + selected SSH folder sharing one folder id) that fails on the previous head and passes now; the differing-root runtime tests still pass. Stack rebased onto main. |
27abb81 to
8085a9e
Compare
8f3d6a1 to
828e993
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe watch-target selector now resolves worktree and folder-workspace rows for each consumer’s execution host. It accounts for host selection in its cache and returns deduplicated, sorted targets. Added tests cover selected-host roots, open files on multiple hosts, and Explorer refreshes. The selected-host E2E test checks that the Explorer displays a file created on the newly selected host. CI routing includes changes to the selector in that E2E lane. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The selected-host watch change is mergeable after normal checks; no actionable failure was established. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
ELI5
Switching between two remote machines with the same folder or worktree ID must move the shared file watcher to the newly selected machine. It now does.
What Changed
Before, the active workspace ID could stay unchanged while its selected host changed. The watcher target cache did not include that host, so it returned the previous host's targets and kept listening there. The new host could read and display a newly created file through the explorer's separate subscription while the shared app event never arrived.
The selector now includes the canonical selected execution host in its existing cache inputs. Its existing owner resolver and subscription diff replace the old target; unchanged target sets still retain the same snapshot.
Why
The missing host is an input to the existing ownership resolver. Tracking it fixes the stale cache without polling, reconnecting unchanged watches, or introducing another ownership algorithm.
Linked Issue
Found during SSH → Remote consolidation testing; no existing issue.
Visual Proof
The direct explorer control reads and displays SWITCHED_HOST_A/B in both baseline directions, while the shared event times out. Corrected runs receive the real matching host-qualified event. The additional rendered comparison applies #26612's proposed shared-watcher explorer consumer identically to baseline and corrected clients: the baseline omits the newly created file, and the correction displays it.
watcher-host-switch-runtime-probe.log
watcher-host-switch-integration-runtime-red.log
watcher-host-switch-integration-runtime-green.log
watcher-host-switch-runtime-green-final.log
Testing
The original direct-explorer baseline fails for both selected hosts in 35.6 s after the new file is already visible, because its shared event never arrives. With #26612's same consumer applied to both sides, the identical rendered baseline fails in 35.2 / 35.4 s and corrected cases pass in 20.9 / 20.7 s (43.5 s total). After removing that temporary consumer, the exact proposed branch was rebuilt and both final broker/creation/deletion/switch/return journeys pass in 20.9 / 20.7 s (42.9 s total).
Two new selected-host regressions fail before the fix; two stable-snapshot controls pass. All 250 tests / 16 files pass afterward, covering watcher targets, subscription retirement, move reconciliation, WSL aliases, owner routing and CI contracts. Full typecheck/lint, changed quality, standalone React Doctor, fresh E2E build and commit hooks pass.
Combined stack verification: C18–C21 rebased on #26637/#26645 preserves their renderer changes exactly. 547 tests / 49 files, full typecheck/lint, changed quality (including React Doctor/design-system checks), a fresh E2E build and both real-host switch directions pass. CI reruns on the new head; prior green results are not claimed for it.
Review
Stacked on #26627; merge #26637 → #26645 → #26616 → #26627 first. Only the watcher target selector changes in production. #26612's consumer was applied temporarily for the extra visual comparison and is not copied into this PR.
Agent skill upstream boundary
Notes
No server or wire change. Runtime coverage is macOS client / Linux SSH hosts; Windows was not exercised. All host writes target disposable fixtures. The original CI passed both new host-switch cases but failed the unchanged idle-restart control: first an inherited canceled startup, then on its one retry an idle-stop record read before startup completed. The new head includes the separately exercised fixes #26637/#26645 and verifies current connection authority plus real RPC readiness before reading the record. Original failure receipts are retained; CI will rerun on the rebased head. The visual comparison also verifies compatibility with #26612, which itself depends on #26606.
Checklist