Skip to content

Add Archive, Delete and Notifications to sidebar multi-select - #6221

Merged
ymichael merged 5 commits into
mainfrom
bb/sidebar-menu-item-source-logic-thr_rwzw5dm2xs
Oct 26, 2026
Merged

ymichael merged 5 commits into
mainfrom
bb/sidebar-menu-item-source-logic-thr_rwzw5dm2xs

Conversation

@ymichael

@ymichael ymichael commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The sidebar's multi-select menu (sidebarMultiSelect experiment) was a hardcoded component in the thread-list plugin. Plugin thread actions such as push-notifications' Notifications could not appear in it, and it had no Delete. Its Archive called sdk.threads.archive directly for each thread. That skipped core's archive flow, so selecting a parent archived all of its children without the child-thread confirmation, even with that setting on, and it never ran core's pane cleanup and route repair. Separately, the single-thread delete dialog counted only direct children, although delete removes the whole tree.

What changed

  • Plugin SDK (0.6.81 → 0.6.82):
    • Thread action registrations can add experimental_bulkItem({ threads, data, sdk, navigate }).
    • experimental_ThreadActionsContextMenu takes experimental_bulkThreads and onEscapeKeyDown. With 2+ threads it shows a "N threads selected" bulk menu; otherwise it shows the normal menu. A row keeps a single Radix menu, so joining or leaving a selection doesn't remount it.
    • The registration collector keeps and validates experimental_bulkItem.
    • The test fake takes threadBulkActions.
  • Core actions:
    • Mark read/unread, Pin/Unpin, Archive (Unarchive when every selected thread is archived) and Delete have bulk items.
    • Archive and Delete go through new requestArchiveThreads / requestDeleteThreads in ThreadActionsProvider, which single-thread archive and delete also use.
    • Each asks once per selection, acts on the topmost selected threads only, and cleans up panes and routes once. Single and bulk archive use the same planner, confirmation, and executor; only toast presentation varies for a single thread. Archive shares pane cleanup, route repair, and sequential parent-first Undo with environment-group archive. The single-thread toast retains its clickable title.
    • Child checks finish before archive starts, so rows stay visible while planning. The mutation no longer has a separate child-summary/confirmation exception path.
  • Counting what goes with a thread: new POST /threads/cascade / sdk.threads.experimental_listCascade({ threadIds, action }) returns the visible threads that archiving or deleting each thread would also affect. It's built on the same helpers as archive-all and delete, so single-thread and bulk dialogs count the same way, lifecycle-owned threads included. Single-thread delete now counts the whole tree instead of direct children.
  • Plugins:
    • thread-list's Move to section and push-notifications' Notifications have bulk items.
    • The thread list passes its selection to the host menu with a Clear selection item.
    • Threads that disappear from the sidebar are dropped from the selection. Clicking empty sidebar space also clears selection; thread rows and menus preserve it.
  • Docs: docs/api_to_audit.md (bulk items, experimental_listCascade), docs/configuration.md, the plugin-authoring guide (bulk docs live in frontend-sidebar-navigation.md because frontend-registration.md is at its 500-line cap), and the Plugin Guide surface.
  • Unchanged: no server/daemon wire change and no HOST_DAEMON_PROTOCOL_VERSION bump; the new route is additive. No CLI change: per-thread bb thread archive/delete and bb push-notifications thread already cover these actions.

How you verified

  • CI exposed Pin mock state leaking between menu tests; reset mock implementations between tests and give the bulk-action test its own Pin response. All 59 menu tests pass (1 skipped), with lint and typecheck passing.

  • Archive consolidation (bdccf5e15b): all 6,336 app tests, lint, and typecheck pass via pnpm exec turbo run test typecheck --filter=@bb/app plus the lint task in the same run. Shared single/multiple/environment Undo coverage proves parents finish restoring before descendants; the single-thread case fails on the previous implementation. Browser checks on the rebuilt preview confirmed single-parent and bulk archive dialogs, affected IDs, complete Undo restoration, and return navigation. Production code shrank by 127 lines.

  • Empty-sidebar follow-up (78bc4b82b6): the regression fails before the fix; all 474 thread-list tests, lint, and typecheck pass afterward. Rebuilt the worktree preview and verified with real browser clicks that two selected rows become zero after clicking empty sidebar space.

  • CI on the rebased commit (824968a715): 47 checks pass, 4 intentionally skipped, no failures or pending checks.

Rebased onto origin/main (e85d817479), with Plugin SDK 0.6.82 and the matching thread-list minimum. The previous Connect recovery failure is covered by the upstream fix in #6246; all 92 Connect tests pass locally after rebasing.

  • pnpm exec turbo run typecheck lint test for @bb/server, @bb/server-contract, @bb/sdk, @bb/app, @get-bb/plugin-sdk, bb-plugin-thread-list, bb-plugin-push-notifications, bb-plugin-plugin-api-docs, bb-plugin-bb-guide, @bb/connect-next: all 34 Turbo tasks pass after rebasing (server 3,690, app 6,333, Connect 92). oxfmt --check is clean.
  • New tests:
    • The server cascade route matches child-summary, what archive-all archives, and what delete removes.
    • Bulk menu contract on desktop and compact.
    • Provider bulk and single archive/delete flows.
    • Collector keeps experimental_bulkItem; this test fails without the fix.
    • Two-row ThreadRow bulk menu; this test fails with a stale prop name.
    • Bulk Move and Notifications.
  • Ran pnpm start:worktree with a seeded fixture and drove it with real browser input plus the bb CLI: 17/17 checks pass. Each bulk action was clicked in the UI and its effect read back through the CLI/API: read, pin, notifications, move, archive with one confirmation and Undo, delete cancel and confirm.
  • Before/after screenshots against the base commit using the same fixture. Running the app caught three bugs that unit tests missed, all fixed with regression tests: nested context-menu trigger props being dropped, the collector stripping the new field, and a stale prop behind an untyped spread.

AGENT GENERATED

ymichael and others added 2 commits October 26, 2026 10:02
The sidebar's multi-select menu was hardcoded in the thread-list plugin, so
it could not offer plugin actions such as Notifications, had no Delete, and
archived selections through `sdk.threads.archive` directly, which skipped the
child-thread confirmation, pane cleanup and route repair that single-thread
archive runs.

Thread actions can now provide `experimental_bulkItem`, and
`experimental_ThreadActionsContextMenu` takes `experimental_bulkThreads` to
show those items for a multi-row selection. Core's Mark read, Pin, Archive
and Delete, thread-list's Move to section, and push-notifications'
Notifications provide bulk items. Archive and Delete go through new
multi-thread flows in ThreadActionsProvider that single-thread archive and
delete share: one confirmation per selection, actions on the topmost selected
threads only, one pane and route cleanup pass, and one Undo toast for
archive.

Dialog counts come from a new `POST /threads/cascade` query
(`sdk.threads.experimental_listCascade`) built on the same helpers the
archive and delete routes use, so single-thread and bulk dialogs count
every thread the action will take. Single-thread delete previously counted
direct children only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/sidebar-menu-item-source-logic-thr_rwzw5dm2xs branch from 4750588 to 824968a Compare October 26, 2026 17:02
@ymichael
ymichael merged commit 7639aa4 into main Oct 26, 2026
95 of 96 checks passed
@ymichael
ymichael deleted the bb/sidebar-menu-item-source-logic-thr_rwzw5dm2xs branch October 26, 2026 17:45
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