design-system-mcp: Remove Storybook dependency in TypeScript types#79132
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
It's technically a required field in Storybook's internal types, but we don't use it. It was added as part of referencing Storybook internal types, but can be safely dropped from the tests now that we maintain our own type.
|
Size Change: 0 B Total Size: 8.59 MB |
|
Flaky tests detected in 0379bfe. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27433645378
|
There was a problem hiding this comment.
Given that our types can now go out of sync with Storybook's first-party types, do have a way to know if/when we should update our types? In other words, should we strengthen runtime checks to validate the object structure received from Storybook APIs?
There was a problem hiding this comment.
Since the type gets used in the config etc. it should be caught if there is a major upstream change.
There was a problem hiding this comment.
I think we do lose some assurances here, since the other usage of Storybook internal types doesn't exercise the ComponentManifest type that we rely on so heavily in the MCP package. But also, a lot of what we depend on comes through the reactDocgen types that aren't part of those internal types anyways.
We still have the CI check for ensuring that the manifest is parseable. This should be enough to catch an issue if a Storybook upgrade would regress the ability to retrieve component information.


What?
Related: #79095 (comment)
Updates
@wordpress/design-system-mcpto removestorybookas a dependency.Why?
Fixes an issue where built TypeScript types have an implicit dependency on
storybook, but it isn't defined as a dependency by the package. Definingstorybookas a dependency of the MCP server is not acceptable because it is a large dependency tree, and the MCP server relies on recurring updates / installs to keep itself up to date (via npx).How?
Replaces the TypeScript type sourced from
storybookpackage internals with a duplicate copy.The motivation for using the internal types is explained in #78185 (comment), essentially as a way to provide some awareness when the internal shape changes, since the MCP relies on the shape of the component manifest. However, as explained later in the same thread, we have additional assurances for this through a separate validation step added in 8f53c41. Maintaining a duplicate type is some additional overhead for us, but it's much better than making
storybooka dependency.Testing Instructions
Verify
npm run buildpasses, which includes TypeScript type-checking.Observe there are no references to
storybookpackage inpackages/design-system-mcp/build-typesafter build.Observe that the "Validate manifest matches design-system-mcp contract" CI check on this pull request passes.
Use of AI Tools
No AI was used.