Skip to content

Fix: Allow proceeding without selecting automigrations in upgrade command#32597

Merged
yannbf merged 5 commits into
nextfrom
copilot/fix-ce491ec7-393c-48b2-9521-681fa8936b06
Oct 15, 2025
Merged

Fix: Allow proceeding without selecting automigrations in upgrade command#32597
yannbf merged 5 commits into
nextfrom
copilot/fix-ce491ec7-393c-48b2-9521-681fa8936b06

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 1, 2025

Problem

The Storybook upgrade command's multiselect prompt for automigrations required users to select at least one option before proceeding. This prevented users from continuing with the upgrade when they wanted to skip all automigrations, forcing them to select something even if they didn't want to run any automigrations.

image

As shown in the screenshot, the prompt displays "Please select at least one option" and won't let users proceed without making a selection.

Solution

This PR fixes the issue by:

  1. Updating ClackPromptProvider to properly pass the required option to the underlying clack.multiselect function. Previously, the option was defined in the interface but not being passed through to clack.

  2. Setting required: false in the automigration prompt call, allowing users to press Enter without selecting any options.

Changes

code/core/src/node-logger/prompts/prompt-provider-clack.ts

async multiselect<T>(options: MultiSelectPromptOptions<T>, promptOptions?: PromptOptions): Promise<T[]> {
  const result = await clack.multiselect<T>({
    ...options,
    required: options.required,  // Now properly passed to clack
  });
  // ...
}

code/lib/cli-storybook/src/automigrate/multi-project.ts

const selectedIds = await prompt.multiselect({
  message: 'Select automigrations to run',
  options: choices,
  initialValues: choices.filter((c) => c.defaultSelected).map((c) => c.value),
  required: false,  // Allow proceeding without selections
});

Testing

Added comprehensive tests to verify:

  • The multiselect is called with required: false
  • Users can select nothing and proceed (returns empty array)
  • The --yes option still works correctly (selects all automigrations)
  • The --dryRun option still works correctly

All existing and new tests pass ✅

Result

Users can now press Enter without selecting any automigrations, allowing them to:

  • Manually apply changes later
  • Skip automigrations that aren't applicable to their project
  • Review the upgrade before applying any automigrations

The fix maintains backward compatibility - users can still select automigrations as before, and the --yes flag continues to work as expected.

Fixes #29640

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: SB10 - Can't proceed the upgrade command without selecting at least one automigration</issue_title>
<issue_description>### Describe the bug

In the upgrade command, there is no way to not select automigrations. If you don’t select, you can’t proceed
Image

Users should be able to proceed without selecting. This should be achievable by adding required: false to the multiselect option in our clack implementation

Reproduction link

Reproduction steps

System

-

Additional context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #32593

💡 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.

Summary by CodeRabbit

  • New Features

    • Added an interactive automigration selection prompt in multi-project workflows.
    • Selection is now optional (you can proceed without choosing any items).
    • Support for “Yes to all” to run all available automigrations.
    • Dry-run mode now clearly reports no changes will be made.
  • Bug Fixes

    • Prompt behavior now correctly respects whether selection is required, preventing forced choices.
  • Tests

    • Added comprehensive tests covering optional selection, empty selections, “Yes to all,” and dry-run behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 1, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds optional selection to automigration prompts, introduces and tests a new exported function promptForAutomigrations, and adjusts clack multiselect invocation to explicitly pass the required flag via an options spread.

Changes

Cohort / File(s) Summary
CLI Automigrate: New prompt flow and tests
code/lib/cli-storybook/src/automigrate/multi-project.ts, code/lib/cli-storybook/src/automigrate/multi-project.test.ts
Adds exported promptForAutomigrations(...). Sets multiselect option required: false. Tests cover empty selection, yes flag selecting all, dry-run behavior, and non-required prompt interaction.
Node logger prompt provider: options handling
code/core/src/node-logger/prompts/prompt-provider-clack.ts
Updates multiselect call to spread options and explicitly set required from options.required, preserving other fields.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant CLI as CLI Automigrate
  participant P as Prompt (clack.multiselect)
  participant L as Logger

  CLI->>P: multiselect({ options..., required: false })
  alt User selects automigrations
    P-->>CLI: Selected items
    CLI->>L: log "Running X automigrations"
    CLI-->>CLI: return selected automigrations
  else User selects none
    P-->>CLI: []
    CLI-->>CLI: return []
  end

  opt --yes flag
    U->>CLI: --yes
    CLI->>L: log "Running all automigrations"
    CLI-->>CLI: return all automigrations
  end

  opt --dry-run
    U->>CLI: --dry-run
    CLI->>L: log "Dry run: no changes will be made"
    CLI-->>CLI: return []
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/fix-ce491ec7-393c-48b2-9521-681fa8936b06

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15bdc1d and 4bc605b.

📒 Files selected for processing (3)
  • code/core/src/node-logger/prompts/prompt-provider-clack.ts (1 hunks)
  • code/lib/cli-storybook/src/automigrate/multi-project.test.ts (2 hunks)
  • code/lib/cli-storybook/src/automigrate/multi-project.ts (1 hunks)

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Oct 1, 2025

View your CI Pipeline Execution ↗ for commit 4bc605b

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 47s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-15 08:42:34 UTC

Copilot AI and others added 2 commits October 1, 2025 12:54
…ations

Co-authored-by: yannbf <1671563+yannbf@users.noreply.github.com>
Co-authored-by: yannbf <1671563+yannbf@users.noreply.github.com>
Copilot AI changed the title [WIP] [Bug]: SB10 - Can't proceed the upgrade command without selecting at least one automigration Fix: Allow proceeding without selecting automigrations in upgrade command Oct 1, 2025
Copilot AI requested a review from yannbf October 1, 2025 12:57
@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: 4bc605b, ran on 15 October 2025 at 08:31:03 UTC

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

storybook

Before After Difference
Dependency count 43 43 0
Self size 30.19 MB 30.19 MB 🎉 -291 B 🎉
Dependency size 17.31 MB 17.36 MB 🚨 +53 KB 🚨
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 187 187 0
Self size 921 KB 921 KB 🚨 +21 B 🚨
Dependency size 79.87 MB 79.92 MB 🚨 +53 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 169 169 0
Self size 35 KB 35 KB 0 B
Dependency size 76.30 MB 76.35 MB 🚨 +53 KB 🚨
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 44 44 0
Self size 1.55 MB 1.55 MB 🚨 +30 B 🚨
Dependency size 47.50 MB 47.55 MB 🚨 +53 KB 🚨
Bundle Size Analyzer node node

@yannbf yannbf marked this pull request as ready for review October 15, 2025 10:14
@yannbf yannbf merged commit d944892 into next Oct 15, 2025
57 checks passed
@yannbf yannbf deleted the copilot/fix-ce491ec7-393c-48b2-9521-681fa8936b06 branch October 15, 2025 10:15
@coderabbitai coderabbitai Bot mentioned this pull request Dec 24, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SB10 - Can't proceed the upgrade command without selecting at least one automigration

3 participants