Skip to content

Core: Categorize UniversalStore follower timeout error#34592

Merged
valentinpalkovic merged 4 commits into
storybookjs:nextfrom
justismailmemon:fix/34566-universal-store-timeout
May 22, 2026
Merged

Core: Categorize UniversalStore follower timeout error#34592
valentinpalkovic merged 4 commits into
storybookjs:nextfrom
justismailmemon:fix/34566-universal-store-timeout

Conversation

@justismailmemon
Copy link
Copy Markdown
Contributor

@justismailmemon justismailmemon commented Apr 19, 2026

Closes #34566

What I did

Categorized the UniversalStore follower timeout failure with a dedicated StorybookError instead of letting it fall back to the generic uncaught manager error bucket.

Specifically:

  • added MANAGER_UNIVERSAL_STORE error category
  • added UniversalStoreFollowerTimeoutError
  • replaced the plain TypeError thrown in the UniversalStore follower timeout path
  • updated the related unit test to assert the custom error type

Why

Previously, when a follower timed out waiting for a leader, it threw a plain TypeError. Since that error was not a StorybookError, telemetry grouped it under the generic uncaught manager bucket instead of reporting it as a distinct failure.

With this change, the timeout is reported as its own categorized error, making it easier to track and triage in telemetry.

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

No manual testing was required for this change because it updates error classification and the related unit test coverage.

Documentation

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

Summary by CodeRabbit

  • New Features

    • Added a dedicated timeout error for universal store followers to provide clearer, consistent error reporting when a follower fails to synchronize.
  • Bug Fixes

    • Followers now reject with the new, specific timeout error on sync timeout, improving error clarity and handling and preventing ambiguous TypeError messages.
  • Tests

    • Updated tests to assert the new timeout error is thrown and to verify followers transition to an error status on timeout.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 00c498c9-1c14-4448-b92f-9d94db7230ff

📥 Commits

Reviewing files that changed from the base of the PR and between 7265811 and a96e5a4.

📒 Files selected for processing (1)
  • code/core/src/manager-errors.ts

📝 Walkthrough

Walkthrough

Adds a new UniversalStoreFollowerTimeoutError class and MANAGER_UNIVERSAL_STORE category, replaces a generic TypeError rejection on follower sync timeout with the new error, and updates tests to assert the new error type while preserving status checks.

Changes

Universal store follower timeout integration

Layer / File(s) Summary
Error Type Definition
code/core/src/manager-errors.ts
Added MANAGER_UNIVERSAL_STORE enum entry and new exported UniversalStoreFollowerTimeoutError class (extends StorybookError, sets code: 1, includes followerId in message).
Universal Store Logic
code/core/src/shared/universal-store/index.ts
Imported UniversalStoreFollowerTimeoutError and replaced the timeout rejection value so follower sync timeout now rejects with new UniversalStoreFollowerTimeoutError(this.id) instead of a generic TypeError; timing and control flow unchanged.
Tests
code/core/src/shared/universal-store/index.test.ts
Updated tests to assert the thrown error is an instance of UniversalStoreFollowerTimeoutError while keeping subsequent follower.status assertions.

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@code/core/src/manager-errors.ts`:
- Line 21: The enum member MANAGER_UNIVERSAL_STORE in manager-errors.ts uses an
underscore in its string value; update its value to use a hyphen to match the
existing multi-word MANAGER_* convention and telemetry format (change the value
from 'MANAGER_UNIVERSAL_STORE' to 'MANAGER_UNIVERSAL-STORE') so generated codes
become SB_MANAGER_UNIVERSAL-STORE_0001 and remain consistent with other members
like MANAGER_CLIENT-LOGGER and MANAGER_CORE-EVENTS.
🪄 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

Run ID: e4375fe2-03f6-4485-af0b-635e0a70dd57

📥 Commits

Reviewing files that changed from the base of the PR and between d226aa9 and bec139d.

📒 Files selected for processing (3)
  • code/core/src/manager-errors.ts
  • code/core/src/shared/universal-store/index.test.ts
  • code/core/src/shared/universal-store/index.ts

Comment thread code/core/src/manager-errors.ts Outdated
@justismailmemon justismailmemon force-pushed the fix/34566-universal-store-timeout branch from bec139d to 41cd7e3 Compare April 19, 2026 12:07
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@code/core/src/manager-errors.ts`:
- Around line 71-80: The error message in UniversalStoreFollowerTimeoutError is
misleading: change the constructor's message to reflect the actual observed
condition (a sync timeout) rather than asserting "No existing state"; update the
message in UniversalStoreFollowerTimeoutError (class name) passed to super(...)
so it states that the follower with followerId failed to sync with its leader
within the 1s timeout and include a helpful hint to verify the leader exists and
network/connectivity, while preserving name 'UniversalStoreFollowerTimeoutError'
and Category.MANAGER_UNIVERSAL_STORE and the existing code structure.
🪄 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

Run ID: e4f0c053-ddea-4780-9a18-251b852cc13f

📥 Commits

Reviewing files that changed from the base of the PR and between bec139d and 41cd7e3.

📒 Files selected for processing (3)
  • code/core/src/manager-errors.ts
  • code/core/src/shared/universal-store/index.test.ts
  • code/core/src/shared/universal-store/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • code/core/src/shared/universal-store/index.ts

Comment thread code/core/src/manager-errors.ts Outdated
@valentinpalkovic valentinpalkovic changed the title Categorize UniversalStore follower timeout error Core: Categorize UniversalStore follower timeout error May 20, 2026
@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot Bot commented May 20, 2026

Package Benchmarks

Commit: a96e5a4, ran on 21 May 2026 at 10:11:13 UTC

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

storybook

Before After Difference
Dependency count 72 72 0
Self size 20.25 MB 20.31 MB 🚨 +56 KB 🚨
Dependency size 36.17 MB 36.17 MB 0 B
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 203 203 0
Self size 908 KB 908 KB 🎉 -78 B 🎉
Dependency size 87.55 MB 87.61 MB 🚨 +56 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 196 196 0
Self size 32 KB 32 KB 🚨 +36 B 🚨
Dependency size 86.04 MB 86.10 MB 🚨 +56 KB 🚨
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 73 73 0
Self size 1.08 MB 1.08 MB 🎉 -222 B 🎉
Dependency size 56.42 MB 56.48 MB 🚨 +56 KB 🚨
Bundle Size Analyzer node node

@valentinpalkovic valentinpalkovic merged commit 96ce44c into storybookjs:next May 22, 2026
131 of 134 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Core Team Projects May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Categorize UniversalStore follower timeout error instead of generic UncaughtManagerError

2 participants