Skip to content

Open Service: Mark module-graph engine commands as internal#35144

Merged
JReinhold merged 1 commit into
nextfrom
jeppe-cursor/module-graph-internal-ops-df57
Jun 12, 2026
Merged

Open Service: Mark module-graph engine commands as internal#35144
JReinhold merged 1 commit into
nextfrom
jeppe-cursor/module-graph-internal-ops-df57

Conversation

@JReinhold

@JReinhold JReinhold commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Closes #

What I did

Marked the module-graph open-service commands that are only used by the module graph engine as internal operations, following open-service conventions (internal: true and _-prefixed names):

  • _applyGraphSnapshot
  • _applyGraphUpdate
  • _bumpGraphRevision
  • _setStatus
  • _waitForSettledEngine

Updated the service definition, server registration, and unit tests accordingly. Public queries (getStoriesForFiles, getStatus, getGraphRevision, getLatestStoryChanges) are unchanged.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

No manual testing is necessary. This is an internal API naming and visibility change for engine-only open-service commands; behavior is unchanged and covered by existing unit tests.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Refactor
    • Internal module-graph service architecture reorganized to improve code organization and maintainability.
    • Test infrastructure updated to align with service restructuring.

Engine-only open-service commands (_applyGraphSnapshot, _applyGraphUpdate,
_bumpGraphRevision, _setStatus, _waitForSettledEngine) are now marked
internal: true and prefixed with _ per open-service conventions.

Co-authored-by: Jeppe Reinhold <JReinhold@users.noreply.github.com>
@JReinhold JReinhold self-assigned this Jun 11, 2026
@JReinhold JReinhold requested a review from AriPerkkio June 11, 2026 16:37
@JReinhold JReinhold added maintenance User-facing maintenance tasks core ci:normal Run our default set of CI jobs (choose this for most PRs). qa:skip Pull Requests that do not need any QA. labels Jun 11, 2026
@JReinhold JReinhold marked this pull request as ready for review June 11, 2026 16:38
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e2d4010-14da-48d3-a34b-5645c0a232d3

📥 Commits

Reviewing files that changed from the base of the PR and between 135e436 and 9437e31.

📒 Files selected for processing (4)
  • code/core/src/shared/open-service/services/module-graph/definition.ts
  • code/core/src/shared/open-service/services/module-graph/module-graph.test-helpers.ts
  • code/core/src/shared/open-service/services/module-graph/server.test.ts
  • code/core/src/shared/open-service/services/module-graph/server.ts

📝 Walkthrough

Walkthrough

This PR renames five internal module-graph service commands to underscore-prefixed variants (_applyGraphSnapshot, _applyGraphUpdate, _bumpGraphRevision, _setStatus, _waitForSettledEngine), marking them as internal APIs. The service definition, runtime wiring, test setup, and comprehensive test suite are updated consistently to use the new identifiers.

Changes

Module-graph internal command refactor

Layer / File(s) Summary
Service command definitions and getStatus query
code/core/src/shared/open-service/services/module-graph/definition.ts
Five commands are renamed to underscore-prefixed variants in moduleGraphServiceDef. The getStatus query load is updated to invoke ctx.self.commands._waitForSettledEngine(undefined) instead of the previous variant. Command handlers remain functionally identical; only the command identifiers change.
Service wiring and test harness setup
code/core/src/shared/open-service/services/module-graph/server.ts, code/core/src/shared/open-service/services/module-graph/module-graph.test-helpers.ts
registerModuleGraphService updates all command invocations to use the renamed _-prefixed commands when calling snapshot/update/revision/status handlers. The test helper registerTestModuleGraphService registers a no-op handler under the _waitForSettledEngine key.
Test suite validation
code/core/src/shared/open-service/services/module-graph/server.test.ts
All test cases throughout the file are updated to drive state transitions using the renamed internal commands (_applyGraphSnapshot, _applyGraphUpdate, _bumpGraphRevision, _setStatus). Test assertions for initial state seeding, reverse-index replacement, revision scoping, latest change tracking, and subscriptions remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • storybookjs/storybook#35048: Introduces the module-graph open-service feature that this PR modifies to mark internal commands with underscore prefix.
  • storybookjs/storybook#35057: Establishes naming conventions requiring underscore prefixes for internal operations, which this PR applies to module-graph commands.
  • storybookjs/storybook#35106: Updates command routing in query load execution paths, related to the getStatus query load change in this PR.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@storybook-app-bot

Copy link
Copy Markdown

Package Benchmarks

Commit: 9437e31, ran on 11 June 2026 at 16:53:57 UTC

The following packages have significant changes to their size or dependencies:

@storybook/builder-webpack5

Before After Difference
Dependency count 184 184 0
Self size 79 KB 79 KB 0 B
Dependency size 33.98 MB 34.02 MB 🚨 +44 KB 🚨
Bundle Size Analyzer Link Link

@storybook/angular

Before After Difference
Dependency count 185 185 0
Self size 160 KB 160 KB 0 B
Dependency size 31.32 MB 31.35 MB 🚨 +32 KB 🚨
Bundle Size Analyzer Link Link

@storybook/ember

Before After Difference
Dependency count 189 189 0
Self size 15 KB 15 KB 0 B
Dependency size 30.80 MB 30.84 MB 🚨 +44 KB 🚨
Bundle Size Analyzer Link Link

@storybook/nextjs

Before After Difference
Dependency count 534 534 0
Self size 662 KB 662 KB 🎉 -120 B 🎉
Dependency size 62.16 MB 62.21 MB 🚨 +44 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 271 271 0
Self size 23 KB 23 KB 0 B
Dependency size 46.70 MB 46.74 MB 🚨 +44 KB 🚨
Bundle Size Analyzer Link Link

@storybook/server-webpack5

Before After Difference
Dependency count 196 196 0
Self size 16 KB 16 KB 0 B
Dependency size 35.24 MB 35.29 MB 🚨 +44 KB 🚨
Bundle Size Analyzer Link Link

@storybook/preset-react-webpack

Before After Difference
Dependency count 164 164 0
Self size 18 KB 18 KB 0 B
Dependency size 32.48 MB 32.53 MB 🚨 +44 KB 🚨
Bundle Size Analyzer Link Link

@JReinhold JReinhold changed the title OpenService: Mark module-graph engine commands as internal Open Service: Mark module-graph engine commands as internal Jun 12, 2026
@JReinhold JReinhold merged commit 131e18b into next Jun 12, 2026
150 of 158 checks passed
@JReinhold JReinhold deleted the jeppe-cursor/module-graph-internal-ops-df57 branch June 12, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). core maintenance User-facing maintenance tasks qa:skip Pull Requests that do not need any QA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants