What problem does this address?
Recent upgrades of Storybook have been particularly painful due to the changes in documentation extraction resulting in regressions where component descriptions or props are lost from Storybook.
Examples:
Since the entire point of the Storybook site is to document components, their descriptions, available options, and code snippets, these kinds of regressions are especially painful and prevent someone from understanding how to use available components.
What is your proposed solution?
Based on previous failure scenarios, ideally we'd have some sort of mechanism to detect when props, descriptions, and code samples change as the result of a pull request.
Since many of the issues we've discovered have involved specific workarounds (JSDoc placement, displayName usage, etc.), regressions can happen in any pull request, not just those which update Storybook. For example, a pull request which relocates a component's JSDoc description or wraps/unwraps forwardRef may inadvertently break documentation on Storybook, which this regression test should detect.
Open questions:
- Should this apply to manifest documentation, live Storybook site, or both? These currently use different documentation extraction tools (longer-term they will use the same)
- If testing the live site, how does that work? Is it feasible to run headless browser testing against hundreds of Storybook pages, potentially twice if we compare it against the "live" copy directly?
- How is this surfaced? Test failure? GitHub comment?
- What kind of sign-off is required? Is a GitHub comment enough to show awareness? Something more like the CHANGELOG optional build failures?
More context in #77382 (comment) :
We have some coverage already with the design system validate-manifest.mjs script run in CI to ensure that there's at least some components with props. But all that's doing is ensuring that it's not completely broken. With the issues we've seen, I think we can get more granular with this to see when descriptions/props/components are added/lost.
We'll also want to be careful to avoid "props gained" as an objectively good measure, since what happened here was that we accidentally "gained" props which were intended to be hidden. Ideally we'd have some sort of mechanism where we highlight specific differences in a way that someone can sign off on the changes as expected.
The tricky thing is that we currently have two different docgen tools for Storybook. All signs are that Storybook is investing in this new "meta" extractor as the default for everything, but currently it's only available for the manifests. So we can test against the manifests (which is easy to do), but that doesn't provide us much guarantees about the user-facing Storybook site. And testing the user-facing Storybook site is difficult, as even with a headless browser test environment to do so, there's hundreds of pages of documentation. Given the long-term direction, it might be simplest to just test the manifest file and trust that it'll be future-proof to be representative of what a user would see in the browser, although that leaves a gap until that meta extractor is actually used for the live site.
What problem does this address?
Recent upgrades of Storybook have been particularly painful due to the changes in documentation extraction resulting in regressions where component descriptions or props are lost from Storybook.
Examples:
displayNameto the anonymous components #74716 (missing component names in code samples) and Storybook: Fix missing props from component stories #74807 (missing props)@ignore'd props, and incorrect component names in code samplesSince the entire point of the Storybook site is to document components, their descriptions, available options, and code snippets, these kinds of regressions are especially painful and prevent someone from understanding how to use available components.
What is your proposed solution?
Based on previous failure scenarios, ideally we'd have some sort of mechanism to detect when props, descriptions, and code samples change as the result of a pull request.
Since many of the issues we've discovered have involved specific workarounds (JSDoc placement,
displayNameusage, etc.), regressions can happen in any pull request, not just those which update Storybook. For example, a pull request which relocates a component's JSDoc description or wraps/unwrapsforwardRefmay inadvertently break documentation on Storybook, which this regression test should detect.Open questions:
More context in #77382 (comment) :