You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sidebar): keep folder project roots visible when hiding the default branch - #37444
Turning on Hide default branch made a folder (non-Git) project disappear from the sidebar when its root was its only workspace. Folder projects have no branches, so their root now stays visible. Git main checkouts are still hidden.
What Changed
Before: the shared isDefaultBranchWorkspace predicate counted every folder-project root as a default branch, so the filter hid it. Most folder projects have only that root, so the whole project vanished.
After: the predicate returns false for folder projects. It still returns true for a Git main checkout that's on a branch, and still returns false for detached or offline Git mains and provisioned roots.
All consumers read this one predicate, so they all follow the change:
the desktop sidebar filter and reveal action;
the import "skip" path, which no longer turns off Hide default branch when a folder project is added;
the defaultBranch fact the host stamps on worktree.ps rows for phones and paired servers.
The tests that asserted the old hiding are flipped. default-branch-folder-project-root.test.ts is trimmed to the distinct cases.
Why
#22744 hid folder roots on purpose, to match Git behaviour. A Git project only hides its main checkout and its other worktrees stay visible, but a folder project usually has nothing else, so the same rule hides the whole project. Changing the shared predicate keeps desktop, import and the phone feed consistent, where a sidebar-only exception would have left the phone hiding the root.
This is a carry-over and not a push to the contributor's branch because #29895 conflicts with main. Their commit is cherry-picked unchanged, and a test trim is added on top.
From #29895, same predicate change: the real compiled Electron renderer with an isolated profile and hidden windows.
Before: both projects disappear
After: folder root remains, Git main is hidden
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
I ran the focused vitest files, which all pass: default-branch-folder-project-root, sidebar-filter-state, add-repo-skip-finalization, workspace-view-evaluator-parity and runtime-worktree-ps-summaries. I checked that the mobile filter follows the host-stamped defaultBranch fact. Its fallback for old hosts (isMainWorktree && branch !== '') is already false for folder roots. No manual run for this carry-over; the screenshots above come from the contributor's run of the same change.
Risk
The riskiest part is that users who turned on Hide default branch will now see their folder-project roots, which is the intended fix. Git main checkouts are unaffected. A phone paired to an older host keeps that host's old defaultBranch: true stamp, so it hides folder roots until the host updates. Nothing breaks either way. Back out with a plain revert; no saved data or settings change.
Level: Low
AI Disclosure
Review
Two reviewers (Codex and Claude) each ran one round on the full diff, and neither found anything. They traced every caller of the predicate, the phone and paired-server row facts, and mixed-version phone/host fallbacks.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The predicate doesn't look at paths, so it's platform-neutral. SSH and paired servers stamp the same fact through getWorkspaceRowKindFacts.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
The default-branch predicate now requires a nonempty branch and excludes folder repositories. Sidebar tests expect folder roots to remain visible when “Hide default branch” is enabled, including roots with a main branch. Git main checkouts remain hidden. Tests for add-repository behavior and runtime summaries also reflect the updated classification.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 91f51
No merge-blocking defect was established. Runtime coverage should include folder roots with a nonempty branch.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title names the main change: folder project roots stay visible when Hide default branch is enabled. It matches the predicate change in workspace-kinds.ts and the flipped tests. It uses a conventio…
Description check
The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #29720), Visual Proof with before and after images, Testing, Risk with level Low and a reve…
Linked Issues check
Issue [#29720] requires a folder-project root to remain visible when Hide default branch is enabled. The shared isDefaultBranchWorkspace predicate now returns false for folder repositories. The focu…
Out of Scope Changes check
The pull request changes one shared default-branch predicate and updates focused tests for the linked behavior. The predicate is shared by the sidebar and host row facts, so the related import and pho…
Full details: Title check
Explanation
The title names the main change: folder project roots stay visible when Hide default branch is enabled. It matches the predicate change in workspace-kinds.ts and the flipped tests. It uses a conventional fix(sidebar) prefix and is specific, so a teammate scanning history would understand the primary change.
Full details: Description check
Explanation
The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #29720), Visual Proof with before and after images, Testing, Risk with level Low and a revert path, Review, Notes, and Checklist. The Testing section lists the focused vitest files and states that no manual run was done for this carry-over. Remaining gaps are minor. The AI Disclosure section is empty, although the template allows it for external contributors and the author is not a stablyai team member. The final lint/typecheck/test/build checklist item is unchecked, and the author explains that CI covers it.
Full details: Linked Issues check
Explanation
Issue [#29720] requires a folder-project root to remain visible when Hide default branch is enabled. The shared isDefaultBranchWorkspace predicate now returns false for folder repositories. The focused sidebar tests cover a folder root as the only workspace, a root with an instance, a folder added from a Git subdirectory, and a mixed Git/folder project. The tests also confirm that Git main checkouts remain hidden and detached or offline Git mains remain visible. The change also updates the host row fact through the shared predicate, which preserves the stated cross-surface behavior.
Full details: Out of Scope Changes check
Explanation
The pull request changes one shared default-branch predicate and updates focused tests for the linked behavior. The predicate is shared by the sidebar and host row facts, so the related import and phone or paired-server behavior is within scope. No unrelated production behavior or unrelated test area is shown in the reviewed changes.
Full details: Docstring Coverage
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 6 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Autofix · 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.
Exercise a nonempty branch in the runtime summary fixture.
The current empty branch makes defaultBranch false without using the folder repository kind. If the runtime caller stops forwarding that kind, this test still passes.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Carries over #29895 by @rotirotirafa.
ELI5
Turning on Hide default branch made a folder (non-Git) project disappear from the sidebar when its root was its only workspace. Folder projects have no branches, so their root now stays visible. Git main checkouts are still hidden.
What Changed
isDefaultBranchWorkspacepredicate counted every folder-project root as a default branch, so the filter hid it. Most folder projects have only that root, so the whole project vanished.defaultBranchfact the host stamps onworktree.psrows for phones and paired servers.default-branch-folder-project-root.test.tsis trimmed to the distinct cases.Why
#22744 hid folder roots on purpose, to match Git behaviour. A Git project only hides its main checkout and its other worktrees stay visible, but a folder project usually has nothing else, so the same rule hides the whole project. Changing the shared predicate keeps desktop, import and the phone feed consistent, where a sidebar-only exception would have left the phone hiding the root.
This is a carry-over and not a push to the contributor's branch because #29895 conflicts with main. Their commit is cherry-picked unchanged, and a test trim is added on top.
Linked Issue
Fixes #29720
Linear: STA-10835
Visual Proof
From #29895, same predicate change: the real compiled Electron renderer with an isolated profile and hidden windows.
Testing
I ran the focused vitest files, which all pass:
default-branch-folder-project-root,sidebar-filter-state,add-repo-skip-finalization,workspace-view-evaluator-parityandruntime-worktree-ps-summaries. I checked that the mobile filter follows the host-stampeddefaultBranchfact. Its fallback for old hosts (isMainWorktree && branch !== '') is already false for folder roots. No manual run for this carry-over; the screenshots above come from the contributor's run of the same change.Risk
The riskiest part is that users who turned on Hide default branch will now see their folder-project roots, which is the intended fix. Git main checkouts are unaffected. A phone paired to an older host keeps that host's old
defaultBranch: truestamp, so it hides folder roots until the host updates. Nothing breaks either way. Back out with a plain revert; no saved data or settings change.Level: Low
AI Disclosure
Review
Two reviewers (Codex and Claude) each ran one round on the full diff, and neither found anything. They traced every caller of the predicate, the phone and paired-server row facts, and mixed-version phone/host fallbacks.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The predicate doesn't look at paths, so it's platform-neutral. SSH and paired servers stamp the same fact through
getWorkspaceRowKindFacts.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)