Repository navigation
Keep Ladle plugin stories on the runtime Ladle installs - #8061
Merged
Merged
Conversation
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.
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
Five Ladle stories called
installTestPluginRuntime()at module load (.ladle/workflows.stories.tsxthroughloadPluginApp, 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 throughrenderSlot, so the fakeuseBbContext()anduseBbNavigate()throw. The call had no effect until #6942 removed Ladle's static@get-bb/plugin-sdk/appshim. 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 buildfailed onvirtual:bb-plugin-zod, because #6959 addedpluginZodRuntime()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: removeinstallTestPluginRuntime()..ladle/workflows.stories.tsx: collect registrations with core'scollectPluginAppRegistrationsinstead ofloadPluginApp.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.tsximports@get-bb/plugin-sdk/testing/app..ladle/vite.config.ts: addpluginZodRuntime()(separate commit).How you verified
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 forthr_actions_leaf_short. With this change it printsPASS: parent and leaf actions align at 220, 288 and 360px; disclosure precedes quick actions and overflowonladle serveand on a servedladle build.npx ladle buildinapps/app: fails on main withRollup 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 anen_AUhost locale and passes withen_US. It is not related to this change.Fixes #8060