Repository navigation
perf: resolve current-workspace document addresses before catalog scans - #19495
Conversation
|
Warning Review limit reachedNext included review available in 26 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Current-worktree short-circuit —
resolveWorkspaceDocAddressTargetnow resolves the current worktree's root viagetKnownWorktreeByIdonce and returns aworkspace-doctarget directly when the absolute path is lexically inside it, skipping the global catalog scan entirely. ownedWorktreeRootsslimmed — the helper no longer prepends the current worktree (and drops itsgetKnownWorktreeByIdcall); it returns only non-current roots, still sorted most-specific-first.
Semantics are preserved: the current worktree previously sat at index 0 ahead of the sorted roots, so it always won over a nested root — the new short-circuit fires before the scan and produces the same winner. The three added tests are exact (the enumeration tests throw if allWorktrees is ever called), not theatre.
One note, no change required: the // Most-specific root first (after the current worktree) comment in ownedWorktreeRoots (workspace-doc-address-input.ts:33) now reads slightly stale, since current-worktree precedence is enforced in the caller rather than inside that function.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
When you type a file path into Orca's address bar, Orca has to figure out which of your open workspaces that file belongs to before it can show it to you.
It used to answer that question by listing every workspace you have open and checking them one by one — even when the file was sitting right in the workspace you were already looking at, which is almost always the case.
Now it checks the workspace you're currently in first, and only goes looking through the full list if the file isn't there. Same answer, less rummaging. The current workspace was already the first thing checked in the old list, so the file you open is exactly the file you opened before.
What Changed / Why
This PR contains only this focused change and its regression coverage. It targets
mainindependently of the other desktop audit PRs. Measurements describe operation/allocation reductions, not end-to-end latency gains.Linked Issue
User-requested desktop performance audit; no issue supplied.
Visual Proof
N/A — no visual design change. Behavior and performance invariants are checked by automated regression tests.
Testing
pnpm tcpassed on this branch.git diff --cached --checkpassed.ORCA_BACKGROUND_LAUNCH=1. No visible test window was launched.Test files:
src/renderer/src/lib/workspace-doc-address-input.test.tsAgent skill upstream boundary
Checklist