Repository navigation
Fix truncated Unicode branch names in base ref search - #25777
Conversation
Recover incomplete or disambiguated short refs from the full selector and keep local branch names independent for reuse. Gate qualified selectors for remote clients and filter unsupported rows before pagination. Adapted from nishino-tsukasa's PR #19540 with additional truncation and legacy pagination coverage. Co-authored-by: kino <[email protected]>
📝 WalkthroughWalkthroughGit ref search now resolves selectors from complete ref names and can include qualified refs in search results. Runtime search passes the inclusion option through local and SSH paths. RPC responses filter qualified refs for clients that do not advertise the new capability. Composer branch selection recognizes qualified local refs for reuse, and remote-tracking resolution rejects qualified refs outside Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to A large batch of directory renames could become slower if linked-directory checks repeat for each event. The current code checks once per payload, but this test would not catch that performance regression. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
Full details: Linked Issues checkExplanation For [ Full details: Out of Scope Changes checkExplanation The PR also changes
✨ 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 |
Qualify slash-named local branches before worktree creation can interpret them as remote refs. Preserve nested HEAD and reserved-prefix identities, accept valid dotted ref components, and advertise support on local RPC. Keep qualified local selectors out of native/SSH remote-fetch planning, and exercise the existing relay argument validator in search tests. Add real Git collision tests with configured and orphan tracking refs.
|
Adversarial review loop completed with three independent reviewers over four rounds. Final source review is clean. Fixed the concrete findings: valid dotted ref components were being excluded, local desktop RPC lacked the capability, qualified local refs could be mistaken for a remote named Verified: 220 focused tests pass; all 77 Git tests pass against both current Git and affected Apple Git-154 under Compatibility tradeoff: older clients safely omit qualified slash-named local branches until upgraded. Current clients retain them and use the separate local branch name for naming/reuse. |
|
Updated reviewed head: The preceding CI failure was inherited from main: its release-checkout test expected a missing |
|
Final reviewed head: Git, cross-version wire, Linux/Windows packaging, relay, mobile, typecheck and native smoke checks passed on the preceding head. Fresh CI is pending on this final commit. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/right-sidebar/file-explorer-watch-reconcile.test.ts (1)
434-435: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCount the linked-directory traversal in this performance test.
This test sends 1,000 directory-rename events, but
keyVisitscounts only property-descriptor reads caused byObject.keys(cache).hasCachedDirectoryLinkseparately traversespathIndex.values(). The currenthasLinkedCache ??=limits that check to once per payload, but a regression that repeats it per event would still pass this assertion while adding a full directory-index traversal for every event. Count or otherwise bound the entries visited by that traversal.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4fbf901a-1ec2-451b-a64b-0e3311592720
📒 Files selected for processing (1)
src/renderer/src/components/right-sidebar/file-explorer-watch-reconcile.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
|
Final reviewed head: |
ELI5
Some older Apple Git builds cut off Chinese branch names in search. Selecting that result fails because the displayed name is not a real branch. Orca now keeps the complete branch identity and can create a worktree from it.
What Changed
Compare Git's short name with the complete ref and use the complete ref when the short spelling is incomplete or needs namespace disambiguation. Local branch names containing
/also keep their full selector, because worktree creation otherwise gives a matching remote-tracking ref priority even when no remote is configured. Derive the proposed local branch name independently, so local branch reuse still works. Literal�characters stay valid. Simple local names and ordinary remote names retain their short spelling.Local and SSH searches use the same parser. Remote clients advertise support for complete selectors; older clients omit those rows before the result limit so ordinary results still fill the page. This deliberately hides slash-named local branches from older clients until they upgrade; current clients retain them with exact selectors.
Why
Reproduced with Apple Git-154 (2.39.5) built from Apple's source on macOS:
feature/加becomesfeature/�under a UTF-8 locale, while the complete ref resolves correctly. Current Apple Git 2.50.1 and Homebrew Git 2.55.0 are unaffected. The issue comment records the source-build caveat and exact steps.Comparing spellings also catches partial names without a replacement character. Using the complete ref preserves local/remote/tag distinctions; blindly removing the namespace could select the wrong commit. Git commands and bounded search counts are unchanged.
Linked Issue
Fixes #19515
Adapted from #19540 by @nishino-tsukasa, with co-author credit. Thank you for the original fix, compatibility handling, and regression coverage. This version also checks incomplete spellings generally and filters unsupported selectors before pagination.
Visual Proof
Hidden Electron renderer running the affected Apple Git build. Before: the long Chinese branch ends in
�. After: complete selectors preserve the names (the long row is visually elided; the shortfeature/加example fits). Creating a worktree from the long branch and reusingfeature/加both succeed.Before:
After:
Created worktree from the recovered long branch:
Testing
macOS: 235 focused tests pass across Git search, SSH query handling, RPC capability negotiation, branch reuse, and web/CLI clients. The 77 Git tests also pass with Apple Git-154 under
en_US.UTF-8, including real local and remote worktree creation.pnpm tc, the changed-code quality gate, and the completepnpm run build:desktoppass after installing this worktree's missing mobile dependencies.Hidden Electron UI: reproduced the corrupted result before the fix, then searched, selected, created a new worktree, and reused the existing local Unicode branch after the fix. SSH behavior is covered with provider fixtures; Linux and Windows were not run locally.
AI Disclosure
Review
Three independent adversarial reviewers completed seven review rounds. The final pass is clean after fixing valid dotted-component validation, desktop capability drift, native/SSH namespace confusion, and loose-shortening collisions with configured or orphan remote refs. Tests also execute the real relay argument validator. Reviewed branch/tag collisions, literal replacement characters, slash-containing remote names, nested
/HEADbranches, legacy-client pagination, and folder workspaces.After updating to the CI base, corrected an inherited release-checkout assertion that expected a missing package although the harness pins that package for old release tests. All 121 cross-version tests now pass locally. The file-explorer scan-count correction was also adopted on main while CI ran; the final merge uses main's identical two-scan assertion. All 14 tests pass. Three reviewers rechecked the updated base and found no remaining issues.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Uses existing Git commands and ref validation, without additional subprocesses or a larger scan. Capabilities protect independently updated clients and hosts. No platform-specific UI, paths, or shortcuts were added.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Full CI passed on
d80254a8d9e86bef60afb45fa15071b4af67e95f, including all five unit shards, Git/wire compatibility, packaging, and platform smoke checks. After resolving concurrent upstream test wording, all three reviewers rechecked the merge; 235 focused tests, 121 cross-version tests, typecheck, and the quality gate passed again.The focused tests, typecheck, changed-code gate, and desktop build were run locally.