Skip to content

fix(sidebar): keep the Projects filter when a project is added - #20987

Merged
OrcaWin merged 1 commit into
mainfrom
jinjing/sta-7588-other-can-we-keep-filtered-projects-after-adding-new-project
Sep 16, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
jinjing/sta-7588-other-can-we-keep-filtered-projects-after-adding-new-project

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​50
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8

ELI5

If you filter the sidebar to some projects and then add a new one, Orca used to throw that filter away and show every project. Now it keeps your selection and just adds the new project to it.

What Changed

The Projects filter is an allow-list of repo ids. Both "reveal the newly added project" paths made it visible by clearing filterRepoIds:

  • add-repo-skip-finalization.ts (skip / no-default-checkout handoff)
  • worktree-activation.ts step 5 (default-checkout handoff)

Those now share revealRepoInProjectFilter, which widens the allow-list instead of wiping it: append the repo id, no-op when it is already selected, and no-op when no filter is active (adding an id there would turn "show everything" into "show only this project").

Boolean reveal rules in the same block (showActiveOnly, hideDefaultBranchWorkspace, automation/CLI/detached-head hiding) still flip off as before — there is nothing to widen.

Why

STA-7588: filtering to projects A and B, then adding C, dropped the user back to every project. Revealing a repo only needs that repo added to the allow-list.

Linked Issue

Fixes STA-7588

Related community PR: #20393 by @jeongph (sibling: keep Hide default branch on when adding a project). Closing that PR; we'll give author credit for the commit.

Visual Proof

N/A — no new UI. This is filter-state on add-project: the Projects allow-list is widened instead of cleared. Covered by unit tests.

Testing

  • Targeted unit tests re-run after the prior session (project-filter-reveal, add-repo-skip-finalization, project-added-default-checkout, worktree-activation-created-agent): 40 passed
  • Automated tests added/updated:
    • project-filter-reveal.test.ts — preserve selection / no-op when unfiltered / already selected
    • existing skip-finalization, default-checkout, and activation tests updated off the old wipe assertion

Platform: unit tests (renderer). No live SSH session.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Renderer-only. No path, shortcut, process, or wire changes. Folder workspaces go through the same reveal paths.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

Adding a project wiped the Projects filter: both reveal paths made the
new project visible by clearing filterRepoIds outright, so a user
filtered to A and B was dropped back to every project.

The filter is an allow-list, so revealing a repo only needs that repo
added to it. revealRepoInProjectFilter widens the selection instead,
and no-ops while the filter is off, where adding an id would turn
"show everything" into "show only this project".

STA-7588
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: 82504b7e-41b3-4837-a7b6-eb7a8291a5f3

📥 Commits

Reviewing files that changed from the base of the PR and between e39b432 and b9a9acb.

📒 Files selected for processing (7)
  • 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/project-added-default-checkout.test.ts
  • src/renderer/src/components/sidebar/project-filter-reveal.test.ts
  • src/renderer/src/components/sidebar/project-filter-reveal.ts
  • src/renderer/src/lib/worktree-activation-created-agent.test.ts
  • src/renderer/src/lib/worktree-activation.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change adds ProjectFilterRevealState and revealRepoInProjectFilter. The helper appends a repository ID to an active filter and skips updates for empty or already-inclusive filters. Imported repository finalization and worktree activation now use the helper. Related tests now expect existing filter IDs to remain and add coverage for empty filters. A project checkout test also expects the previous repository ID to remain in the filter.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b9a9a

The change preserves active project selections during repository reveal flows, and no concrete merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preserving the Projects filter when a project is added.
Description check ✅ Passed The description is complete and aligned with the template. It includes the ELI5 summary, change details, rationale, linked issue, visual-proof explanation, testing evidence, platform scope, and comple…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


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.

@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

  • Widen instead of wipe the Projects allow-list — new revealRepoInProjectFilter (project-filter-reveal.ts) appends the repo id, no-ops when already selected, and no-ops when the allow-list is empty (appending there would flip "show everything" into "show only this").
  • Both reveal paths rewired — finalizeImportedRepoAfterSkip (add-repo-skip-finalization.ts) and activateAndRevealWorktree step 5 (worktree-activation.ts) now share that helper; boolean reveal rules are unchanged.
  • Tests cover the new contract — project-filter-reveal.test.ts pins append / empty no-op / already-selected no-op, and the three integration assertions were moved off the old setFilterRepoIds([]) wipe.

The filterRepoIds.length === 0 → unfiltered invariant matches every consumer (visible-worktrees.ts:140, empty-project-placeholder-repos.ts:16, palette seeding at palette-filter.ts:98). I verified the assertions would fail against the old wipe behavior: 40 targeted tests pass, pnpm tc:web is clean, and check:code-quality:changed reports 0 findings. One non-blocking note: step 5 is the generic activation path, so widening also applies to non-add activations (notifications, deep links, automations) that pass clearSidebarFilters !== false. That is deliberate per the PR body, and the prior behavior also mutated this persisted filter (by clearing it), so no regression.

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

@OrcaWin
OrcaWin merged commit 07b7687 into main Sep 16, 2026
29 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…yai#20987)

Adding a project wiped the Projects filter: both reveal paths made the
new project visible by clearing filterRepoIds outright, so a user
filtered to A and B was dropped back to every project.

The filter is an allow-list, so revealing a repo only needs that repo
added to it. revealRepoInProjectFilter widens the selection instead,
and no-ops while the filter is off, where adding an id would turn
"show everything" into "show only this project".

STA-7588

Co-authored-by: m4air <[email protected]>
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