Skip to content

perf: preserve unrelated authorization roots after desktop removal - #26294

Merged
nwparker merged 1 commit into
mainfrom
nwparker/perf-desktop-removal-auth-scope
Oct 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/perf-desktop-removal-auth-scope

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Removing one local worktree should not make Orca rediscover worktrees in every other repository before it can read a file. Local desktop removal now refreshes only the repository that changed.

What Changed

Both successful registered-local removal paths use the existing repository-scoped authorization invalidation helper. The affected repository loses its old roots and advances its revision; unrelated repositories keep their verified roots. The helper still invalidates everything when ownership cannot be established. Refused removals do not invalidate anything.

Why

The current desktop IPC path clears every repository’s authorization cache after a successful deletion. Reusing the existing scoped helper removes unnecessary Git subprocesses while preserving the existing stale-listing fence and access checks. This is separate from the runtime-backed removal path fixed earlier.

Seven alternating before/after pairs exercised the actual public desktop removal handler, real Git worktree deletion, and the next public filesystem read on macOS. With 24 real repositories, median combined time fell from 66.3 to 37.5 ms; the read portion fell from 32.8 to 5.2 ms. A separate subprocess-count run showed 24 repository listings becoming one. With eight repositories the combined time fell from 44.6 to 37.6 ms. One-repository timing was unchanged at about 36.6 ms.

Linked Issue

Performance audit; no existing issue linked.

Visual Proof

N/A

This changes authorization-cache scope after local deletion; the interface, deletion outcome and error behavior are unchanged.

Testing

  • Manually exercised the real public IPC handlers with native Git and filesystem operations on macOS. All 42 paired successful actions preserved results, metadata callbacks and file contents. Nine paired controls covered dirty/locked refusals, forced deletion, missing paths, unknown ownership, disconnected SSH and host mismatch. Removed paths remained denied.
  • Extended existing removal tests to assert scoped invalidation on success and orphan cleanup, global fallback without a known owner, and no invalidation on refused preflight. A real two-owner registry check verifies the changed revision advances, the unrelated revision stays valid, the removed root is denied, and the unrelated root remains registered. Three assertions fail against the original implementation; all 79 focused removal and authorization tests pass in both Bun and Node.
  • An additional native control held three old Git listing replies across public deletion, then released them. Neither implementation restored the removed root or accepted a read from it.
  • All-project typechecks, fresh desktop build, formatting and the three-file changed-code quality gate pass. The combined 41-change branch also passes a fresh desktop build with all-project typechecks and the 124-file changed-code quality gate.

Hosted static, Node unit and relay integration checks pass. Linux packaging finished as cancelled after waiting in its package-tool installation step; the application packaging steps did not run. Windows packaging has an unresolved first-attempt failure: the unchanged SysWOW64 installer process-query test timed out after 60 seconds with empty output. Its test, installer macro and process wrapper are byte-identical to both CI merge parents; the log does not establish whether the query started. No all-green claim or speculative source fix.

Native timing was macOS with real local Git; module registration used a test Electron boundary rather than an app window. Connected SSH and folder-success flows were reviewed in source and are outside the changed registered-local module. No Windows/Linux timing or Codex typing-pause claim.

Review

Independent source and evidence review found no blocker. This reuses the existing ownership helper at the same successful-removal points, changes no Git arguments or remote protocol, and preserves the global fallback for uncertain ownership.

Agent skill upstream boundary

  • Not applicable.

Checklist

  • Small and focused.
  • Explained the user-facing change, mechanism and choice of approach.
  • Visual proof is N/A with reason.
  • Self-reviewed for correctness, security and performance.
  • Cross-platform, folder and SSH behavior considered.
  • Relevant tests, typechecks, changed-code quality and fresh build pass; hosted Linux packaging was cancelled during tooling installation and Windows packaging failed in the unchanged installer probe described above.

@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: aa38873c-e723-4f07-b0ea-e30de8ec63f3
📥 Commits

Reviewing files that changed from the base of the PR and between 7f43d9b and 0c59408.

📒 Files selected for processing (3)
  • src/main/ipc/worktrees-removal-recovery.test.ts
  • src/main/ipc/worktrees-remove-preflight.test.ts
  • src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts

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


📝 Walkthrough

Walkthrough

Local worktree removal now invalidates authorized-roots cache entries for the affected repository during orphan cleanup and metadata purge. Recovery tests check repository-scoped invalidation, registered-root revisions, and behavior when no registered authorization owner exists. Preflight tests verify that dirty removal paths do not invalidate the caches.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 0c594

Successful local removals can retain unrelated repositories’ authorization caches without an identified new authorization regression. The change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 summarizes the main change: preserving unrelated authorization roots after desktop worktree removal. It is concise and specific.
Description check ✅ Passed The description is detailed and covers the user impact, mechanism, rationale, testing, limitations, and checklist items. It explicitly notes that no issue is linked, which conflicts with the template …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • 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 8155e2e into main Oct 8, 2026
50 of 53 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