Skip to content

Revert "Open-service: Implement service registration on the server"#34960

Merged
JReinhold merged 1 commit into
nextfrom
revert-34875-jeppe/service-registration
May 28, 2026
Merged

Revert "Open-service: Implement service registration on the server"#34960
JReinhold merged 1 commit into
nextfrom
revert-34875-jeppe/service-registration

Conversation

@JReinhold
Copy link
Copy Markdown
Contributor

@JReinhold JReinhold commented May 28, 2026

Reverts #34875

Summary by CodeRabbit

Release Notes

  • Refactoring

    • Simplified service creation API, replacing registration-based system with direct instantiation via createService().
    • Removed global service registry and related utilities.
  • Removed Features

    • Removed Open Service debug service functionality.
    • Removed services preset configuration support.

Review Change Stack

@JReinhold JReinhold merged commit 62e3fc2 into next May 28, 2026
9 of 10 checks passed
@JReinhold JReinhold deleted the revert-34875-jeppe/service-registration branch May 28, 2026 18:25
@github-actions
Copy link
Copy Markdown
Contributor

Fails
🚫

PR is not labeled with one of: ["cleanup","BREAKING CHANGE","feature request","bug","documentation","maintenance","build","dependencies"]

🚫

PR is not labeled with one of: ["ci:normal","ci:merged","ci:daily","ci:docs"]

🚫 PR description is missing the mandatory "#### Manual testing" section. Please add it so that reviewers know how to manually test your changes.

Generated by 🚫 dangerJS against dce85c3

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 17f694c0-58da-41ab-8b66-101a410a0d3a

📥 Commits

Reviewing files that changed from the base of the PR and between c899cac and dce85c3.

📒 Files selected for processing (27)
  • code/.storybook/main.ts
  • code/.storybook/open-service-debug-service.ts
  • code/.storybook/services-preset.ts
  • code/core/src/core-server/build-dev.ts
  • code/core/src/core-server/build-static.ts
  • code/core/src/core-server/index.ts
  • code/core/src/core-server/load.ts
  • code/core/src/core-server/presets/common-preset.ts
  • code/core/src/core-server/typings.d.ts
  • code/core/src/server-errors.ts
  • code/core/src/shared/open-service/README.md
  • code/core/src/shared/open-service/errors.ts
  • code/core/src/shared/open-service/index.test-d.ts
  • code/core/src/shared/open-service/index.ts
  • code/core/src/shared/open-service/server.test-d.ts
  • code/core/src/shared/open-service/server.test.ts
  • code/core/src/shared/open-service/server.ts
  • code/core/src/shared/open-service/service-definition.ts
  • code/core/src/shared/open-service/service-registration.test.ts
  • code/core/src/shared/open-service/service-registration.ts
  • code/core/src/shared/open-service/service-runtime.test.ts
  • code/core/src/shared/open-service/service-runtime.ts
  • code/core/src/shared/open-service/service-validation.test.ts
  • code/core/src/shared/open-service/static-build.test.ts
  • code/core/src/shared/open-service/static-build.ts
  • code/core/src/shared/open-service/types.ts
  • code/core/src/types/modules/core-common.ts

📝 Walkthrough

Walkthrough

This PR removes the process-global services preset system and service registry, refactoring the Open Service API from registerService with global state to per-instance createService calls. The preset infrastructure (including the debug service integration) is eliminated, and static preload generation is extracted to a standalone buildStaticFiles module. Type contracts are simplified by removing ServiceId, making handlers required, and narrowing context types.

Changes

Open Service API Refactoring

Layer / File(s) Summary
Remove services preset infrastructure
code/.storybook/main.ts, code/.storybook/services-preset.ts, code/.storybook/open-service-debug-service.ts, code/core/src/core-server/build-dev.ts, code/core/src/core-server/build-static.ts, code/core/src/core-server/load.ts, code/core/src/core-server/presets/common-preset.ts, code/core/src/core-server/typings.d.ts, code/core/src/types/modules/core-common.ts
Removes the services preset definition, its registration in Storybook config, and all conditional preset application during build/load phases; removes debug service wiring and the STORYBOOK_SERVICES_LOADED global flag.
Remove global service registry and registration API
code/core/src/core-server/index.ts, code/core/src/server-errors.ts, code/core/src/shared/open-service/errors.ts
Deletes the process-global service registry module and all registry re-exports (registerService, describeService, getService, etc.); removes Open Service error types that depended on the registry (OpenServiceDuplicateRegistrationError, OpenServiceMissingServiceError, etc.); updates ValidationMeta.serviceId from ServiceId type to plain string.
Refactor service runtime to per-instance creation
code/core/src/shared/open-service/types.ts, code/core/src/shared/open-service/service-definition.ts, code/core/src/shared/open-service/service-runtime.ts
Updates type contracts by removing ServiceId alias and registry/descriptor types; simplifies CommandCtx to only expose self; makes query/command handler fields required; introduces CreateServiceOptions for runtime store configuration. Refactors service-runtime.ts to remove registry plumbing, replace runtimeOptions: { registryApi } with optional CreateServiceOptions, and introduce per-path static-store loader caching via createStaticStateLoader with microtask-timed merging.
Extract static preload to buildStaticFiles module
code/core/src/shared/open-service/static-build.ts, code/core/src/shared/open-service/static-build.test.ts
Creates new static-build module implementing buildStaticFiles for async discovery/validation/preload execution and deep-merge across service queries; adds comprehensive test coverage for preload behavior, path resolution, and store-backed service integration.
Update public API exports and entry points
code/core/src/shared/open-service/index.ts
Adds createService and buildStaticFiles as public exports; updates type re-exports to include CreateServiceOptions and ServiceInstance while removing registry/descriptor types.
Update tests to use per-instance API
code/core/src/shared/open-service/service-runtime.test.ts, code/core/src/shared/open-service/service-validation.test.ts, code/core/src/shared/open-service/index.test-d.ts, code/core/src/shared/open-service/server.test-d.ts, code/core/src/shared/open-service/server.test.ts, code/core/src/shared/open-service/service-registration.test.ts
Converts service-runtime and service-validation tests to use createService/getService instead of registerService; removes registry test setup and cleanup; deletes obsolete server and registration test files; updates type-check tests to use new API.
Update Open Service documentation and concepts
code/core/src/shared/open-service/README.md
Rewrites public API description to focus on environment-agnostic createService and buildStaticFiles; replaces server registration flow with runtime flow documentation; clarifies static preload caching/merge semantics; updates test ownership guidance and module entry points for different change types.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • storybookjs/storybook#34875: Introduces the services preset, debug service integration, and server registry that this PR removes.
  • storybookjs/storybook#34860: Introduces the new per-instance service creation and static-build APIs that replace the registry-based system removed here.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

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.

1 participant