feat(sidebar): filter tasks by workspace type#3248
Conversation
Add a "Task type" section to the tasks sidebar filter menu with multi-select checkboxes for worktree, local, and cloud tasks. Classification uses Workspace.mode, falling back to the cloud run environment. Tasks with an unknown mode always stay visible. Generated-By: PostHog Code Task-Id: 19431e3f-90a3-4440-910d-33b5ce011955
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Generated-By: PostHog Code Task-Id: 19431e3f-90a3-4440-910d-33b5ce011955
…ve source Address review feedback: make ALL_WORKSPACE_MODES and the filter menu's TASK_TYPE_OPTIONS derive from Record<WorkspaceMode, ...> so adding a mode to the schema forces a compile error instead of silently drifting. Parameterize the filterByWorkspaceMode tests with it.each. Add a comment clarifying that the latest_run cloud fallback mostly only matters in the showAllUsers view. Generated-By: PostHog Code Task-Id: 19431e3f-90a3-4440-910d-33b5ce011955
Group the worktree/local/cloud checkboxes under an "Environment" submenu with per-mode icons, positioned at the bottom of the filter menu. Generated-By: PostHog Code Task-Id: 9bca5aa3-3b30-4dfe-a09c-cc2a2832f979
…asks-by-workspace-mode # Conflicts: # packages/core/src/sidebar/buildSidebarData.ts
|
Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
| tasks: TaskData[], | ||
| enabledModes: readonly WorkspaceMode[], | ||
| ): TaskData[] { | ||
| if (enabledModes.length >= ALL_WORKSPACE_MODES.length) return tasks; |
There was a problem hiding this comment.
The short-circuit compares array lengths rather than checking that all current modes are actually present in
enabledModes. If a mode is ever removed from WorkspaceMode (e.g., going from 3 → 2 modes), a user with 3 persisted entries satisfies 3 >= 2 and bypasses the filter entirely — showing tasks for modes they thought they had disabled. Using ALL_WORKSPACE_MODES.every(m => enabledModes.includes(m)) checks for actual set membership instead.
| if (enabledModes.length >= ALL_WORKSPACE_MODES.length) return tasks; | |
| if (ALL_WORKSPACE_MODES.every((m) => enabledModes.includes(m))) return tasks; |
Problem
No way to filter the tasks sidebar by where a task runs. When you have a mix of worktree, local, and cloud tasks, the list gets noisy and there's no way to narrow it to just the type you care about.
Changes
Workspace.mode, falling back to the cloud run environment when there's no local workspace.Unchecking all three leaves only unknown-mode tasks visible (literal filter semantics).
How did you test this?
@posthog/core+@posthog/uitypecheck cleanfilterByWorkspaceMode(4 cases) -- all pass via vitestbiome lintclean on changed files, nonoRestrictedImportsAutomatic notifications