Skip to content

Conversation

@rusackas
Copy link
Member

@rusackas rusackas commented Dec 11, 2025

Summary

This PR upgrades Storybook and introduces an automated documentation system for extension-compatible UI components.

Storybook Upgrade (8.1.11 → 8.6.14)

  • Updated 10 Storybook packages in superset-frontend/package.json
  • Updated 6 Storybook packages in packages/superset-ui-demo/package.json
  • Added @storybook/test-runner to validate all stories compile and render without errors
  • Fixed several pre-existing broken stories discovered by the test runner

Story Fixes

  • DesignSystem.stories.tsx: Converted markdown table to HTML (markdown-to-jsx doesn't support GFM tables)
  • AlteredSliceTag.stories.tsx: Fixed props - component expects diffs, not currentFormData
  • ExampleApp.stories.jsx: Imported Alert and Table from antd (not exported from components wrapper)
  • ListViewCard.stories.tsx: Simplified story to avoid infinite recursion / stack overflow

CI Integration

  • Added test-storybook job to GitHub Actions that builds Storybook and runs the test runner
  • Documented Storybook testing in contributing docs

Extension Component Documentation System

Added infrastructure for documenting components available to extension developers:

  • Location-based detection: Any component in superset-core/src/ui/components/ with a story is automatically documented
  • Auto-generation script (docs/scripts/generate-extension-components.mjs) that:
    • Scans superset-core for story files
    • Generates interactive MDX documentation pages
    • Extracts controls from story argTypes
    • Auto-generates props tables from story args
  • Live code playground: Added @docusaurus/theme-live-codeblock for editable examples
  • Webpack/TypeScript aliasing: @apache-superset/core resolves to superset-core components
  • Runs automatically on yarn start and yarn build in docs/
  • New Components section in Developer Portal under Extensions

How to Add a New Extension Component

  1. Create the component in superset-frontend/packages/superset-core/src/ui/components/
  2. Export it from the package's index.ts
  3. Create a Storybook story with an Interactive export:
export default { title: 'Extension Components/MyComponent', component: MyComponent, parameters: { docs: { description: { component: 'Description of the component...', }, }, }, }; export const InteractiveMyComponent = (args) => <MyComponent {...args} />; InteractiveMyComponent.args = { variant: 'primary', disabled: false, }; InteractiveMyComponent.argTypes = { variant: { control: { type: 'select' }, options: ['primary', 'secondary'], }, disabled: { control: { type: 'boolean' }, }, };
  1. Run yarn start in docs/ - the page generates automatically!

Test plan

  • Storybook builds successfully (npm run build-storybook)
  • All stories render without errors (npm run test-storybook)
  • Extension component docs generate correctly
  • CI passes (frontend build, jest tests, new test-storybook job)

🤖 Generated with Claude Code

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.

@bito-code-review
Copy link
Contributor

Bito Automatic Review Skipped - Files Excluded

Bito didn't auto-review this change because all changed files are in the exclusion list for automatic reviews. No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the excluded files settings here, or contact your Bito workspace admin at evan@preset.io.

@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:S This PR changes 10-29 lines, ignoring generated files label Dec 11, 2025
@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

@codeant-ai-for-open-source
Copy link
Contributor

💡 Enhance Your PR Reviews

We noticed that 3 feature(s) are not configured for this repository. Enabling these features can help improve your code quality and workflow:

🚦 Quality Gates

Status: Quality Gates are not enabled at the organization level
Learn more about Quality Gates

🎫 Jira Ticket Compliance

Status: Jira credentials file not found. Please configure Jira integration in your settings
Learn more about Jira Integration

⚙️ Custom Rules

Status: No custom rules configured. Add rules via organization settings or .codeant/review.json in your repository
Learn more about Custom Rules


Want to enable these features? Contact your organization admin or check our documentation for setup instructions.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 11, 2025
@github-actions github-actions bot added github_actions Pull requests that update GitHub Actions code doc Namespace | Anything related to documentation labels Dec 11, 2025
@rusackas rusackas changed the title chore(frontend): upgrade Storybook from 8.1.11 to 8.6.14 feat(frontend): upgrade Storybook and add extension component documentation Dec 11, 2025
@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is running Incremental review

@rusackas
Copy link
Member Author

PR Review Feedback Addressed

Rebased on master and addressed the following review feedback:

1. Script Comment Mismatch ✅

Fixed misleading header comment that claimed the script scans for extension-compatible tags. The comment now accurately states it processes all stories in superset-core/src.

2. Hardcoded "Sample alert message" ✅

The MDX generator is now story-driven - it extracts actual args and controls from Storybook stories instead of generating hardcoded Alert-specific code. This means:

  • Props like message and description are pulled from InteractiveX.args
  • Text controls are automatically added for string props
  • Prop descriptions come from argTypes metadata
  • The generated code works for any component, not just Alert

3. Alert-like Component Structure Assumption ✅

Fixed - same as above. Live examples now use actual story props.

4. Webpack/TypeScript Alias Mismatch ✅

Added clarifying comments to both webpack.extend.ts and tsconfig.json explaining the intentional split:

  • Webpack resolves actual component source for runtime
  • TypeScript uses simplified generated types for IDE support

5. Inconsistent Import Path ✅

Updated all imports from @apache-superset/core to @apache-superset/core/ui to match the established pattern used throughout the Superset codebase.

6. Components Section Sidebar Position ✅

Moved Components from the end of the Extensions sidebar to after "Contribution Types" - following the logical learning path: understand the toolkit → learn extension points → build.


All changes are purely programmatic (regex parsing + string templates) with no AI involved in the doc generation itself.

rusackas and others added 23 commits December 15, 2025 16:03
Upgrade all @storybook/* packages to 8.6.14 across the monorepo: - superset-frontend root package.json - packages/superset-ui-demo/package.json Also adds @storybook/test-runner to validate all stories compile and render without errors: - `npm run test-storybook` - run against a running Storybook server - `npm run test-storybook:ci` - build static + serve + test (for CI) This aligns all Storybook dependencies to a consistent version and picks up the latest patches and security fixes in the 8.x line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add @storybook/test-runner for automated story smoke tests - Add test-storybook and test-storybook:ci npm scripts - Add test-storybook job to GitHub Actions CI workflow - Fix webpack alias for react-dom/test-utils resolution - Fix null safety in webpack.config.js for test-storybook - Fix exampleThemes import in .storybook/preview.jsx - Fix DesignSystem.stories.tsx: convert markdown table to HTML - Fix AlteredSliceTag.stories.tsx: pass correct diffs prop - Fix ExampleApp.stories.jsx: import Alert/Table from antd - Fix ListViewCard.stories.tsx: simplify to avoid stack overflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the new npm run test-storybook and test-storybook:ci commands in the Storybook section of the development docs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add infrastructure for documenting components available to extension developers: - Add `extension-compatible` tag convention for Storybook stories - Add `extensionMeta` parameters for package/import info in stories - Create generate-extension-components.mjs script that: - Scans superset-core for stories with extension-compatible tag - Generates MDX documentation pages automatically - Creates index page listing all available components - Add Components section to Extensions in developer portal sidebar - Add npm script: `npm run generate:extension-components` - Tag Alert component as first extension-compatible component To add more components to extension docs: 1. Add `tags: ['extension-compatible']` to the story 2. Add `extensionMeta` parameters with package/import info 3. Run `npm run generate:extension-components` in docs/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix sidebar label: "Components > Overview" instead of "Components > Components" - Add live component rendering with StoryWithControls - Extract argTypes to generate interactive controls (select, boolean) - Parse variable references for select options (e.g., `options: types`) - Skip action argTypes (not user controls) - Auto-generate props table from story args - Fix component source link path 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Run generate:extension-components automatically before docusaurus start and build, so new extension-compatible stories are picked up without manual script execution. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document how to mark components as extension-compatible: - Requirements for component location and exports - Story metadata fields (tags, extensionMeta) - How the auto-generation works - Best practices for argTypes and descriptions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add @docusaurus/theme-live-codeblock for interactive code editing - Create ReactLiveScope with extension components (Alert, etc.) - Update generator to include "Try It" section with live code blocks - Users can now edit code and see real-time component rendering The component pages now have: 1. Live Example - UI controls for quick prop toggling 2. Try It - Editable code block for experimentation 3. Usage in Extensions - Copy-paste code for real usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move "This component is available in..." text from separate Installation section into Usage in Extensions section for cleaner layout. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New order: Live Example → Try It → Props → Usage in Extensions → Source Keeps Props close to the live editor for quick reference while editing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Components in @apache-superset/core are now automatically documented by virtue of their location - no manual tagging needed. Changes: - Remove extension-compatible tag requirement from generator - Remove tags and extensionMeta from Alert story (no longer needed) - Update developer portal docs to reflect simpler workflow - Update index page template with new instructions Workflow is now: 1. Add component to superset-core/src/ui/components/ 2. Create a Storybook story 3. Run yarn start in docs/ - done! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused variables in generate-extension-components.mjs - Fix formatting with prettier 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…imports The docs TypeScript build cannot resolve imports from superset-frontend. Create ExtensionComponents.tsx with local wrappers that mirror the @apache-superset/core API for use in documentation examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of maintaining duplicate component wrappers, configure proper path aliasing so docs can import directly from @apache-superset/core: - Add webpack alias in webpack.extend.ts - Add tsconfig path mapping in tsconfig.json - Update ReactLiveScope and MDX to use package imports - Remove ExtensionComponents.tsx wrapper (no longer needed) This approach scales better as more components are added to the extension API - no wrapper maintenance required. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add `npx playwright install-deps` to install system-level dependencies (libglib, libnss3, etc.) required to run browsers in the Docker container. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
TypeScript can't resolve types from superset-frontend due to the exclude pattern. Add a type declaration file that provides the types for tsc, while webpack alias handles the runtime resolution. This approach: - Type declarations in src/types/ for TypeScript compilation - Webpack alias for runtime module resolution - No need to maintain duplicate implementations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The @apache-superset/core package imports theme which has @fontsource dependencies. Point the webpack alias directly to the components folder to avoid pulling in fonts that aren't installed in docs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The generator now extracts type exports from component files and generates the .d.ts file automatically. No manual maintenance needed. When a new component is added to superset-core/src/ui/components/: - MDX documentation page is generated - Type declarations are extracted and added to .d.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The typecheck script needs to run the generator first to ensure the type declarations file exists before tsc runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move paths, jsx, moduleResolution inside compilerOptions (they were being ignored) - Restructure types as src/types/apache-superset-core/index.d.ts so TypeScript resolves it as a module - Generator creates the types directory and index.d.ts automatically - Remove unnecessary triple-slash reference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Storybook 8 has an ESM resolution issue where it tries to import react-dom/test-utils without an extension. Add webpack rule to disable fullySpecified for .mjs files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add test-runner-jest.config.js with 60s timeout (was 15s default) - Limit to 2 workers in CI to reduce memory pressure and timeouts - Stories were timing out in CI due to slow rendering + parallel load 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
rusackas and others added 4 commits December 15, 2025 16:29
Regenerate package-lock.json starting from master's lockfile to preserve working peer dependency resolutions for @deck.gl packages. This fixes npm ci failures in CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The storybook test-runner was timing out on all 214 tests because every story crashed with JavaScript errors before rendering: - "$RefreshSig$ is not defined" - React Fast Refresh transforms - "jsxDEV is not a function" - Development JSX runtime Root cause: Superset's webpack.config.js defaults to development mode (isDevMode = mode !== 'production'), which enables: - ReactRefreshWebpackPlugin - SWC loader with refresh: true and development: true When storybook builds, it inherits these settings. The static build includes Fast Refresh and jsxDEV code, but the runtime isn't available when served via http-server, causing immediate crashes. Fix: - Filter out ReactRefreshWebpackPlugin from inherited plugins - Override SWC loader to set refresh: false and development: false - Add test-runner.ts config with error logging for debugging Before: 142 test files, 214 tests - ALL FAILING (60s timeouts each) After: All tests PASS in ~1-2 seconds each 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix misleading comment claiming script scans for 'extension-compatible' tags when it actually processes all stories in superset-core/src - Make MDX generation story-driven: extract actual args/controls from stories instead of generating hardcoded Alert-specific code - Add text controls for string props (message, description) automatically - Extract prop descriptions from argTypes for better documentation - Update import path to @apache-superset/core/ui to match established codebase pattern used throughout superset-frontend - Add clarifying comments to webpack.extend.ts and tsconfig.json explaining the intentional split between runtime and type resolution - Move Components section in sidebar after Contribution Types to follow logical learning path (understand toolkit before implementation) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Simplify the args parsing regex by removing escape sequence handling. The nested quantifiers in the previous regex could theoretically cause exponential backtracking, though the practical risk was low since input is trusted local files. The simpler regex is sufficient for Storybook args which rarely contain escaped quotes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rusackas rusackas force-pushed the chore/upgrade-storybook-10 branch from fac4b0b to fd14483 Compare December 16, 2025 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies:npm doc Namespace | Anything related to documentation github_actions Pull requests that update GitHub Actions code packages preset-io size:S This PR changes 10-29 lines, ignoring generated files size/XXL

2 participants