Repository navigation
fix(sidebar): "Hide default branch" hides a folder project's root workspace - #22744
Conversation
…kspace A folder project's root is its main workspace but has no branch, so the non-empty-branch check never matched it. Folder projects can now hold several workspaces, so the root is the same noise the setting hides for git projects. Decide by repo kind so detached-HEAD and offline-SSH git mains stay visible.
…and refresh the entry-point comment
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Folder-project roots now follow "Hide default branch" —
isDefaultBranchWorkspace(src/renderer/src/components/sidebar/default-branch-workspace.ts:6) takes the project and returnstruewhen the row is a main checkout and eitherbranch !== ''orisFolderRepo(repo), closing the gap where folder roots stayed visible. - Git mains with an empty branch are unchanged — detached HEAD and offline-SSH synthesized mains still return
false, so they stay visible as before. - All four renderer callers pass the project —
visible-worktrees.ts:112(drives sidebar, counts and board),use-worktree-jump-palette-worktrees.ts:102(Cmd+J, withrepoMapadded to the memo deps),use-filters.ts:99(reveal), andadd-repo-skip-finalization.ts:39(state now carriesrepos). - Tests — new
default-branch-folder-project-root.test.tsplus updates tosidebar-filter-state,visible-worktrees,default-branch-visible-under-hide-sleeping, andadd-repo-skip-finalization.
I verified the predicate against mergeFolderWorkspace (src/main/ipc/worktrees/folder-workspace-model.ts:29): folder rows are branch: ''/head: '' and only the root id ${repoId}::${path} is isMainWorktree, so the additional isFolderRepo term targets exactly the intended row. Confirmed folder projects reach the shared pipeline through listVisibleFolderWorkspaces (register-worktree-catalog-handlers.ts:99), and that the board and Cmd+J both receive repoMap from state.repos. The new assertions are exact (toEqual on the visible id list) and the PR reports them failing against the pre-fix predicate.
Ran the five touched suites (90/90 pass) and pnpm tc:web (pass). The mobile copy (mobile/src/worktree/workspace-list-sections.ts:56) is intentionally untouched and called out as a follow-up in the description.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe default-workspace predicate now receives repository context. It classifies folder-project roots as default workspaces, including roots with empty branch and head values. Sidebar filters and skipped-import finalization pass the repository to the predicate. Skipped-import finalization excludes archived worktrees from its check. Tests cover folder roots, Git rows, and visibility behavior. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Archived sibling workspaces no longer prevent Skip from revealing an imported root. No actionable merge-blocking risk remains after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change affects which workspaces appear in navigation and how an imported project is revealed. No new security boundary or privileged capability was identified, but some interrupted import paths remain unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the user impact, implementation, rationale, testing, limitations, and compatibility considerations. However, the Linked Issue section provides Slack report links instead of the required issue reference in the ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4adf9e66-92b3-492d-b237-556e24606ebb
📒 Files selected for processing (10)
src/renderer/src/components/sidebar/add-repo-skip-finalization.test.tssrc/renderer/src/components/sidebar/add-repo-skip-finalization.tssrc/renderer/src/components/sidebar/default-branch-folder-project-root.test.tssrc/renderer/src/components/sidebar/default-branch-visible-under-hide-sleeping.test.tssrc/renderer/src/components/sidebar/default-branch-workspace.tssrc/renderer/src/components/sidebar/sidebar-filter-state.test.tssrc/renderer/src/components/sidebar/visible-worktrees.test.tssrc/renderer/src/components/sidebar/visible-worktrees.tssrc/renderer/src/components/sidebar/worktree-list/listing/use-filters.tssrc/renderer/src/components/use-worktree-jump-palette-worktrees.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| importedWorktrees.length > 0 && | ||
| state.hideDefaultBranchWorkspace && | ||
| importedWorktrees.every((worktree) => isDefaultBranchWorkspace(worktree)) | ||
| importedWorktrees.every((worktree) => isDefaultBranchWorkspace(worktree, importedRepo)) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Exclude archived worktrees from the skip visibility decision.
If an imported folder project has a root and an archived non-main workspace, every returns false. computeVisibleWorktrees removes the archived workspace at Line 99 of src/renderer/src/components/sidebar/visible-worktrees.ts and hides the root. The project therefore disappears after Skip. Check the unarchived imported worktrees, with a nonempty guard, before deciding whether to disable default-workspace hiding.
|
|
||
| if (opts.hideDefaultBranchWorkspace) { | ||
| all = all.filter((w) => !isDefaultBranchWorkspace(w)) | ||
| all = all.filter((w) => !isDefaultBranchWorkspace(w, opts.repoMap.get(w.repoId))) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect folder-row creation and the lineage rules used by the visibility pass.
rg -n -C 3 'mergeFolderWorkspace|parentWorktreeId|worktreeLineageById' src/renderer/src/components/sidebar -g '*.ts'
rg -n -C 4 'getLineageAncestorIndex|getLineageRenderInfo|addVisibleLineageAncestors' src/renderer/src/components/sidebar/visible-worktrees.tsRepository: stablyai/orca
Length of output: 41412
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- visible-worktrees.ts ---'
sed -n '80,225p' src/renderer/src/components/sidebar/visible-worktrees.ts
printf '%s\n' '--- lineage projection ---'
sed -n '1,180p' src/renderer/src/components/sidebar/worktree-lineage-projection.ts
printf '%s\n' '--- folder workspace symbols ---'
rg -n -C 5 'mergeFolderWorkspace|FolderWorkspace|folderWorkspace|isEligibleWorktreeParent|parent eligibility' src/renderer/src -g '*.ts' -g '*.tsx' | head -n 320Repository: stablyai/orca
Length of output: 41658
🏁 Script executed:
set -e
printf '%s\n' '--- visible-worktrees.ts ---'
sed -n '80,225p' src/renderer/src/components/sidebar/visible-worktrees.ts
printf '%s\n' '--- worktree-lineage-projection.ts ---'
sed -n '1,180p' src/renderer/src/components/sidebar/worktree-lineage-projection.ts
printf '%s\n' '--- folder and eligibility symbols ---'
rg -n -C 5 'mergeFolderWorkspace|FolderWorkspace|folderWorkspace|isEligibleWorktreeParent|parent eligibility' src/renderer/src -g '*.ts' -g '*.tsx' | head -n 320Repository: stablyai/orca
Length of output: 42077
🏁 Script executed:
set -e
rg -l 'function isEligibleWorktreeParent|const isEligibleWorktreeParent|isEligibleWorktreeParent\s*=' src
rg -l 'mergeFolderWorkspace' src
rg -n -C 12 'isEligibleWorktreeParent|mergeFolderWorkspace' src/renderer/src/components/sidebar src/renderer/src -g '*.ts' -g '*.tsx' | head -n 240Repository: stablyai/orca
Length of output: 26177
🏁 Script executed:
set -e
printf '%s\n' '--- worktree-parent-candidates.ts ---'
sed -n '1,145p' src/renderer/src/components/sidebar/worktree-parent-candidates.ts
printf '%s\n' '--- resolved lineage contract ---'
rg -n -C 8 'isValidResolvedWorktreeLineageEdge' src/shared src/renderer/src -g '*.ts' | head -n 180
printf '%s\n' '--- folder workspace catalog ---'
rg -n -C 12 'mergeFolderWorkspace|isMainWorktree|rootId|folderWorkspace' src/main/ipc/worktrees/listing/folder-workspace-catalog.tsRepository: stablyai/orca
Length of output: 22433
🏁 Script executed:
set -e
printf '%s\n' '--- worktree-parent-candidates.ts ---'
sed -n '1,145p' src/renderer/src/components/sidebar/worktree-parent-candidates.ts
printf '%s\n' '--- resolved lineage helper ---'
rg -n -C 12 'isValidResolvedWorktreeLineageEdge' src/shared src/renderer/src -g '*.ts'
printf '%s\n' '--- folder catalog implementation ---'
rg -n -C 18 'mergeFolderWorkspace|isMainWorktree|rootId' src/main/ipc/worktrees/listing/folder-workspace-catalog.tsRepository: stablyai/orca
Length of output: 29160
🏁 Script executed:
set -e
printf '%s\n' '--- parent assignment rules ---'
sed -n '1,180p' src/renderer/src/components/sidebar/worktree-parent-eligibility.ts
printf '%s\n' '--- folder workspace model ---'
rg -n -C 20 'export function mergeFolderWorkspace|getFolderWorkspaceRootId|isMainWorktree' src/main/ipc/worktrees/folder-workspace-model.ts src/main/ipc/worktrees -g '*.ts'Repository: stablyai/orca
Length of output: 41532
Keep hidden folder roots out of lineage injection.
A folder workspace instance can use its folder root as a valid lineage parent. When hideDefaultBranchWorkspace is enabled, line 112 removes that root, but addVisibleLineageAncestors can add it back through the valid lineage edge. Apply the default-branch exclusion to injected ancestors. Continue traversing excluded parents so other required ancestors remain visible.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Archived siblings no longer suppress the post-Skip reveal —
finalizeImportedRepoAfterSkip(src/renderer/src/components/sidebar/add-repo-skip-finalization.ts:24) filtersisArchivedrows out ofimportedWorktreesbefore both the "Hide default branch" check and the "Hide sleeping" exemption check, mirroring the unconditional archived filter incomputeVisibleWorktrees(visible-worktrees.ts:99). An archived sibling previously made.every(...)false, leaving the imported folder root hidden even though the root was the only visible row. This closes the CodeRabbit thread on that line. - Regression coverage added —
add-repo-skip-finalization.test.ts:120covers a folder root with an archived sibling (both root-archived and root-visible branches, with exacttoHaveBeenCalledWith/not.toHaveBeenCalledassertions), anddefault-branch-folder-project-root.test.ts:102pins the hierarchy exception so a hidden folder root is still re-added as the valid lineage parent of a visible child. - Predicate and callers unchanged from the prior revision —
isDefaultBranchWorkspaceand the four renderer call sites are identical to the previously reviewedc264f51; only the Skip finalization and its tests moved in this delta.
Ran both touched suites: 13/13 pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
“Hide default branch” now hides a folder project's root workspace, just as it hides a git project's main checkout. Other workspaces in the folder project remain visible.
What Changed
The filter previously required a branch name, but folder roots have no branch. It now also checks the project's kind. The sidebar, workspace picker, reveal action, and project-import Skip action use the same rule.
Skip also ignores archived siblings when deciding whether to clear filters, so an archived workspace cannot leave the newly imported project's root hidden.
Why
Folder projects can contain several workspaces, making their root subject to the same filter as a git main checkout. Checking the project kind preserves detached-HEAD and offline SSH git main rows, which also have empty branch names. Removing the branch check entirely would hide those rows too.
The existing hierarchy exception remains: a hidden root is shown when it is the valid parent of a visible workspace, keeping the sidebar tree readable. This matches git-project behavior.
Linked Issue
User reports: https://stablygroup.slack.com/archives/C0B4PDCMPPT/p1790296002671509 and https://stablygroup.slack.com/archives/C0B4PDCMPPT/p1790295986045009.
Visual Proof
N/A — no layout or styling changes. Regression tests compare the exact visible workspace list with the filter enabled. No rendered Electron check was performed.
Testing
Refreshed against main: 118 tests passed across 11 suites, covering folder-root filtering, git detached/offline roots, structural parent visibility, Skip with archived siblings, and adjacent sidebar, board, and workspace-picker behavior. The archived-sibling regression failed before the fix and passed afterward.
pnpm tc:web, changed-code quality, targeted lint, formatting, and whitespace checks passed. Tests ran on macOS withORCA_BACKGROUND_LAUNCH=1.Review
The archived-sibling review finding is addressed. The proposed removal of hidden lineage parents conflicts with the existing tested hierarchy contract; a folder-project regression test preserves that contract.
Agent skill upstream boundary
Notes
No platform branches, host execution, or wire changes. Folder kind works for local, WSL, and SSH projects. The separate mobile filter is unchanged. A folder project with only its root is hidden completely while this filter is on, matching existing git behavior; clearing the filter reveals it.
Checklist