Repository navigation
perf(worktrees): skip unchanged lineage after sidebar order saves - #27384
Conversation
Mark order-only remote events and skip redundant lineage downloads only after a successful current-host read. Preserve independent cold, failed, pending and structural refreshes, including reconnect and re-pair. Addresses #27268. Co-authored-by: mmarabel <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Fresh lineage lets order-only updates avoid redundant reads, while structural changes and recovery paths still refresh it. No actionable merge risk was established; the change appears ready for normal CI and merge. Pre-merge checks |
|
Paired clients now skip lineage refetch on sort-order-only events, so the pre-lineage create notify on the SSH route could leave lineage stale until the next structural change.
ELI5
Saving the sidebar order on a paired host downloads the same parent relationships once per repository. This removes those repeated downloads when the client's relationships are already current. Other clients still receive and display the new order.
What Changed
The Git-scan fix already landed in #27343. This companion adds optional
sortOrderOnly: trueto its existing remote change event. The desktop still fetches each affected repository and updates Smart sort normally; it skips only the unrelated host-wide lineage request.That skip requires a successful lineage read for the same store, pairing revision and connection generation, with no pending read or subsequent invalidation. Existing lineage reads share a small readiness observer, including startup, manual, best-effort and failed-write recovery paths. Structural events invalidate before repository discovery or queueing; project/replay refreshes invalidate before scheduling. Cold clients, failed reads, reconnects, renames, mixed event bursts and older hosts keep the existing full refresh and concurrency.
Why
@mmarabel identified the waste in #27268 and proposed the original host change in #27271. Their paired-host capture measured 25 repositories, about 105 worktrees and approximately 1.4 MB downloaded per order save, mostly 25 identical lineage replies.
A compatible hint removes work that the host knows is unrelated to an order save. A generic per-host batch would delay a new parent assignment behind an unrelated slow listing/read. The readiness guard preserves the existing opportunity to recover after failed or incomplete refreshes without a timer, serialized queue or stale-result cache.
Linked Issue
Addresses the repeated lineage downloads in #27268, following the merged host-scan fix in #27343. Keep the issue open: this preserves Smart-sort updates and
sortEpoch, including cold-client ordering and the existing creation-grace behavior; it does not claim to eliminate subsequent re-sorts.Visual Proof
N/A — background work is removed; the displayed order and parent relationships keep their existing behavior.
Testing
macOS arm64, with
ORCA_BACKGROUND_LAUNCH=1:git diff --checkpassed.Node and web typechecks and the changed-code quality gate also passed on the combined branch. Full lint, native Windows/Linux acceptance and build remain for CI.
Review
Independent review rejected the generic batch for visible freshness delay, then reproduced and fixed failed-refresh and unknown-repository discovery gaps in the hint version. Final source and wire review found no remaining blocker; adverse interleavings and old/new event payloads were checked independently.
Agent skill upstream boundary
Notes
No new dependencies, subprocesses, timers or stream opcodes. Old hosts send unmarked events and get the original refresh; old clients ignore the optional field. Mobile still receives the same event and refreshes order. Direct SSH and local desktop notifications keep their existing paths. Folder relationships use the same authoritative read/merge path. Expected merge risk is low; no negative user-facing trade-offs identified.
Checklist