Skip to content

Keep Ladle plugin stories on the runtime Ladle installs - #8061

Merged
ymichael merged 2 commits into
get-bb:mainfrom
lanjak:fix-ladle-sidebar-actions-story
Nov 24, 2026
Merged

ymichael merged 2 commits into
get-bb:mainfrom
lanjak:fix-ladle-sidebar-actions-story

Conversation

@lanjak

@lanjak lanjak commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

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

Five stories called installTestPluginRuntime() (directly or through
loadPluginApp), which replaces core's plugin runtime with the fake test
SDK. The stories mount plugins through core hosts, not renderSlot, so the
fake useBbContext() and useBbNavigate() threw. Remove the calls and add a
test that renders the Action alignment story and rejects any story that
imports @get-bb/plugin-sdk/testing/app.

Fixes get-bb#8060
ladle build failed because .ladle/vite.config.ts did not include
pluginZodRuntime(), which the app and Vitest configs use.
@ymichael
ymichael merged commit af25b0b into get-bb:main Nov 24, 2026
36 checks passed
@lanjak
lanjak deleted the fix-ladle-sidebar-actions-story branch November 24, 2026 21:24
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.

Ladle: plugin stories crash with "needs the test slot environment" because they install the fake SDK runtime

2 participants