Skip to content

Install core's plugin runtime in Ladle instead of a hand-listed SDK shim - #6942

Merged
ymichael merged 2 commits into
mainfrom
bb/fix-the-app-ladle-build-thr_wyawhz3fwi
Nov 3, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/fix-the-app-ladle-build-thr_wyawhz3fwi

Conversation

@ymichael

@ymichael ymichael commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

ladle build in apps/app failed on main with "experimental_useRpcQuery" is not exported by ".ladle/plugin-sdk-app.ts". Ladle aliased @get-bb/plugin-sdk/app to .ladle/plugin-sdk-app.ts, a hand-written destructure of pluginSdkAppImplementation. Nothing typechecked it (.ladle/ is outside the app tsconfig), nothing compared it to PluginSdkApp, and CI never builds Ladle. So each new SDK member was left out. By the time #6388 added the Git plugin's commit dialog stories, which reach experimental_useRpcQuery through plugins/git/ui/queries.ts, the shim was 22 members short. Separately, every promptbox/Prompt Box Internal story threw Missing story mention token: @apps/app/src/components/promptbox/PromptBoxInternal.tsx while loading. Two fixture strings still named ComposerBox.tsx while their mention tokens named PromptBoxInternal.tsx.

What changed

  • Deleted apps/app/.ladle/plugin-sdk-app.ts and its Vite alias. Ladle now resolves @get-bb/plugin-sdk/app to the real SDK source, as the app does.
  • Added apps/app/.ladle/plugin-runtime.ts, imported by the Ladle global provider. It calls installPluginRuntime(), the path the app and its plugin tests already use, then replaces the two composer-search hooks with the story overrides. The SDK forwarders cover every PluginSdkApp member, so there is no Ladle export list left to drift.
  • PromptBoxInternal.stories.tsx: the two fixture strings now name PromptBoxInternal.tsx.
  • .bb/skills/monthly-release-email/references/graphics.md: the "patch the shim by hand" tip now applies only to older tags that still have the shim.

A follow-up PR adds the Ladle build to CI.

How you verified

  • On main (7130d96), pnpm exec ladle build in apps/app failed with the error above. On this branch, rebased on ab2689a, it passes and builds 255 stories.
  • I served the built output and opened these stories in headless Chrome. None had page errors:
    • plugins--git--commit-dialog--commit and --minimal render the commit dialog with branch, status and changed files.
    • promptbox--prompt-box-internal--overview and --all-prompt-pills
    • plugins--composer--mentions--overview
  • In the PromptBoxInternal "live skills" composer, typing / lists the story's stub skills (moss-hardening-review, github:gh-fix-ci, …). That shows the story hook overrides reach the Composer plugin through the real SDK forwarders.
  • pnpm exec turbo run typecheck lint --filter=@bb/app passes.

🤖 Generated with Claude Code

AGENT GENERATED

ymichael and others added 2 commits November 3, 2026 13:21
The Ladle build failed because .ladle/plugin-sdk-app.ts did not export
experimental_useRpcQuery, which the Git plugin's commit dialog stories
reach through plugins/git/ui/queries.ts. The shim aliased
@get-bb/plugin-sdk/app to a hand-written destructure of
pluginSdkAppImplementation. Nothing typechecked or built it, so it fell
behind each time the SDK grew a member: it was missing about twenty.

Ladle now resolves @get-bb/plugin-sdk/app to the real SDK source and
installs the runtime with installPluginRuntime(), the same path the app
and its plugin tests use. The SDK forwarders cover every PluginSdkApp
member, so no Ladle-side export list is left to drift. The story
composer-search overrides replace the two hooks on the installed runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit e005c1a into main Nov 3, 2026
52 checks passed
@ymichael
ymichael deleted the bb/fix-the-app-ladle-build-thr_wyawhz3fwi branch November 3, 2026 21:49
ymichael pushed a commit that referenced this pull request Nov 24, 2026
## Human comments

## What was wrong

Five Ladle stories called `installTestPluginRuntime()` at module load
(`.ladle/workflows.stories.tsx` through `loadPluginApp`, which calls
it). That call replaces the plugin runtime that Ladle's global provider
installs (`.ladle/plugin-runtime.ts`) with the fake test SDK. The
stories mount plugins through core hosts, not through `renderSlot`, so
the fake `useBbContext()` and `useBbNavigate()` throw. The call had no
effect until #6942 removed Ladle's static `@get-bb/plugin-sdk/app` shim.
Since then, plugins read the global runtime. Because Ladle changes
stories without a reload, one of these stories also broke every later
story in the same tab. In the same pass, `ladle build` failed on
`virtual:bb-plugin-zod`, because #6959 added `pluginZodRuntime()` to the
app and Vitest configs but not to `.ladle/vite.config.ts`. See #8060.

## What changed

- `PluginThreadList.stories.tsx`, `AskUserQuestionPlugin.stories.tsx`,
`CodexMcpElicitation.stories.tsx`, `InteractionStates.stories.tsx`:
remove `installTestPluginRuntime()`.
- `.ladle/workflows.stories.tsx`: collect registrations with core's
`collectPluginAppRegistrations` instead of `loadPluginApp`.
- New `PluginThreadList.stories.test.tsx`: renders the Action alignment
story with Ladle's runtime and waits for a thread row. It also fails if
any `*.stories.tsx` imports `@get-bb/plugin-sdk/testing/app`.
- `.ladle/vite.config.ts`: add `pluginZodRuntime()` (separate commit).

## How you verified

- The new tests fail on the original stories (the render test fails with
`useBbContext() needs the test slot environment`, and the guard lists
all five files). They pass with this change.
- `apps/app/.ladle/tests/sidebar-actions.mjs` (Chromium, Playwright
1.58.2): on main it times out waiting for `thr_actions_leaf_short`. With
this change it prints `PASS: parent and leaf actions align at 220, 288
and 360px; disclosure precedes quick actions and overflow` on `ladle
serve` and on a served `ladle build`.
- Nine affected stories (thread list x2, question form, Codex form and
computer use, Additional States x3, Workflows panel) render with no page
errors.
- `npx ladle build` in `apps/app`: fails on main with `Rollup failed to
resolve import "virtual:bb-plugin-zod"`, succeeds with this change.
- `pnpm exec turbo run typecheck lint lint:type-aware test
--filter=@bb/app`: pass. One test, `UpdatePluginDialog.test.tsx`, fails
only under an `en_AU` host locale and passes with `en_US`. It is not
related to this change.

Fixes #8060

> AGENT GENERATED
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