Skip to content

fix(sidebar): keep folder roots visible when hiding default branch - #29895

Closed
rotirotirafa wants to merge 1 commit into
stablyai:mainfrom
rotirotirafa:fix/29720-keep-folder-project-roots-visible
Closed

rotirotirafa wants to merge 1 commit into
stablyai:mainfrom
rotirotirafa:fix/29720-keep-folder-project-roots-visible

Conversation

@rotirotirafa

@rotirotirafa rotirotirafa commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Turning on Hide default branch makes a folder project disappear when its root is its only workspace. Folder projects have no branches, so this change keeps their roots visible while continuing to hide Git main checkouts.

What Changed

The shared isDefaultBranchWorkspace predicate excludes folder projects, including roots that carry Git branch metadata. Desktop filtering, reveal/import actions, and execution-host row facts now use the corrected classification. Tests cover single-root folders, POSIX/Windows paths and SSH metadata, additional workspaces, lineage, detached/offline Git roots, import preferences, and runtime summaries.

Why

This revisits #22744 as requested in #29720: hiding a folder's only workspace removes the whole project. Correcting the shared classification keeps consumers consistent instead of adding a sidebar-only exception. Existing Git and provisioned-root exceptions remain intact.

Linked Issue

Fixes #29720

Visual Proof

Real compiled Electron renderer, same disposable projects, isolated profile, light theme and 1470 × 923 CSS-pixel window. All BrowserWindows remained hidden throughout; screenshots came through Playwright/CDP.

Before: both projects disappear After: folder root remains, Git main is hidden
Before After

The before renderer was compiled using the base predicate, then the fixed source and renderer were restored. Toggling the real switch off shows both roots; toggling it on keeps only the folder root after the fix. An archived folder root remains excluded. Sidebar and controls fit within the viewport.

Testing

  • Tested the local rendered app using Playwright
  • Automated regression tests added/updated

On macOS ARM64 with Node 24.21.0 and Bun 1.4.3 (pnpm 12.8.1 for lint, tests and build):

  • pnpm run typecheck:ci --bun-concurrency=1 --bun-threads=2: all four projects passed.
  • pnpm lint: the complete lint command passed, including type-aware analysis and all repository gates.
  • pnpm test src/renderer/src/components/sidebar src/main/runtime/runtime-worktree-ps-summaries.test.ts src/shared/workspace-view --maxWorkers=2: 3,186 passed, one benchmark test skipped, zero failures across 374 files.
  • pnpm run build:electron-vite --mode e2e: main, preload and renderer built successfully; renderer boot-graph verification passed. The final fixed renderer was rebuilt after capturing the base behavior.
  • Formatting and git diff --check passed. Regression failures were confirmed before the fix.

A full-suite attempt was stopped after recording eight failures in three files; all eight were reproduced on base commit 93a5a1a20a2c. Two compare macOS /var/... temporary paths with their canonical /private/var/... form, and six involve development rebuild watchers. Re-running all three affected files with TMPDIR=/private/tmp passed: 1,440 passed, one skipped, zero failures (src/main/runtime/orca-runtime.test.ts, config/scripts/process-host-dev-rebuild.test.ts, and src/main/cli/packaged-cli-assets.test.ts). Combined with the completed sidebar/workspace-view run, 4,626 tests passed in these two non-overlapping runs. The entire test suite was not completed.

Full cross-platform CI is waiting for maintainer approval of this fork's workflows. Native Windows/Linux and live SSH were not exercised locally; paths and SSH identity are covered by fixtures. Release packaging and the separate mobile bundle were not built locally.

AI Disclosure

Prepared with OpenAI Codex assistance.

Review

Self-review: one constant-time classification expression changes in production. The rule is independent of OS, coding agent, integration and Git provider. Local and remote consumers share it; no new filesystem, credential, subprocess or network access is introduced. The existing boolean wire field needs no new client capability; older execution hosts retain their behavior until updated. Actual workspace visibility was checked in the hidden Electron renderer; no styling, layout or shortcut changes are included.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied or translated.

Notes

Author: @rotirotirafa. X/Twitter handle not provided.

Checklist

  • This PR is small and focused
  • Explained the user-facing before/after, mechanism and approach
  • Before/after screenshots attached
  • Self-reviewed for correctness, security and performance
  • Cross-platform, SSH/remote and path/shortcut impact considered
  • Full local lint and typecheck, relevant tests and Electron build passed; see testing notes for full-suite and CI status

@rotirotirafa
rotirotirafa marked this pull request as ready for review October 17, 2026 00:50
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: a65412e1-4573-43ce-a9e1-8f1d953ac48a
📥 Commits

Reviewing files that changed from the base of the PR and between db0e62f and f9eba8e.

📒 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; 9 remain after this review.

📝 Walkthrough

isDefaultBranchWorkspace now excludes folder repositories and requires a non-empty branch. Updated tests expect folder roots to remain visible when “Hide default branch” is enabled, while Git main checkouts remain hidden. Add-repository tests also expect the setting to remain enabled for folder projects.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to f9eba

Folder roots remain visible when Hide default branch is enabled, while Git and provisioned-root behavior remains unchanged. No material merge risk was identified in the reviewed change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed The change satisfies active issue #29720. isDefaultBranchWorkspace now returns false for folder repositories, including folder roots with branch metadata. The shared predicate keeps folder roots vis…
Out of Scope Changes check Passed The pull request stays within #29720. Production changes are limited to the shared workspace classification. Test updates verify the corrected classification and its desktop, import, and runtime-summa…
Title check Passed The title clearly and concisely describes the primary change: keeping folder roots visible when the default branch filter is enabled.
Description check Passed The description covers the required sections, user impact, implementation, rationale, linked issue, visual proof, testing, limitations, and checklist. It explicitly documents incomplete full-suite, cr…
Full details: Linked Issues check

Explanation

The change satisfies active issue #29720. isDefaultBranchWorkspace now returns false for folder repositories, including folder roots with branch metadata. The shared predicate keeps folder roots visible when Hide default branch is enabled. The predicate still hides Git main worktrees with a branch and preserves provisioned-root, detached, and offline exceptions. Tests cover single-root folders, POSIX and Windows paths, SSH metadata, additional workspaces, lineage, and mixed Git and folder projects.

Full details: Out of Scope Changes check

Explanation

The pull request stays within #29720. Production changes are limited to the shared workspace classification. Test updates verify the corrected classification and its desktop, import, and runtime-summary consumers. No unrelated feature, styling, layout, shortcut, filesystem, credential, subprocess, or network changes are present in the reviewed diff.

Full details: Description check

Explanation

The description covers the required sections, user impact, implementation, rationale, linked issue, visual proof, testing, limitations, and checklist. It explicitly documents incomplete full-suite, cross-platform, SSH, packaging, and mobile validation.

  • Fix all pre-merge checks with AI
  • 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

Comment @coderabbitai help to get the list of available commands.

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks @rotirotirafa! Your branch conflicts with main now, so I carried your commit over unchanged in #37444 and added a small test trim on top. You stay the author of the fix.

@nwparker

nwparker commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — your changes were carried over and merged in #37444 (#37444 (a444233103)), which resolved #29720. Thanks for the contribution!

@nwparker nwparker closed this Nov 5, 2026
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

3 participants