Skip to content

fix(sidebar): keep folder project roots visible when hiding the default branch - #37444

Merged
AmoabaKelvin merged 2 commits into
mainfrom
fix/folder-root-hide-default-branch
Nov 2, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
fix/folder-root-hide-default-branch

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​38 $\color{#cf222e}{\Huge{\mathbf{−}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 0

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

  • 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.

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.

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)

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed checks: 4 passed
Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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.

Share

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

Follow-up Comments

Nitpick Exercise a nonempty branch in the runtime summary fixture.

163-169: Trivial · Functional Correctness · Quick win

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.

Suggested fix
-      row('folder-root', { repoId: 'folder-repo', isMainWorktree: true, branch: '', head: '' })
+      row('folder-root', {
+        repoId: 'folder-repo',
+        isMainWorktree: true,
+        branch: 'refs/heads/main',
+        head: ''
+      })

Open the source location


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fba8dc37-73bf-46c1-8494-cc39437f96c2
Commits

Reviewing files that changed from the base of the PR and between 1ce7960 and 91f5120.

Files selected for processing: 6
  • src/main/runtime/runtime-worktree-ps-summaries.test.ts
  • src/renderer/src/components/sidebar/add-repo-skip-finalization.test.ts
  • src/renderer/src/components/sidebar/default-branch-folder-project-root.test.ts
  • src/renderer/src/components/sidebar/sidebar-filter-state.test.ts
  • src/renderer/src/components/sidebar/workspace-view-evaluator-parity.test.ts
  • src/shared/worktree/workspace-kinds.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.

@AmoabaKelvin
AmoabaKelvin merged commit a444233 into main Nov 2, 2026
48 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.

[Bug]: "Hide default branch" always hides folder projects

2 participants