Skip to content

fix(sidebar): "Hide default branch" hides a folder project's root workspace - #22744

Merged
OrcaWin merged 5 commits into
mainfrom
fix/hide-default-folder-project-root
Sep 26, 2026
Merged

OrcaWin merged 5 commits into
mainfrom
fix/hide-default-folder-project-root

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​228 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​211
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​30 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15

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

  • I manually tested these changes locally
  • Automated tests added/updated

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 with ORCA_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

  • Not applicable; no upstream skill material is copied.

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

  • This PR is small and focused
  • Explained the user-facing change, mechanism, and choice of approach
  • Visual-proof limitation explained
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and folder workspace behavior considered
  • Targeted tests, renderer typecheck, changed-code quality, and formatting pass; full test and build coverage comes from CI

m4air added 2 commits September 24, 2026 17:53
…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.

@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

  • Folder-project roots now follow "Hide default branch" — isDefaultBranchWorkspace (src/renderer/src/components/sidebar/default-branch-workspace.ts:6) takes the project and returns true when the row is a main checkout and either branch !== '' or isFolderRepo(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, with repoMap added to the memo deps), use-filters.ts:99 (reveal), and add-repo-skip-finalization.ts:39 (state now carries repos).
  • Tests — new default-branch-folder-project-root.test.ts plus updates to sidebar-filter-state, visible-worktrees, default-branch-visible-under-hide-sleeping, and add-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.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: cbe1d160-8876-4d22-a1a3-1ba3de21f24f

📥 Commits

Reviewing files that changed from the base of the PR and between 705cde2 and fda8eff.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: 87febb67-7e20-4372-be67-3d83c417cd15

📥 Commits

Reviewing files that changed from the base of the PR and between c264f51 and 705cde2.

📒 Files selected for processing (3)
  • src/renderer/src/components/sidebar/add-repo-skip-finalization.test.ts
  • src/renderer/src/components/sidebar/add-repo-skip-finalization.ts
  • src/renderer/src/components/sidebar/default-branch-folder-project-root.test.ts

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


📝 Walkthrough

Walkthrough

The 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 705cd

Archived sibling workspaces no longer prevent Skip from revealing an imported root. No actionable merge-blocking risk remains after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 705cd

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
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced behavioral reach is renderer workspace navigation and shared filter preferences, not a newly reachable service or privileged sink.

Trust Boundaries and Controls

  • observed — Repository kind is supplied from renderer-held repository data. If that data is absent, the new empty-branch folder condition does not classify the row as a default workspace; the inspected project-added path first attempts repository hydration.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the user impact, implementation, rationale, testing, limitations, and compatibility considerations. However, the Linked Issue section provides Slack report links instead of th… Add the issue tracker reference that this pull request fixes, using the required Fixes #<issue-number> format.
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: the Hide default branch filter now hides a folder project's root workspace.
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.
Full details: Description check

Explanation

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 Fixes # format.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 4adf9e66-92b3-492d-b237-556e24606ebb

📥 Commits

Reviewing files that changed from the base of the PR and between 9678dfb and c264f51.

📒 Files selected for processing (10)
  • src/renderer/src/components/sidebar/add-repo-skip-finalization.test.ts
  • src/renderer/src/components/sidebar/add-repo-skip-finalization.ts
  • src/renderer/src/components/sidebar/default-branch-folder-project-root.test.ts
  • src/renderer/src/components/sidebar/default-branch-visible-under-hide-sleeping.test.ts
  • src/renderer/src/components/sidebar/default-branch-workspace.ts
  • src/renderer/src/components/sidebar/sidebar-filter-state.test.ts
  • src/renderer/src/components/sidebar/visible-worktrees.test.ts
  • src/renderer/src/components/sidebar/visible-worktrees.ts
  • src/renderer/src/components/sidebar/worktree-list/listing/use-filters.ts
  • src/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))

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.

🎯 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)))

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.

🎯 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.ts

Repository: 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 320

Repository: 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 320

Repository: 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 240

Repository: 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.ts

Repository: 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.ts

Repository: 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.

@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

  • Archived siblings no longer suppress the post-Skip reveal — finalizeImportedRepoAfterSkip (src/renderer/src/components/sidebar/add-repo-skip-finalization.ts:24) filters isArchived rows out of importedWorktrees before both the "Hide default branch" check and the "Hide sleeping" exemption check, mirroring the unconditional archived filter in computeVisibleWorktrees (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:120 covers a folder root with an archived sibling (both root-archived and root-visible branches, with exact toHaveBeenCalledWith/not.toHaveBeenCalled assertions), and default-branch-folder-project-root.test.ts:102 pins 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 — isDefaultBranchWorkspace and the four renderer call sites are identical to the previously reviewed c264f51; only the Skip finalization and its tests moved in this delta.

Ran both touched suites: 13/13 pass.

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

@OrcaWin
OrcaWin merged commit df8164f into main Sep 26, 2026
28 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