Skip to content

Seed Cmd-J filter from sidebar scope - #19036

Merged
AmethystLiang merged 7 commits into
mainfrom
cmd-j-match-sidebar-filter
Sep 6, 2026
Merged

AmethystLiang merged 7 commits into
mainfrom
cmd-j-match-sidebar-filter

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​329 $\color{#cf222e}{\Huge{\mathbf{−}}}$​150 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​185 $\color{#cf222e}{\Huge{\mathbf{−}}}$​206 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21

Problem

The Cmd-J palette filter was project-level granular and opened with no connection to the sidebar's current filters. Users had to re-establish filters every time they opened the palette, and there was no relationship between sidebar and palette filtering states.

Solution

Changed the palette filter to be repository-granular and automatically seed from the sidebar's host and repository scope when it opens. Filter changes are temporary: closing the palette discards them, and the next open reseeds from the current sidebar state. This preserves the sidebar–palette relationship and lets users narrow searches while keeping their sidebar context.

What Changed

  • Palette filter now operates on individual repositories instead of project groupings for more precise filtering
  • PaletteFilterState replaced projectKeys with repoIds
  • Added buildPaletteFilterFromSidebarScope() to seed filters from sidebar host and repository selections
  • Removed reconcilePaletteFilter() logic and per-field selection caps (no longer needed)
  • Filter model now tracks hostIdsByRepoId (Set) instead of singular mapping to handle shared repo IDs across hosts
  • Updated documentation to clarify repository-granular filtering and ephemeral filter behavior

Testing

  • Added unit tests for repository-granular filtering and shared repo ID deduplication
  • Added integration tests for filter seeding on open and intersection of host/repo fields
  • E2E tests verify reseeding from sidebar scope on reopen
  • Recent tabs and workspace filtering work correctly under sidebar-seeded filters

Notes

  • Cross-platform: filter logic is platform-agnostic
  • SSH/remote: sidebar scope includes remote hosts and respects SSH host stamps
  • Folder workspaces compatible: uses same sidebar filtering mechanism

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: ee963eac-31e6-4a7e-8119-241473bd8564

📥 Commits

Reviewing files that changed from the base of the PR and between 1326d6b and c43e869.

📒 Files selected for processing (16)
  • docs/site/content/docs/model/quick-open.mdx
  • docs/site/content/docs/model/worktrees.mdx
  • src/renderer/src/components/WorktreeJumpPalette.recent-tabs.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.test.tsx
  • src/renderer/src/components/cmd-j/PaletteFilterChips.tsx
  • src/renderer/src/components/cmd-j/PaletteFilterMenu.tsx
  • src/renderer/src/components/cmd-j/palette-filter-options.test.ts
  • src/renderer/src/components/cmd-j/palette-filter-options.ts
  • src/renderer/src/components/cmd-j/palette-filter.test.ts
  • src/renderer/src/components/cmd-j/palette-filter.ts
  • src/renderer/src/components/use-worktree-jump-palette-filter.ts
  • src/renderer/src/components/use-worktree-jump-palette-local-state.ts
  • src/renderer/src/components/use-worktree-jump-palette-recent-tabs.ts
  • src/renderer/src/components/use-worktree-jump-palette-selection-lifecycle.ts
  • src/renderer/src/components/worktree-jump-palette-surface.tsx
  • tests/e2e/worktree-jump-palette-filter.spec.ts

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


📝 Walkthrough

Walkthrough

The Worktree Jump Palette now filters by repository IDs instead of project keys. It inherits host and repository scope from the sidebar and reseeds that scope when reopened. Filter options include zero-count hosts and repositories, shared repository IDs, disambiguated labels, and execution-host mappings. Recent-tab ordering updates when filters change. Tests and documentation cover repository filtering, reopen behavior, and sidebar scope.

Merge Risk: ⚪ Minimal · up to c43e8

The repository-scoped palette filtering and sidebar reseeding behavior are covered without an identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, implementation, and testing, but it omits required template sections and information, including ELI5, Why, Linked Issue, Visual Proof or an explicit N/A… Update the description to include all required template sections. Add the linked issue after Fixes #, provide visual proof or write N/A with a reason, complete the testing checklist with platforms and verification details, complete appl…
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 14 files. (2 skipped:… 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: seeding the Cmd-J filter from the sidebar scope.
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 problem, solution, implementation, and testing, but it omits required template sections and information, including ELI5, Why, Linked Issue, Visual Proof or an explicit N/A reason, checklist confirmations, AI Disclosure, and detailed manual testing or platform coverage.

Resolution

Update the description to include all required template sections. Add the linked issue after Fixes #, provide visual proof or write N/A with a reason, complete the testing checklist with platforms and verification details, complete applicable checklist items, and include the required AI Disclosure information when applicable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 14 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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 blocking issues — one naming nit inline and one behavior note below.

Reviewed changes

  • Repo-granular filter — PaletteFilterState.projectKeys replaced by repoIds; the filter menu and chips operate on individual repositories instead of project groupings.
  • Sidebar-scope seeding — buildPaletteFilterFromSidebarScope() seeds host and repo chips from the sidebar's host scope and filterRepoIds on every open; filter edits stay ephemeral and reseed on reopen. reconcilePaletteFilter() and the per-field selection cap are removed.
  • Host-resolution rework — hostIdsByRepoId becomes a Set (shared repo IDs across hosts), with a repoById last-row-wins index mirroring the sidebar.
  • Recent-tabs re-capture — recency re-captures when the filter changes mid-open so cleared chips bring rows back.
  • Tests + docs — new unit, integration, and E2E coverage for seeding, intersection, and shared-ID dedup, plus docs updates.

ℹ️ Stale seeded selections are no longer pruned mid-session

Removing reconcilePaletteFilter means a host or repository that disappears from the catalog while the palette is open (e.g. a remote host disconnects, a repo is removed) leaves a stale chip and an empty result set until the palette is reopened. Seeding on open fixes the "stale id empties the palette forever" case the old reconciler existed for, so this is low impact and self-healing — but it's a small behavioral regression from the previous "drop selections whose host or project disappeared" guarantee. Worth a conscious call that ephemerality alone is the intended safety net.

Technical details
# Stale filter selections after removing reconcilePaletteFilter

## Affected sites
- src/renderer/src/components/cmd-j/palette-filter.ts — `reconcilePaletteFilter` removed.
- src/renderer/src/components/use-worktree-jump-palette-filter.ts — the `useEffect` that pruned `rawFilter` against `filterModel` removed.
- src/renderer/src/components/use-worktree-jump-palette-local-state.ts — filter is seeded only on open (`visibilityChanged && visible`).

## Required outcome
- Confirm that a repo/host disappearing mid-session (async remote disconnect or repo removal) leaving a phantom chip + empty results until reopen is acceptable, since the palette is modal and the sidebar can't drive that change during an open session.

## Open questions for the human (optional)
- Do any non-user, async catalog mutations (remote host loss, runtime shutdown) actually fire while the palette modal is open, and if so is a transient empty result acceptable?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang force-pushed the cmd-j-match-sidebar-filter branch from c43e869 to c4a20d3 Compare September 6, 2026 20:07
When opening Cmd+J, the palette's host and project filters now
initialize from the sidebar's current Show scope, so results
match the user's sidebar view. The palette can still be cleared
or changed per open; sidebar never reads back palette filters.
Let the builder function extract the sidebar scope it needs instead of
requiring callers to destructure and pass individual properties. This
reduces coupling and simplifies the data flow through the palette
initialization lifecycle.
Filter options now list individual repositories instead of grouping
multi-repo projects into single rows. This preserves the exact
repository scope shown in the sidebar when opening Cmd+J, rather than
widening selections to entire projects. Removes per-field selection cap
and stale-value reconciliation, simplifying the filter lifecycle.
- Rename projects→repositories in PaletteFilterModel for semantic accuracy
- Rename rawFilter→filterState for clearer intent
- Initialize filter from sidebar scope in local state, refresh on open
- Remove redundant filter reset from selection lifecycle
The palette now opens with the sidebar's host and repository scope
applied. Filter changes are temporary: closing discards them, and
reopening reseeds from the sidebar's current state.

- Repository filtering is now granular (individual repos)
- Support shared repository IDs across multiple hosts
- Disambiguate duplicate repository names by path
Document the naming convention for repository-granular filter choices to help future maintainers understand why "Projects" is used as the user-facing term.
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@AmethystLiang
AmethystLiang force-pushed the cmd-j-match-sidebar-filter branch from c4a20d3 to ccbf07a Compare September 6, 2026 20:07
@AmethystLiang
AmethystLiang merged commit 08b96ed into main Sep 6, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* feat(palette): seed Cmd+J filter from sidebar show scope

When opening Cmd+J, the palette's host and project filters now
initialize from the sidebar's current Show scope, so results
match the user's sidebar view. The palette can still be cleared
or changed per open; sidebar never reads back palette filters.

* refactor: pass app state to palette filter builder

Let the builder function extract the sidebar scope it needs instead of
requiring callers to destructure and pass individual properties. This
reduces coupling and simplifies the data flow through the palette
initialization lifecycle.

* Make palette filter repo-granular to preserve sidebar scope

Filter options now list individual repositories instead of grouping
multi-repo projects into single rows. This preserves the exact
repository scope shown in the sidebar when opening Cmd+J, rather than
widening selections to entire projects. Removes per-field selection cap
and stale-value reconciliation, simplifying the filter lifecycle.

* Clarify filter naming and seed from sidebar scope on palette open

- Rename projects→repositories in PaletteFilterModel for semantic accuracy
- Rename rawFilter→filterState for clearer intent
- Initialize filter from sidebar scope in local state, refresh on open
- Remove redundant filter reset from selection lifecycle

* Seed Cmd-J filter from sidebar scope and reset on close

The palette now opens with the sidebar's host and repository scope
applied. Filter changes are temporary: closing discards them, and
reopening reseeds from the sidebar's current state.

- Repository filtering is now granular (individual repos)
- Support shared repository IDs across multiple hosts
- Disambiguate duplicate repository names by path

* Add comment clarifying Projects terminology

Document the naming convention for repository-granular filter choices to help future maintainers understand why "Projects" is used as the user-facing term.

* Remove redundant Escape press from worktree palette filter test
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