Repository navigation
Assemble the thread list inside the plugin and bring it to benchmark parity - #4039
Merged
SawyerHood merged 4 commits intoSep 22, 2026
Merged
Conversation
SawyerHood
marked this pull request as ready for review
September 22, 2026 01:17
SawyerHood
force-pushed
the
thread-list/3b-list-assembly
branch
from
September 22, 2026 01:38
f90b273 to
83a6a32
Compare
This was referenced Sep 22, 2026
SawyerHood
force-pushed
the
thread-list/3b-list-assembly
branch
from
September 22, 2026 02:02
83a6a32 to
8406acc
Compare
SawyerHood
force-pushed
the
thread-list/3b-list-assembly
branch
2 times, most recently
from
September 22, 2026 02:36
4f624e1 to
8a5ec5e
Compare
Ports the rest of the built-in sidebar onto the plugin's row layer: pinned, custom-section, project, machine, and environment grouping; the header menu with organize, sort, new section, and visibility; hide-from-list and customize; windowing; inline section and project rename; auto-reveal on route change; and the drag-and-drop layer (reorder, nest, pin, move between sections) with the host's drop-target highlighting. app.tsx now renders the plugin's own list instead of Original. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The plugin list rendered 40 to 60 percent slower than the built-in list on status patches, membership refetches, and pins. Two causes: every per-row host hook rebuilt a 3,000-entry thread map on each payload change, and the plugin regrouped every project on every update so all per-project memos ran. The host now caches one entry map per payload behind a WeakMap, and the plugin's grouped data keeps untouched projects and thread arrays by identity across updates. Preference sync attaches to the jotai store the plugin renders in instead of assuming the default store, which is what made the benchmark's plugin scenario stick on the skeleton. The benchmark runs both lists through the same harness and the plan records the numbers. Co-Authored-By: Claude Fable 5.1 <[email protected]>
SawyerHood
force-pushed
the
thread-list/3b-list-assembly
branch
from
September 22, 2026 02:44
8a5ec5e to
5151817
Compare
SawyerHood
added a commit
that referenced
this pull request
Sep 22, 2026
Layer 9 of the thread-list plugin stack. Base: main. #4036 (row layer) and #4039 (list assembly) stack on it. ## Human comments ## What was wrong The plugin list loads as a bundle after boot, so a cold start has nothing to show in the sidebar until the bundle mounts, and the host had no way to tell "still loading" from "no thread list plugin is enabled". There was also no benchmark to hold the plugin list to the built-in list's performance. ## What changed - `apps/app/src/components/sidebar/ThreadListPlaceholder.tsx`: the three sidebar states the flip in the next layers will render: loading skeleton rows, "No thread list plugin is enabled" with a link to Plugins, and "<plugin> stopped working" with a reload button. The flip reads the existing `usePluginFrontendsSettled` hook from `plugin-frontend-boot-state.ts` to pick loading versus missing; nothing in the sidebar imports the loader module statically, because it carries the plugin runtime shims and would pull the on-demand vendors into the boot payload (an earlier revision did exactly that and failed the bundle budget). - `apps/app/src/components/sidebar/sidebar.bench.test.tsx`: gated (`BB_SIDEBAR_BENCH=1`) jsdom benchmark, 3,000 threads, simulated viewport so windowing engages, measuring mount, status patch, membership refetch, and pin. The baseline for the built-in list is in `plans/thread-list-plugin.md`. - `apps/app/src/components/ui/theme.css`: Tailwind source entry for the plugin directory. - `turbo.json`: `@bb/plugin-build#test` waits for the SDK's bundled types so the zod resolution race stops. - `packages/plugin-api-map/test/mobile-guide.test.ts`: 30 s budget for the layout case on loaded runners. An earlier revision of this PR also compiled the thread-list plugin frontend into the app build and seeded it at boot. That path was dropped (last commit): it duplicated the loader for one plugin and needed a localStorage memo to avoid a list-then-blank flash. The placeholder covers the cold start instead. No wire changes, no SDK surface changes. ## How you verified - `ThreadListPlaceholder.test.tsx` covers the three states. - `plugin-frontend*.test.ts` (65 tests) pass with the loader back to main's version. - `pnpm exec turbo run typecheck --filter=@bb/app` - Benchmark run recorded in the plan: built-in mount 694 ms, status patch 183 ms, membership refetch 247 ms, pin 181 ms (bee, jsdom, median of 5). 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 22, 2026
…ugin loads (#4041) Layer 12 of the thread-list plugin stack, stacked on #4039 (list assembly). This is the flip. ## Human comments ## What was wrong The sidebar rendered bb's built-in list first and swapped in the plugin list once its bundle arrived, which showed as a flicker on every load. Keeping two lists had no purpose once the bundled `thread-list` plugin reached parity (#4039): the plugin is bb's list now. ## What changed - `apps/app/src/components/sidebar/PluginThreadList.tsx` mounts the resolved plugin directly through `PluginSlotMount`. With no plugin it renders `ThreadListPlaceholder`: skeleton rows until the existing `usePluginFrontendsSettled` hook (light `plugin-frontend-boot-state.ts`, no loader import, so the boot payload does not grow) reports the deferred boot done, then "No thread list plugin is enabled" with a link to Plugins. A crash shows "<plugin> stopped working" with a Reload button that calls `resetCrashedPluginSlots` and remounts, plus one toast. - `AppSidebar.tsx` no longer builds a built-in list and drops the unused quick-create controller. - `ProjectList` and everything only it reached are deleted from `apps/app` (about 12,900 lines including tests and stories). `SidebarPrimaryActions.tsx` keeps the New thread and Search actions the navigation region still renders; `SectionSidebar` takes its button class from `sidebarRowClasses`. Row and drag modules that other surfaces import (mobile recents, section move provider, settings) stay. - Settings → Appearance → Sidebar offers Automatic and the registered providers; `ReplacementProviderSetting` only adds the built-in option when a description is passed. A stored `__builtin__` value for `sidebar.threadListProvider` is read as Automatic (`threadListProvider.ts`); the preference description in `@bb/domain` and `docs/configuration.md` say so. - `PluginThreadListProps` loses `Original` and `experimental_Original` (nothing to delegate to). Plugin SDK 0.5.7. The guide (`frontend-registration.md`), `docs/api_to_audit.md`, `docs/plugin-sidebar-thread-list.md`, the API map summary, the docs-parity prop list, the plugin's own test fixture, and the `replacement-lab-beta` example are updated. - The benchmark keeps only the plugin scenario; the built-in numbers stay recorded in `plans/thread-list-plugin.md`. No wire changes. ## How you verified - New `PluginThreadList.test.tsx`: loading placeholder until boot settles then missing state; plugin receives the host props and no `Original`; crash shows the crashed placeholder and toast, and Reload remounts a recovered list. - `SidebarThreadListSetting.test.tsx`: no built-in menu item; pinning a plugin stores its key. - `pnpm exec turbo run typecheck --filter=@bb/app --filter=bb-plugin-thread-list --filter=@get-bb/plugin-sdk --filter=@bb/domain --filter=bb-plugin-replacement-lab-beta` - `apps/app`: sidebar, settings, layout, plugin, views, and plugin-* lib suites: 154 files, 1501 tests pass. - `@get-bb/plugin-sdk` (346), `@bb/plugin-api-map` (82), `bb-plugin-thread-list` (297), server plugin docs-parity and builtin-plugin tests (57) pass. - Provider-literal ratchet OK. Local `pnpm build` plus `check-bundle-budget.mjs`: boot payload within budget (numbers below). - Dev instance with 160 seeded threads, headless Chromium on bee sampling the sidebar every 30 ms after a warm reload: host loading placeholder from 94 ms, plugin root mounted at 320 ms rendering the same two skeleton rows, thread rows at 700 ms. No built-in list at any point. Cold Vite compile: placeholder until the bundle lands at about 7 s, then rows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer 11 of the thread-list plugin stack. Stacked on #4036 (row layer); merges after it.
Human comments
What was wrong
After #4036 the plugin owned rows, preferences, and the DTO adapter but still rendered nothing of its own:
plugins/thread-list/app.tsxmounted the built-in list throughOriginal. The list assembly (sections, windowing, drag and drop, header controls, visibility, reveal-on-navigate) still lived only inapps/app, so the plugin could not stand on the public API alone. A first port also ran 40 to 60 percent slower than the built-in list on updates because every per-row host hook rebuilt a 3,000-entry thread map on each payload change, and the plugin regrouped every project on every update.What changed
plugins/thread-list/app/list/*,app/dnd/*: ports of the built-in list assembly onto the plugin API. Sections come fromexperimental_useSidebarThreads().sections, mutations go throughuseSdk().threadsandthreadSections, layout preferences through the plugin's own KV atoms. Imports stay inside the plugin boundary:@get-bb/plugin-sdk/app,@bb/shared-ui,@bb/client-core,@bb/core-ui, jotai,@dnd-kit.plugins/thread-list/app.tsxnow renders the plugin'sThreadList(PreferencesSync+ProjectList) instead ofOriginal.plugins/thread-list/app/model/use-sidebar-data.ts: grouped data keeps untouched projects and thread arrays by identity across updates so per-project memos skip.plugins/thread-list/app/preferences/preferences-sync.ts: sync attaches to the jotai store the plugin renders in (attachPreferencesStore) instead of assuming the default store. Pending writes carry their value so a store swap cannot drop one.apps/app/src/lib/plugin-sidebar-hooks.ts: one thread-entry map per bootstrap payload behind aWeakMap, shared by every per-row hook.apps/app/src/components/sidebar/sidebar.bench.test.tsx: runs both lists through the same harness (plugin mounted viaPluginThreadListwith its real registration, preference RPC stubbed).plans/thread-list-plugin.md: parity numbers.The header includes the Active/Archived Filter menu.
experimental_useSidebarThreadsnow acceptsexperimental_lifecyclesand returnsexperimental_archivedpagination/loading state, sharing the host archive query and cached row lookups. The plugin persists the selection asthreadLifecycles, exposed by its existing preference RPC andbb thread-list prefscommands. Plugin Guide, API audit, and configuration guidance cover the additions. No server/daemon wire changes.How you verified
Archive regression coverage: desktop and compact filter toggles keep at least one lifecycle selected; host-hook tests cover active-only, archived-only, combined views, duplicate/stale entries, loading/errors, pagination, and archived row lookup. CLI/RPC tests reject empty, duplicate, and invalid selections. Turbo: all 300 thread-list tests and 20 focused host-hook tests pass; app, plugin, SDK, and API-map typechecks pass. Focused lint passes.
Benchmark, 3,000 threads, jsdom, median of 5 (
BB_SIDEBAR_BENCH=1 pnpm exec vitest run src/components/sidebar/sidebar.bench.test.tsxinapps/app):Tests added: structural-sharing and per-payload cache tests in
sidebar-thread.test.ts, store-attachment test inpreferences-sync.test.ts, and the ported list/dnd suites (drag chip, nest preview placement, section dnd projection, windowed items, section order, reveal, header controls, visibility, project row interactions, sort comparator). Before the fixes the benchmark's plugin scenario rendered zero rows and the update numbers were 40 to 60 percent above the built-in.Manual: dev instance with 160 seeded threads, Settings → Appearance → Thread list set to the plugin, list renders with sections, pins, nesting, and drag and drop.
🤖 Generated with Claude Code