Skip to content

Add the thread list placeholder and a sidebar benchmark - #4035

Merged
SawyerHood merged 8 commits into
mainfrom
thread-list/0-compiled-in-loader
Sep 22, 2026
Merged

SawyerHood merged 8 commits into
mainfrom
thread-list/0-compiled-in-loader

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

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 " 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

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4028 September 21, 2026 23:45
@SawyerHood
SawyerHood force-pushed the thread-list/0-compiled-in-loader branch from d00b3b0 to 9b2b719 Compare September 21, 2026 23:57
@SawyerHood
SawyerHood force-pushed the thread-list/0-compiled-in-loader branch from 9b2b719 to 9b915eb Compare September 22, 2026 00:08
@SawyerHood
SawyerHood marked this pull request as ready for review September 22, 2026 00:15
Base automatically changed from thread-list/6-first-party-use-sdk to main September 22, 2026 00:18
@SawyerHood
SawyerHood force-pushed the thread-list/0-compiled-in-loader branch 4 times, most recently from 66ff2b1 to c6fd700 Compare September 22, 2026 01:38
@SawyerHood SawyerHood changed the title Let the app compile in a plugin frontend and seed it at boot Add the thread list placeholder, a plugin boot signal, and a sidebar benchmark Sep 22, 2026
@SawyerHood SawyerHood changed the title Add the thread list placeholder, a plugin boot signal, and a sidebar benchmark Add the thread list placeholder and a sidebar benchmark Sep 22, 2026
@SawyerHood
SawyerHood force-pushed the thread-list/0-compiled-in-loader branch from 582e210 to 72385c8 Compare September 22, 2026 02:06
SawyerHood and others added 7 commits September 21, 2026 19:36
Plugin frontends load after the plugins inventory request, so a sidebar
that is a plugin would paint late on every cold start. Add a compiled-in
table to the loader: a listed plugin imports through the app build instead
of the server bundle, is seeded before the inventory answers, never reloads
on a server hash change, and is skipped on the next boot when the server
last reported it disabled. Also a boot-settled signal and the placeholder
the thread-list slot will render while loading, missing, or crashed. The
table is empty until the thread-list plugin lands.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Mounts the built-in list with 3,000 generated threads under a simulated
viewport so windowing engages, then times mount, a status patch, a
membership refetch, and a pin. Runs only with BB_SIDEBAR_BENCH=1.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The zod-resolution suite copies packages/plugin-sdk/bundled-types, which
build:types produces, but the test task only waited for build. Whether
the directory existed depended on task scheduling.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Each case renders the whole product map twice; it takes under a second
locally and nearly ten on a busy CI runner, past the five-second default.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Compiling the thread-list plugin into the app duplicated the frontend
loader for one plugin and added a localStorage memo to hide a
list-then-blank flash. The placeholder covers the cold start instead:
it shows skeleton rows until the plugin bundle mounts, and the boot
signal lets it tell "still loading" from "no thread list plugin is
enabled" once the first reconcile finishes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The placeholder needs to know when plugin frontends have settled. The
loader module carries the plugin runtime shims (pierre, radix, tiptap
through shared-ui), so a static import from the sidebar would pull the
on-demand vendors into the boot payload. plugin-frontend-boot-state.ts
already exposes usePluginFrontendsSettled without those imports; the
custom signal on the loader is gone.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@SawyerHood
SawyerHood force-pushed the thread-list/0-compiled-in-loader branch from 72385c8 to e5a08fd Compare September 22, 2026 02:36
@SawyerHood
SawyerHood merged commit 973aadc into main Sep 22, 2026
16 checks passed
@SawyerHood
SawyerHood deleted the thread-list/0-compiled-in-loader branch September 22, 2026 03:11
SawyerHood added a commit that referenced this pull request Sep 22, 2026
## Human comments

## What was wrong

The thread-list plugin (#4031) had state but no rendering. The built-in
sidebar's row layer reaches into about twenty host modules
(`@/components/ui/sidebar`, `ThreadActionsProvider`,
`ThreadTitleMentions`, split-layout atoms, react-router, prompt-draft
storage, the shortcut context) that a plugin cannot import.

## What changed

Everything under `plugins/thread-list/app/`, all importing only
`@get-bb/plugin-sdk/app`, `@bb/shared-ui`, `@bb/client-core`,
`@bb/core-ui`, `@bb/domain` types, and npm packages (verified by grep
for `@/`, `react-router-dom`, `@tanstack/react-query`, `@bb/sdk`):

- `model/`: an adapter from `PluginSidebarThread` to the internal
`ThreadListEntry` shape, cached per DTO identity, so every
`@bb/client-core` builder and comparator runs unchanged;
`useSidebarData()` regroups threads by project the way the bootstrap
payload does.
- `ui/`: ports of the sticky-stack primitives, hover-action classes,
drag-click suppression, reorder DnD, action-menu items, the compact
long-press menu, the shortcut pill, clipboard with `sonner` toasts,
dialog state, the confirm-delete dialog, the empty state, and the
environment display helpers.
- `rows/`: row classes, item keys, sortable motion, droppable types, row
controls, the child chevron, the split mini-map (from
`useSidebarSplitLayout()`), inline rename with duck-typed error mapping,
the status glyph, the section-move provider, the thread actions menu,
and `ThreadRow`. The row's link is a plain anchor on `thread.href` (the
host routes it); cmd-click calls `open(id, { split: true })`; drafts,
row status, and shortcuts come from the per-row hooks; the title renders
`ThreadTitle`; moves and unarchive go through `useSdk()`.
- New plugin dependencies: `@dnd-kit/*`, `@radix-ui/react-slot`,
`@radix-ui/react-compose-refs`, `@bb/core-ui`, `@bb/domain`.

Nothing is wired into a list yet; `app.tsx` still renders `Original`.
The next layer assembles sections, projects, and machines.

Prerequisite: #4035.

## How you verified

124 plugin tests (112 new): 93 `ThreadRow` cases covering open, split,
rename via double-click and menu, every menu item's action or SDK call
including move-to-section and pinned-move sequencing, copy link,
unarchive pending state, drag-click suppression, chevron toggles, glyph
precedence, plugin status, the shortcut pill, and the cross-project
glyph; 11 inline-rename cases including error duck-typing; 2 mini-map
cases; 6 adapter and grouping cases. `pnpm exec turbo run typecheck test
--filter=bb-plugin-thread-list`, `prepare:bundled` builds (1.8 MB dev
bundle).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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