Skip to content

Remove duplicate types.ts file causing validation conflicts#62

Closed
Copilot wants to merge 6 commits into
nextfrom
copilot/validate-optional-snippets
Closed

Remove duplicate types.ts file causing validation conflicts#62
Copilot wants to merge 6 commits into
nextfrom
copilot/validate-optional-snippets

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 31, 2025

Component manifests were failing validation with Invalid key: Expected "snippet" but received undefined when examples lacked snippets (e.g., stories with render errors).

The issue was caused by a duplicate types.ts file in the @storybook/mcp package:

  • /packages/mcp/types.ts (root) - outdated duplicate file with stricter validation
  • /packages/mcp/src/types.ts - comprehensive, up-to-date file with optional snippet support

Files in src/ were importing from ../types.ts, which created ambiguity about which schema was being used.

Changes

  • Removed duplicate file: Deleted the root packages/mcp/types.ts file entirely
  • Single source of truth: All imports now correctly resolve to src/types.ts which already had:
    • Optional snippet validation
    • More comprehensive StorybookContext interface with manifestProvider and handler callbacks
    • Additional schema fields (path, reactDocgen, error, etc.)
  • Test coverage: Added validation tests for manifests with missing snippets and verified format utilities skip examples without snippets

The src/types.ts schema was already complete and up-to-date with all necessary features. The format-manifest utility already handles missing snippets gracefully by skipping them during rendering.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 31, 2025

⚠️ No Changeset found

Latest commit: 11d066b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copilot AI and others added 2 commits October 31, 2025 11:45
Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
@JReinhold
Copy link
Copy Markdown
Contributor

@copilot i dont know how I ended up with two types.ts files, thats pretty dumb. Delete the one in root mcp, so we only have src/types.ts and ensure that is up-to-date and that everything in the mcp package references that file.

Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
@kasperpeulen kasperpeulen marked this pull request as ready for review October 31, 2025 11:53
Copilot AI changed the title [WIP] Fix validation for optional snippets in MCP package Fix snippet validation to allow optional snippets in component examples Oct 31, 2025
Copilot AI requested a review from JReinhold October 31, 2025 11:53
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.56%. Comparing base (011daee) to head (736a154).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             next      #62      +/-   ##
==========================================
+ Coverage   82.20%   82.56%   +0.35%     
==========================================
  Files          15       15              
  Lines         843      843              
  Branches      159      162       +3     
==========================================
+ Hits          693      696       +3     
+ Misses        142      139       -3     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 31, 2025

Bundle Report

Bundle size has no change ✅

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Oct 31, 2025

npm i https://pkg.pr.new/@storybook/addon-mcp@62
npm i https://pkg.pr.new/@storybook/mcp@62

commit: 736a154

Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 31, 2025

@copilot i dont know how I ended up with two types.ts files, thats pretty dumb. Delete the one in root mcp, so we only have src/types.ts and ensure that is up-to-date and that everything in the mcp pa...

Deleted the root packages/mcp/types.ts file. All imports now correctly resolve to src/types.ts which is more comprehensive and up-to-date. Fixed in commit 736a154.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/storybookjs/mcp/actions/runs/18971731502/jobs
    • Triggering command: node /home/REDACTED/work/mcp/mcp/packages/mcp/node_modules/.bin/../tsdown/dist/run.mjs (http block)
  • o26192.ingest.us.sentry.io
    • Triggering command: node /home/REDACTED/work/mcp/mcp/packages/mcp/node_modules/.bin/../tsdown/dist/run.mjs (dns block)
    • Triggering command: node /home/REDACTED/work/mcp/mcp/packages/addon-mcp/node_modules/.bin/../tsdown/dist/run.mjs --config ../../tsdown.config.ts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Fix snippet validation to allow optional snippets in component examples Remove duplicate types.ts file causing validation conflicts Oct 31, 2025
@JReinhold
Copy link
Copy Markdown
Contributor

Already handled in #61

@JReinhold JReinhold closed this Oct 31, 2025
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.

2 participants