Skip to content

Drop storybook 9.1.x from addon-mcp peer dependency ranges - #378

Open
Mohith26 wants to merge 2 commits into
storybookjs:mainfrom
Mohith26:fix/peer-dep-range-storybook-9-1
Open

Drop storybook 9.1.x from addon-mcp peer dependency ranges#378
Mohith26 wants to merge 2 commits into
storybookjs:mainfrom
Mohith26:fix/peer-dep-range-storybook-9-1

Conversation

@Mohith26

@Mohith26 Mohith26 commented Jul 29, 2026

Copy link
Copy Markdown

Fixes #376, reported by @rachelslurs.

The published peer ranges admit storybook 9.1.x, but the preset imports importModule from storybook/internal/common, which only exists from 10.0.0, so 9.1.x installs crash during preset loading. This takes the issue's low-risk remedy: raise the floor to ^10.0.0 on both lockstep ranges (storybook, @storybook/addon-vitest), keeping the ^0.0.0-0 canary allowance. Patch changeset included.

One open product question flagged rather than decided here: the reporter's follow-up shows the manifest-emitting range is effectively 10.3.x+, but the addon degrades gracefully without manifests, so a harder ^10.3.0 floor (or a load-time version check with an explicit error) is an alternative if you would rather fail loudly.

Five regression tests anchor the range to the real missing-export behavior (probing importModule on the installed storybook rather than asserting constants), reject 9.1.16/9.1.20, admit 10.0.0-10.5.3 + canaries, and keep the two ranges lockstep. Suite: 369 passed, zero new failures; oxlint/oxfmt/tsc clean.

Summary by CodeRabbit

  • Compatibility

    • Updated Storybook integration requirements to support Storybook 10.x releases and compatible canary versions.
    • Removed compatibility with Storybook 9.1.x due to integration limitations.
    • Kept the related Storybook testing add-on version requirements aligned with the supported range.
  • Bug Fixes

    • Prevented installation with incompatible Storybook versions that could cause the integration to fail during startup.

Mohith26 added 2 commits July 29, 2026 11:17
The preset imports importModule from storybook/internal/common, which
does not exist on the 9.1.x line, so any install admitted by the
^9.1.16 floor fails during preset loading with 'Unexpected module
status 0'. Raise the floor to ^10.0.0, the first line providing the
exports the preset needs, keeping ^0.0.0-0 for storybook canaries.

Fixes storybookjs#376
Assert the published storybook peer range rejects the 9.1.x line the
preset cannot load on, still admits 10.0.0 through 10.5.x and storybook
canaries, and stays in lockstep with the @storybook/addon-vitest range.
Also probe that the storybook/internal/common exports the preset
imports (importModule, normalizeStoryPath) exist in the installed
storybook, anchoring the range floor to real load-path behavior.
@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a182068

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@storybook/addon-mcp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for storybook-mcp-self-host-example canceled.

Name Link
🔨 Latest commit a182068
🔍 Latest deploy log https://app.netlify.com/projects/storybook-mcp-self-host-example/deploys/6a6a2ca15493c70007a67ff1

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The addon-mcp peer ranges now exclude Storybook 9.1.x and support Storybook 10 releases and canaries. New tests validate the semver ranges, synchronization with @storybook/addon-vitest, and required storybook/internal/common exports. A patch changeset records the compatibility update.

Changes

Storybook peer compatibility

Layer / File(s) Summary
Peer range and compatibility validation
.changeset/drop-storybook-9-peer-range.md, packages/addon-mcp/package.json, packages/addon-mcp/src/peer-dependencies.test.ts
Peer ranges now target Storybook 10 and canary versions, while tests verify excluded 9.1.x versions, supported 10.x versions, synchronized addon ranges, and required internal exports.

Estimated code review effort: 2 (Simple) | ~10 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/addon-mcp/src/peer-dependencies.test.ts (1)

12-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the prescribed constant casing.

Rename storybookRange to STORYBOOK_RANGE and update its references. As per coding guidelines, use SCREAMING_SNAKE_CASE for constants.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/addon-mcp/src/peer-dependencies.test.ts` at line 12, Rename the
constant storybookRange to STORYBOOK_RANGE in the peer-dependency test and
update every reference to use the prescribed SCREAMING_SNAKE_CASE naming.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/addon-mcp/src/peer-dependencies.test.ts`:
- Around line 8-10: Add semver as a direct development dependency in
packages/addon-mcp/package.json so the createRequire call in
peer-dependencies.test.ts resolves after a clean install. Keep the existing test
behavior unchanged.

---

Nitpick comments:
In `@packages/addon-mcp/src/peer-dependencies.test.ts`:
- Line 12: Rename the constant storybookRange to STORYBOOK_RANGE in the
peer-dependency test and update every reference to use the prescribed
SCREAMING_SNAKE_CASE naming.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b5c51b2-6fe7-4cdf-9da4-746009c3d6ee

📥 Commits

Reviewing files that changed from the base of the PR and between 95bfb45 and a182068.

📒 Files selected for processing (3)
  • .changeset/drop-storybook-9-peer-range.md
  • packages/addon-mcp/package.json
  • packages/addon-mcp/src/peer-dependencies.test.ts

Comment on lines +8 to +10
const { satisfies } = createRequire(import.meta.url)('semver') as {
satisfies: (version: string, range: string) => boolean;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '"semver"\s*:' packages/addon-mcp/package.json || true
pnpm --filter `@storybook/addon-mcp` exec node -e "console.log(require.resolve('semver'))"

Repository: storybookjs/mcp

Length of output: 546


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== package manifest dependencies =="
cat -n packages/addon-mcp/package.json | sed -n '1,220p' || true

echo
echo "== test file context =="
cat -n packages/addon-mcp/src/peer-dependencies.test.ts | sed -n '1,120p' || true

echo
echo "== semver references in packages/addon-mcp =="
rg -n --glob '!*node_modules*' 'semver|peer-dependencies' packages/addon-mcp || true

Repository: storybookjs/mcp

Length of output: 5522


Declare semver as a direct test dependency.

packages/addon-mcp/src/peer-dependencies.test.ts loads semver via createRequire(import.meta.url)('semver'), but packages/addon-mcp/package.json only declares storybook as a dev peer. semver is present through the lockfile dependency graph, yet a consumer’s clean install of the addon package will not include it, so this test can fail before running. Add semver as a direct dev dependency or replace it with a dependency owned by this package.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/addon-mcp/src/peer-dependencies.test.ts` around lines 8 - 10, Add
semver as a direct development dependency in packages/addon-mcp/package.json so
the createRequire call in peer-dependencies.test.ts resolves after a clean
install. Keep the existing test behavior unchanged.

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.

[Bug] peerDependencies admit storybook 9.1.x, where the preset fails to load and the components manifest does not exist in core

1 participant