Repository navigation
Seed Cmd-J filter from sidebar scope - #19036
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (16)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe 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 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)
✅ Passed checks (3 passed)
Full details: Description checkExplanation 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 Full details: Docstring CoverageExplanation 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.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
ℹ️ No blocking issues — one naming nit inline and one behavior note below.
Reviewed changes
- Repo-granular filter —
PaletteFilterState.projectKeysreplaced byrepoIds; 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 andfilterRepoIdson every open; filter edits stay ephemeral and reseed on reopen.reconcilePaletteFilter()and the per-field selection cap are removed. - Host-resolution rework —
hostIdsByRepoIdbecomes aSet(shared repo IDs across hosts), with arepoByIdlast-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?DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
c43e869 to
c4a20d3
Compare
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.
|
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. |
c4a20d3 to
ccbf07a
Compare
* 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

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
PaletteFilterStatereplacedprojectKeyswithrepoIdsbuildPaletteFilterFromSidebarScope()to seed filters from sidebar host and repository selectionsreconcilePaletteFilter()logic and per-field selection caps (no longer needed)hostIdsByRepoId(Set) instead of singular mapping to handle shared repo IDs across hostsTesting
Notes