Skip to content

perf: resolve current-workspace document addresses before catalog scans - #19495

Merged
nwparker merged 2 commits into
mainfrom
OrcaWin/perf-split-54-document-address
Sep 9, 2026
Merged

nwparker merged 2 commits into
mainfrom
OrcaWin/perf-split-54-document-address

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3

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

  • Current-root matches avoid reading the global worktree catalog; existing address contracts pass

This PR contains only this focused change and its regression coverage. It targets main independently 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

  • 10 tests across 1 suite(s) passed on this isolated branch on macOS.
  • Full pnpm tc passed on this branch.
  • Commit hooks passed: oxlint, React Doctor lint and formatting; git diff --cached --check passed.
  • All tests ran with ORCA_BACKGROUND_LAUNCH=1. No visible test window was launched.
  • Full build and Windows/Linux/live SSH validation remain for CI; host/provider contracts are preserved.

Test files:

  • src/renderer/src/lib/workspace-doc-address-input.test.ts

Agent skill upstream boundary

  • No upstream skill-installer material copied or translated.

Checklist

  • Focused change with regression evidence.
  • Typecheck and pre-commit checks passed independently.
  • Cross-platform, folder-workspace and SSH ownership considered.
  • Full CI build and repository checks pass.

@nwparker
nwparker marked this pull request as ready for review September 8, 2026 04:53
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 030d87fb-316a-4d14-8f5e-b2830f6a41ba

📥 Commits

Reviewing files that changed from the base of the PR and between 6642053 and 1400338.

📒 Files selected for processing (2)
  • src/renderer/src/lib/workspace-doc-address-input.test.ts
  • src/renderer/src/lib/workspace-doc-address-input.ts

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Current-worktree short-circuit — resolveWorkspaceDocAddressTarget now resolves the current worktree's root via getKnownWorktreeById once and returns a workspace-doc target directly when the absolute path is lexically inside it, skipping the global catalog scan entirely.
  • ownedWorktreeRoots slimmed — the helper no longer prepends the current worktree (and drops its getKnownWorktreeById call); 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.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit f1f2d61 into main Sep 9, 2026
127 of 154 checks passed
@nwparker
nwparker deleted the OrcaWin/perf-split-54-document-address branch September 9, 2026 10:23
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