Repository navigation
Install core's plugin runtime in Ladle instead of a hand-listed SDK shim - #6942
Merged
Merged
Conversation
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 23, 2026
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
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.
Human comments
What was wrong
ladle buildinapps/appfailed on main with"experimental_useRpcQuery" is not exported by ".ladle/plugin-sdk-app.ts". Ladle aliased@get-bb/plugin-sdk/appto.ladle/plugin-sdk-app.ts, a hand-written destructure ofpluginSdkAppImplementation. Nothing typechecked it (.ladle/is outside the app tsconfig), nothing compared it toPluginSdkApp, 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 reachexperimental_useRpcQuerythroughplugins/git/ui/queries.ts, the shim was 22 members short. Separately, everypromptbox/Prompt Box Internalstory threwMissing story mention token: @apps/app/src/components/promptbox/PromptBoxInternal.tsxwhile loading. Two fixture strings still namedComposerBox.tsxwhile their mention tokens namedPromptBoxInternal.tsx.What changed
apps/app/.ladle/plugin-sdk-app.tsand its Vite alias. Ladle now resolves@get-bb/plugin-sdk/appto the real SDK source, as the app does.apps/app/.ladle/plugin-runtime.ts, imported by the Ladle global provider. It callsinstallPluginRuntime(), 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 everyPluginSdkAppmember, so there is no Ladle export list left to drift.PromptBoxInternal.stories.tsx: the two fixture strings now namePromptBoxInternal.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
pnpm exec ladle buildinapps/appfailed with the error above. On this branch, rebased on ab2689a, it passes and builds 255 stories.plugins--git--commit-dialog--commitand--minimalrender the commit dialog with branch, status and changed files.promptbox--prompt-box-internal--overviewand--all-prompt-pillsplugins--composer--mentions--overview/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/apppasses.🤖 Generated with Claude Code