Skip to content

Fix #2600: show incomplete install message after shakapacker failure#2613

Merged
justin808 merged 10 commits intomasterfrom
jg-codex/issue-2600-install-incomplete-banner
Mar 16, 2026
Merged

Fix #2600: show incomplete install message after shakapacker failure#2613
justin808 merged 10 commits intomasterfrom
jg-codex/issue-2600-install-incomplete-banner

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Mar 15, 2026

Summary

  • track when automatic Shakapacker installation fails during react_on_rails:install
  • suppress the final success banner in that case
  • emit explicit "installation incomplete" guidance instead (without suggesting ./bin/dev)
  • add regression tests for failed Shakapacker install flow and incomplete-message behavior

Why

Fixes #2600: with --ignore-warnings, a failed shakapacker:install previously still ended with 🎉 React on Rails Successfully Installed!, which was misleading when required Shakapacker files were missing.

Testing

  • bundle exec rspec react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb:1660 react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb:1895
  • bundle exec rubocop react_on_rails/lib/generators/react_on_rails/install_generator.rb react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb

Note

Low Risk
Low risk: changes are limited to installer messaging/flow control around Shakapacker setup failure, with regression tests covering the new behavior.

Overview
Prevents react_on_rails:install from printing the final “Successfully Installed” guidance when automatic shakapacker:install fails, by tracking an @shakapacker_setup_incomplete state.

When setup is incomplete, the generator now emits a dedicated warning message with manual recovery steps (bundle/shakapacker install + JS package install) and advises against running ./bin/dev; specs add coverage for both the incomplete-message path and the failure flag being set.

Written by Cursor Bugbot for commit 9a4eb58. Configure here.

Summary by CodeRabbit

  • Bug Fixes

    • Installer now reports incomplete Shakapacker setup with a clear next-steps warning; post-install messaging is consistently shown when prerequisites pass.
    • When Redux is selected during install via the installer flow, redundant post-install instructions are suppressed.
    • Installer guidance now uses the detected package manager for accurate install commands.
  • Tests

    • Added coverage for incomplete-installation scenarios and installer-invoked Redux behavior.
  • Documentation

    • Cosmetic formatting and minor troubleshooting clarity updates.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 15, 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

Walkthrough

Tracks incomplete Shakapacker setup in the install generator to suppress final success/quick-start messaging when Shakapacker install is skipped or fails; adds an invoked_by_install option to the Redux generator to suppress its standalone messages; exposes detect_package_manager and updates tests accordingly.

Changes

Cohort / File(s) Summary
Install generator & tests
react_on_rails/lib/generators/react_on_rails/install_generator.rb, react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb
Adds @shakapacker_setup_incomplete state and helper methods shakapacker_setup_incomplete? and incomplete_installation_message. ensure_shakapacker_installed marks incomplete when install is skipped/failed. add_post_install_message emits incomplete-install guidance early. Tests added/updated to assert state and messaging variations.
Redux generator option
react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb
Adds hidden boolean invoked_by_install class option. add_redux_specific_messages short-circuits when invoked by the installer to avoid duplicate post-install output.
Generator messaging visibility
react_on_rails/lib/generators/react_on_rails/generator_messages.rb
Makes detect_package_manager public (public :detect_package_manager) without behavioral changes.
Docs cosmetic
docs/README.md, docs/oss/migrating/rsc-troubleshooting.md
Whitespace/formatting adjustments and two <!-- prettier-ignore --> markers added; no functional changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Installer as InstallGenerator
  participant Shaka as ShakapackerTask
  participant ReduxGen as ReactWithReduxGenerator
  participant Messages as GeneratorMessages

  Installer->>Shaka: check/install shakapacker
  alt Shakapacker installed
    Shaka-->>Installer: success
    Installer->>ReduxGen: invoke (invoked_by_install: true) [if redux selected]
    ReduxGen-->>Installer: returns (no standalone redux messages)
    Installer->>Messages: add_post_install_message (normal success flow)
  else Shakapacker skipped/failed
    Shaka-->>Installer: failed/skipped
    Installer->>Installer: set `@shakapacker_setup_incomplete` = true
    Installer->>ReduxGen: invoke (invoked_by_install: true) [if redux selected]
    ReduxGen-->>Installer: returns (no standalone redux messages)
    Installer->>Messages: add_post_install_message -> emits incomplete_installation_message
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through scripts and set a little flag,
To hush the party when a pack went snag.
If Shakapacker missed its mark, I warn and pause,
I nibble bugs and cheer for safer cause. 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive Documentation changes (docs/README.md, docs/oss/migrating/rsc-troubleshooting.md) appear unrelated to shakapacker-failure messaging; unclear if these are supporting changes or separate cleanup work. Clarify whether documentation changes are necessary for this feature or should be submitted separately to maintain focused scope.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly summarizes the main change: showing incomplete install message when shakapacker setup fails, directly addressing issue #2600.
Linked Issues check ✅ Passed Changes implement all key requirements: track shakapacker setup failure, suppress success banner when install incomplete, emit incomplete-install guidance with next steps, and add regression tests covering the failure flow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jg-codex/issue-2600-install-incomplete-banner
📝 Coding Plan
  • Generate coding plan for human review comments

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

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Redux path bypasses incomplete installation check
    • I made InstallGenerator always emit the post-install message and removed Redux generator’s duplicate success banner so Redux installs now show the incomplete-installation warning when Shakapacker setup fails.

Create PR

Or push these changes by commenting:

@cursor push 96e6670af6
Preview (96e6670af6)
diff --git a/react_on_rails/lib/generators/react_on_rails/install_generator.rb b/react_on_rails/lib/generators/react_on_rails/install_generator.rb
--- a/react_on_rails/lib/generators/react_on_rails/install_generator.rb
+++ b/react_on_rails/lib/generators/react_on_rails/install_generator.rb
@@ -102,9 +102,7 @@
         if installation_prerequisites_met? || options.ignore_warnings?
           invoke_generators
           add_bin_scripts
-          # Only add the post install message if not using Redux
-          # Redux generator handles its own messages
-          add_post_install_message unless options.redux?
+          add_post_install_message
         else
           error = <<~MSG.strip
             🚫 React on Rails generator prerequisites not met!

diff --git a/react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb b/react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb
--- a/react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb
+++ b/react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb
@@ -90,10 +90,7 @@
       end
 
       def add_redux_specific_messages
-        # Append Redux-specific post-install instructions
-        GeneratorMessages.add_info(
-          GeneratorMessages.helpful_message_after_installation(component_name: "HelloWorldApp", route: "hello_world")
-        )
+        # InstallGenerator handles post-install messaging for all install modes.
       end
 
       private

diff --git a/react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb b/react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb
--- a/react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb
+++ b/react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb
@@ -1673,6 +1673,24 @@
       expect(output_text).not_to include("🎉 React on Rails Successfully Installed!")
       expect(output_text).not_to include("📋 QUICK START:")
     end
+
+    specify "shows incomplete-installation guidance for redux installs when shakapacker setup fails" do
+      install_generator = described_class.new([], { redux: true, ignore_warnings: true })
+      allow(install_generator).to receive(:installation_prerequisites_met?).and_return(true)
+      allow(install_generator).to receive(:invoke_generators) do
+        install_generator.instance_variable_set(:@shakapacker_setup_incomplete, true)
+      end
+      allow(install_generator).to receive(:add_bin_scripts)
+      allow(install_generator).to receive(:print_generator_messages)
+
+      install_generator.run_generators
+      output_text = GeneratorMessages.output.join("\n")
+
+      expect(output_text).to include("React on Rails installation is incomplete")
+      expect(output_text).to include("Avoid running ./bin/dev")
+      expect(output_text).not_to include("🎉 React on Rails Successfully Installed!")
+      expect(output_text).not_to include("📋 QUICK START:")
+    end
   end
 
   describe "--pretend mode behavior" do

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 15, 2026

Greptile Summary

This PR fixes #2600 by tracking when automatic Shakapacker installation fails during react_on_rails:install (via a @shakapacker_setup_incomplete instance variable) and replacing the misleading success banner with an explicit "installation incomplete" warning that lists concrete next steps. Two regression tests are added to verify the new behavior.

  • Introduces @shakapacker_setup_incomplete flag set when install_shakapacker returns false, and a shakapacker_setup_incomplete? predicate to query it
  • add_post_install_message now short-circuits with a warning when the flag is set, suppressing the success banner and ./bin/dev guidance
  • The incomplete_installation_message provides numbered remediation steps using the detected package manager
  • Gap: The --redux code path bypasses add_post_install_message entirely (line 107: unless options.redux?), so ReactWithReduxGenerator#add_redux_specific_messages can still emit the success banner after a shakapacker failure with --redux --ignore-warnings

Confidence Score: 3/5

  • The PR correctly fixes the primary (non-Redux) install flow but leaves the --redux variant exposed to the same misleading success banner.
  • The core logic is sound and well-tested for the non-Redux path. However, the --redux --ignore-warnings code path still bypasses the new incomplete-installation check, which means the original bug (Generator still shows overall success banner after failed Shakapacker install with --ignore-warnings #2600) can still manifest when Redux is enabled. This is a meaningful gap in the fix.
  • react_on_rails/lib/generators/react_on_rails/install_generator.rb — line 107 where add_post_install_message is skipped for Redux installs

Important Files Changed

Filename Overview
react_on_rails/lib/generators/react_on_rails/install_generator.rb Adds @shakapacker_setup_incomplete tracking and incomplete-installation message. The non-Redux path is correctly handled, but the --redux code path still bypasses the new check and can show a misleading success banner.
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb Adds two focused regression tests for the incomplete-install flow. Tests correctly validate the non-Redux path; no coverage for the --redux variant of the same bug.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[run_generators] --> B{prerequisites met OR ignore_warnings?}
    B -->|No| Z[Add error, skip install]
    B -->|Yes| C[invoke_generators]
    C --> D[ensure_shakapacker_installed]
    D --> E{shakapacker_configured?}
    E -->|Yes| F[Continue]
    E -->|No| G[install_shakapacker]
    G -->|Success| H[finalize_shakapacker_setup]
    G -->|Failure| I["@shakapacker_setup_incomplete = true"]
    H --> F
    I --> F
    F --> J{options.redux?}
    J -->|Yes| K[invoke ReactWithReduxGenerator]
    J -->|No| L[invoke ReactNoReduxGenerator]
    K --> M[add_redux_specific_messages]
    M --> N["Shows success banner ⚠️ even if incomplete"]
    L --> O[add_post_install_message]
    O --> P{shakapacker_setup_incomplete?}
    P -->|Yes| Q["Shows incomplete warning ✅"]
    P -->|No| R["Shows success banner ✅"]
Loading

Comments Outside Diff (1)

  1. react_on_rails/lib/generators/react_on_rails/install_generator.rb, line 107 (link)

    Redux path still shows success banner after shakapacker failure

    When --redux --ignore-warnings is used and shakapacker fails, add_post_install_message is skipped (guarded by unless options.redux?), and the ReactWithReduxGenerator#add_redux_specific_messages unconditionally calls GeneratorMessages.helpful_message_after_installation — displaying the "Successfully Installed!" banner even though shakapacker setup is incomplete. This is the same misleading behavior this PR aims to fix, but for the --redux code path.

    Consider either:

    1. Checking shakapacker_setup_incomplete? in run_generators before the unless options.redux? guard (so the incomplete message is emitted for both Redux and non-Redux), or
    2. Always calling add_post_install_message (which now handles the incomplete case) and having the Redux generator skip its own success message when invoked via install.

Last reviewed commit: 9a4eb58

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 15, 2026

Review

The fix is well-scoped and logic is correct for the non-Redux path. A few issues worth addressing:

Bug: Redux + Shakapacker failure still shows success banner

When rails generate react_on_rails:install --redux is run and install_shakapacker returns false, the incomplete-installation message is never shown. The flow: (1) invoke_generators sets @shakapacker_setup_incomplete = true; (2) add_post_install_message unless options.redux? is skipped; (3) ReactWithReduxGenerator#add_redux_specific_messages runs independently and emits the success banner regardless. This PR fixes the non-Redux path but the Redux path has the same bug as #2600. The flag lives on the InstallGenerator instance and the Redux generator has no access to it. Suggested fix: forward it as a generator option like shakapacker_just_installed and guard add_redux_specific_messages on it.

Potentially misleading step 4 in the incomplete-installation message

Step 4 suggests rails generate react_on_rails:install --skip. In Rails generators, --skip means skip any file that already exists and is not a RoR-specific option. After manually fixing Shakapacker, users may need --force to overwrite files the Shakapacker installer placed, or a plain re-run with no flag. The wording could mislead users into thinking --skip has a special meaning here.

Minor: redundant !! in shakapacker_setup_incomplete?

The predicate uses !!@shakapacker_setup_incomplete. Since the flag is always assigned true or false (and nil before ensure_shakapacker_installed runs, where !!nil == false is correct anyway), the double-negation adds noise. @shakapacker_setup_incomplete == true is clearer.

Missing test: Redux + Shakapacker failure path

No test verifies that --redux + a failing install_shakapacker suppresses the success banner. Once the Redux gap is fixed, a test analogous to the new failure spec should cover that path.

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
react_on_rails/lib/generators/react_on_rails/install_generator.rb (1)

307-332: ⚠️ Potential issue | 🔴 Critical

Redux generator doesn't suppress success messages when Shakapacker setup fails.

The concern is valid. When --redux is used, add_post_install_message is skipped (line 107), but the React Redux generator's add_redux_specific_messages method runs unconditionally and displays a success message regardless of Shakapacker setup status. The @shakapacker_setup_incomplete flag from install_generator is not passed to the child generator instance, so the incomplete setup warning never appears in the Redux flow.

The redux generator should either:

  1. Receive and check the shakapacker_setup_incomplete state from the parent generator, or
  2. Have add_post_install_message called even when --redux is used to ensure the incomplete installation warning is shown
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb` around
lines 307 - 332, The Redux child generator is displaying success messages even
when Shakapacker setup failed because the `@shakapacker_setup_incomplete` flag
from InstallGenerator is never passed; update the Redux generator to accept and
expose the parent's shakapacker state (e.g., add an attr_accessor or option like
shakapacker_setup_incomplete and a predicate shakapacker_setup_incomplete?), set
that flag on the child instance when the parent invokes the Redux generator in
InstallGenerator, and then modify add_redux_specific_messages to check
shakapacker_setup_incomplete? and either suppress the success message and call
GeneratorMessages.add_warning(incomplete_installation_message) or delegate to
add_post_install_message when incomplete instead of unconditionally logging
success.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb`:
- Around line 307-332: The Redux child generator is displaying success messages
even when Shakapacker setup failed because the `@shakapacker_setup_incomplete`
flag from InstallGenerator is never passed; update the Redux generator to accept
and expose the parent's shakapacker state (e.g., add an attr_accessor or option
like shakapacker_setup_incomplete and a predicate
shakapacker_setup_incomplete?), set that flag on the child instance when the
parent invokes the Redux generator in InstallGenerator, and then modify
add_redux_specific_messages to check shakapacker_setup_incomplete? and either
suppress the success message and call
GeneratorMessages.add_warning(incomplete_installation_message) or delegate to
add_post_install_message when incomplete instead of unconditionally logging
success.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 181b5c87-76ac-4f43-87bf-ddda57de95bd

📥 Commits

Reviewing files that changed from the base of the PR and between 68a6f04 and 9a4eb58.

📒 Files selected for processing (2)
  • react_on_rails/lib/generators/react_on_rails/install_generator.rb
  • react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
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

🧹 Nitpick comments (1)
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb (1)

1664-1673: This spec doesn’t lock down the duplicate-message regression yet.

It still passes if invoke_generators stops forwarding invoked_by_install: true, because run_generators calls add_post_install_message either way. Please assert that react_on_rails:react_with_redux is invoked with hash_including(invoked_by_install: true) somewhere around this path.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb`
around lines 1664 - 1673, The spec must assert that the redux generator is
invoked with invoked_by_install: true to catch the duplicate-message regression;
update the example in install_generator_spec to expect the generator invocation
that triggers react_on_rails:react_with_redux to include
hash_including(invoked_by_install: true) (e.g. add an expectation around the
call that ultimately calls react_on_rails:react_with_redux or the invocation
helper used by run_generators/invoke_generators such that it verifies the args
include invoked_by_install: true), while keeping the existing stubs for
installation_prerequisites_met?, add_bin_scripts, and print_generator_messages.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb`:
- Around line 333-347: The recovery banner method
incomplete_installation_message interpolates
GeneratorMessages.detect_package_manager directly, which can be nil; update it
to handle a nil return by using a fallback generic instruction (e.g. "install
your JavaScript dependencies" or "install dependencies") for step 3 instead of
"#{package_manager} install", so change the interpolation to use a conditional
based on detect_package_manager (reference incomplete_installation_message and
GeneratorMessages.detect_package_manager) and wrap the chosen string with
Rainbow like the other steps.

---

Nitpick comments:
In `@react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb`:
- Around line 1664-1673: The spec must assert that the redux generator is
invoked with invoked_by_install: true to catch the duplicate-message regression;
update the example in install_generator_spec to expect the generator invocation
that triggers react_on_rails:react_with_redux to include
hash_including(invoked_by_install: true) (e.g. add an expectation around the
call that ultimately calls react_on_rails:react_with_redux or the invocation
helper used by run_generators/invoke_generators such that it verifies the args
include invoked_by_install: true), while keeping the existing stubs for
installation_prerequisites_met?, add_bin_scripts, and print_generator_messages.
🪄 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: 0ecf95f0-c393-4d59-a044-b6de02dac0ca

📥 Commits

Reviewing files that changed from the base of the PR and between 9a4eb58 and 18eb81f.

📒 Files selected for processing (3)
  • react_on_rails/lib/generators/react_on_rails/install_generator.rb
  • react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb
  • react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/oss/migrating/rsc-troubleshooting.md (1)

378-392: ⚠️ Potential issue | 🔴 Critical

The ('use client') syntax is incorrect and will not work as a directive.

JavaScript directive prologues (like 'use client' and 'use strict') must be bare string literals without parentheses. Wrapping the string in parentheses converts it into an expression statement, which is a no-op and will not mark the file as a Client Component.

The examples on lines 381 and 392 marked as "GOOD" will actually fail silently—React will treat these files as Server Components.

Proposed fix
 // BAD: Directive after imports
 import { useState } from 'react';
-('use client'); // Too late -- will not work
+'use client'; // Too late -- will not work

 // GOOD: Directive before everything (comments allowed above)
-('use client');
+'use client';
 import { useState } from 'react';
 // GOOD
-('use client');
+'use client';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/oss/migrating/rsc-troubleshooting.md` around lines 378 - 392, The
examples use parentheses and backticks around the directive (e.g., "('use
client')" and "`use client`"), which turn the directive into an expression and
will not mark the file as a Client Component; replace every occurrence of
("('use client')") with a bare string literal "'use client'" as the very first
statement (comments allowed above) and replace any backticked `use client`
examples with the bare quoted form "'use client'"; ensure the "GOOD" examples
and the "Must Use Quotes, Not Backticks" section show the directive as a bare
string literal at top of file (no parentheses, no backticks).
🧹 Nitpick comments (1)
react_on_rails/lib/generators/react_on_rails/install_generator.rb (1)

334-336: Consider exposing detect_package_manager publicly instead of using send.

Calling a private method via send(:detect_package_manager) bypasses encapsulation. Since this method is now needed by multiple callers (react_with_redux_generator.rb at lines 91-93 and here), consider making it a public class method on GeneratorMessages.

Sketch
 # In generator_messages.rb
-private
-
-def detect_package_manager
+def self.detect_package_manager
   # ...
 end

 # In install_generator.rb
-package_manager = GeneratorMessages.send(:detect_package_manager)
+package_manager = GeneratorMessages.detect_package_manager
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb` around
lines 334 - 336, Make GeneratorMessages.detect_package_manager a public class
method (remove or move it out of private scope) so callers can call it directly;
then replace uses of GeneratorMessages.send(:detect_package_manager) in
incomplete_installation_message and the calls in react_with_redux_generator
(around the code that references lines 91-93) with
GeneratorMessages.detect_package_manager. Ensure the method remains a class
method (self.detect_package_manager) and update any tests or visibility
modifiers accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@docs/oss/migrating/rsc-troubleshooting.md`:
- Around line 378-392: The examples use parentheses and backticks around the
directive (e.g., "('use client')" and "`use client`"), which turn the directive
into an expression and will not mark the file as a Client Component; replace
every occurrence of ("('use client')") with a bare string literal "'use client'"
as the very first statement (comments allowed above) and replace any backticked
`use client` examples with the bare quoted form "'use client'"; ensure the
"GOOD" examples and the "Must Use Quotes, Not Backticks" section show the
directive as a bare string literal at top of file (no parentheses, no
backticks).

---

Nitpick comments:
In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb`:
- Around line 334-336: Make GeneratorMessages.detect_package_manager a public
class method (remove or move it out of private scope) so callers can call it
directly; then replace uses of GeneratorMessages.send(:detect_package_manager)
in incomplete_installation_message and the calls in react_with_redux_generator
(around the code that references lines 91-93) with
GeneratorMessages.detect_package_manager. Ensure the method remains a class
method (self.detect_package_manager) and update any tests or visibility
modifiers accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 605a356c-1c4d-4b6e-af26-7293fbc1a15d

📥 Commits

Reviewing files that changed from the base of the PR and between 18eb81f and 2ceae77.

📒 Files selected for processing (4)
  • docs/README.md
  • docs/oss/migrating/rsc-troubleshooting.md
  • react_on_rails/lib/generators/react_on_rails/install_generator.rb
  • react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb
✅ Files skipped from review due to trivial changes (1)
  • docs/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb

Comment thread docs/oss/migrating/rsc-troubleshooting.md Outdated
Comment thread docs/oss/migrating/rsc-troubleshooting.md Outdated
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 15, 2026

Review

The core fix (tracking @shakapacker_setup_incomplete and suppressing the success banner) is correct and well-motivated. Test coverage for the new state is solid. A few issues worth addressing:

Blocking

('use client') in docs is not a valid React directive (inline comments on rsc-troubleshooting.md).
The change replaces bare string literals 'use client' with parenthesised expressions ('use client'). Per the ECMAScript directive-prologue grammar, only a bare string literal as an expression statement qualifies. The parenthesised form is a ParenthesizedExpression and will not be recognised as a use-client boundary by React / bundlers. The "GOOD" code examples now demonstrate incorrect usage. This looks like an accidental formatter change — please revert to 'use client'.

Non-blocking

GeneratorMessages.send(:detect_package_manager) vs direct call (inline comment on install_generator.rb:335).
react_with_redux_generator.rb already calls GeneratorMessages.detect_package_manager directly. Using send here is inconsistent and unnecessary — either call it directly or surface it as public.

detect_package_manager never returns nil (inline comment on install_generator.rb:334–336).
The implementation always returns a string (defaults to "npm"), so the package_manager ? ... : "install JavaScript dependencies" guard is dead code. The spec testing the nil branch stubs an impossible runtime state. Worth aligning the implementation and the guard.

Comment thread react_on_rails/lib/generators/react_on_rails/generator_messages.rb Outdated
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 15, 2026

Overall: solid fix. Minor concerns posted as inline comments.

Comment thread react_on_rails/lib/generators/react_on_rails/generator_messages.rb Outdated
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 15, 2026

Review Summary

The fix is correct and well-scoped. Tracking @shakapacker_setup_incomplete and gating the success banner on it is the right approach for the issue. The Redux deduplication via invoked_by_install: is clean. A few observations:

Logic / Design

add_bin_scripts runs on failed setup (see inline): When Shakapacker fails, bin/dev is still created on disk, and the incomplete-install message then says "Avoid running ./bin/dev". This is called out in the warning copy ("Some generator files may have been partially created"), so it's not a bug, but the intent isn't obvious from the code. Worth a comment at the call site.

--force in step 4 of the incomplete message: Re-running with --force would overwrite any customizations a user made to files that were partially generated. This is the right suggestion for most users, but phrasing it as "add --force if needed" rather than just --force is good — no change needed, just worth confirming that's intentional.

Pretend mode + incomplete setup: In --pretend mode with an unconfigured Shakapacker, @shakapacker_setup_incomplete is explicitly set to false before the pretend early-return, so pretend runs will still show the success banner. That seems correct (pretend simulates success).

Code Style

  • public :detect_package_manager after a private block works but is harder to follow than moving the method above private (inline comment posted).
  • @shakapacker_setup_incomplete == true strict comparison is unnecessary given the ivar is always initialized before use (inline comment posted).

Tests

Good coverage of the new paths. One minor note: the new unit-test specs ("shows incomplete-installation guidance...", "incomplete-installation guidance uses detected package manager...") rely on before { GeneratorMessages.clear } from the enclosing describe block — that's fine, just worth keeping in mind if those tests are ever moved.

Overall this is a solid, low-risk fix. The three inline comments are all minor.

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.

🧹 Nitpick comments (1)
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb (1)

1639-1660: Extract repeated simulated Shakapacker fixture setup into a helper.

Both examples repeat the same 4 simulate_existing_file calls; pulling this into a local helper would reduce duplication and simplify future updates.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb`
around lines 1639 - 1660, The tests repeat four simulate_existing_file calls to
stub Shakapacker artifacts; extract those into a helper method (e.g., define a
private helper like shakapacker_fixtures or add_shakapacker_files) and call it
from both examples inside the run_generator_test_with_args blocks; update the
two specs that currently call simulate_existing_file("bin/shakapacker"...),
simulate_existing_file("bin/shakapacker-dev-server"...),
simulate_existing_file("config/shakapacker.yml"...), and
simulate_existing_file("config/webpack/webpack.config.js"...) to invoke the new
helper instead so the duplicated setup is centralized and easier to maintain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb`:
- Around line 1639-1660: The tests repeat four simulate_existing_file calls to
stub Shakapacker artifacts; extract those into a helper method (e.g., define a
private helper like shakapacker_fixtures or add_shakapacker_files) and call it
from both examples inside the run_generator_test_with_args blocks; update the
two specs that currently call simulate_existing_file("bin/shakapacker"...),
simulate_existing_file("bin/shakapacker-dev-server"...),
simulate_existing_file("config/shakapacker.yml"...), and
simulate_existing_file("config/webpack/webpack.config.js"...) to invoke the new
helper instead so the duplicated setup is centralized and easier to maintain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ac626ea1-3123-4f88-895c-4af1adbc8e4f

📥 Commits

Reviewing files that changed from the base of the PR and between 4cda9ab and 60ef8f9.

📒 Files selected for processing (1)
  • react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
Comment thread react_on_rails/lib/generators/react_on_rails/generator_messages.rb
Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 15, 2026

Review: Fix #2600 – incomplete install message after Shakapacker failure

Overall this is a clean, well-scoped fix. The @shakapacker_setup_incomplete flag approach is clear, the bun.lock additions are consistent across all three detection sites, the invoked_by_install flag elegantly prevents duplicate Redux messages, and the test coverage is solid. A few things worth noting:

Logic gap: gemfile-add failure path doesn't set the flag directly

ensure_shakapacker_in_gemfile failure (with --ignore-warnings) doesn't set @shakapacker_setup_incomplete itself — the flag only gets set later when install_shakapacker inevitably fails too. This works in practice but is an indirect dependency. See inline comment on lines 262–266.

Minor duplication between recovery_working_tree_note and recovery_working_tree_step

The two helpers carry identical prose; the only difference is the numbered prefix and .chomp. If the wording changes it'll need to be updated in two places. See inline comment on lines 349–363.

detect_package_manager is now public but has an implicit Dir.pwd dependency

The method was moved out of private intentionally (needed by install_generator.rb), but the dependency on Dir.pwd being set to the Rails root is invisible from the call site. A brief comment on the method would help future callers.

Test: ignore_warnings: true is load-bearing in the gemfile-error spec

Without that option the method raises Thor::Error and the assertions never run. A comment would save the next reader from wondering if they can simplify the options hash.

None of these are blockers — the fix is correct and the regression tests cover the critical path.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 15, 2026

Review: Fix #2600 — incomplete install message after Shakapacker failure

Overall this is a well-structured fix with good test coverage. The core logic (tracking @shakapacker_setup_incomplete and suppressing the success banner) is sound, and the bun.lock support added consistently across all three package-manager detection methods is a nice cleanup.

A few things worth addressing:

Minor issues

Test regex excludes bun (see inline comment) — two existing test expectations use /bundle && (npm|yarn|pnpm) install/ which would fail in a Bun project.

--pro dropped silently when --rsc is also specified (see inline comment) — recovery_install_command excludes --pro when use_rsc? is true. If --pro --rsc is a supported combination, users would be told to re-run without --pro, getting a different install result.

install_shakapacker is still attempted when ensure_shakapacker_in_gemfile returns false — this appears intentional (tested), but worth a comment in the code since it's not obvious why you'd try to install when the Gemfile step failed. Users who manually added shakapacker already would benefit from this, but the reasoning isn't stated.

Positive notes

  • shakapacker_setup_incomplete? using == true instead of a truthy check is a clean guard against nil-vs-false ambiguity.
  • The ensure_shakapacker_in_gemfile boolean return is a cleaner API than the previous implicit nil.
  • invoked_by_install: true on the Redux generator is the right way to avoid duplicate post-install messages without special-casing in the caller.

@@ -1660,6 +1666,105 @@ class ActiveSupport::TestCase
expect(output_text).to match(/bundle && (npm|yarn|pnpm) install/)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This regex doesn't include bun, so the test would fail if the test environment has a bun.lock or bun.lockb file. The same issue exists on line 1650 in the base generator test. Now that Bun is detected in detect_package_manager, the expected install command could be bun install.

Suggested change
expect(output_text).to match(/bundle && (npm|yarn|pnpm) install/)
expect(output_text).to match(/bundle && (npm|yarn|pnpm|bun) install/)

flags << "--rsc"
elsif options.pro?
flags << "--pro"
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If --pro and --rsc are both specified, --pro is silently dropped from the recovery command. If this combination is valid/supported, users would be instructed to re-run without --pro, potentially getting a different install outcome.

If --pro and --rsc are mutually exclusive, a comment here (or a guard in the option parsing) would make this explicit. If they can coexist, consider:

Suggested change
end
if use_rsc?
flags << "--rsc"
flags << "--pro" if options.pro?
elsif options.pro?
flags << "--pro"
end

@justin808 justin808 merged commit 61fb65a into master Mar 16, 2026
35 checks passed
@justin808 justin808 deleted the jg-codex/issue-2600-install-incomplete-banner branch March 16, 2026 00:02
justin808 added a commit that referenced this pull request Mar 16, 2026
….rc.10

* origin/master:
  Fix #2600: show incomplete install message after shakapacker failure (#2613)
  Add Pro vs OSS feature comparison table to README and docs (#2623)
  Normalize Pro Gemfile.lock platforms (#2624)
justin808 added a commit that referenced this pull request Mar 30, 2026
…2613)

## Summary
- track when automatic Shakapacker installation fails during
`react_on_rails:install`
- suppress the final success banner in that case
- emit explicit "installation incomplete" guidance instead (without
suggesting `./bin/dev`)
- add regression tests for failed Shakapacker install flow and
incomplete-message behavior

## Why
Fixes #2600: with `--ignore-warnings`, a failed `shakapacker:install`
previously still ended with `🎉 React on Rails Successfully Installed!`,
which was misleading when required Shakapacker files were missing.

## Testing
- `bundle exec rspec
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb:1660
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb:1895`
- `bundle exec rubocop
react_on_rails/lib/generators/react_on_rails/install_generator.rb
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: changes are limited to installer messaging/flow control
around Shakapacker setup failure, with regression tests covering the new
behavior.
> 
> **Overview**
> Prevents `react_on_rails:install` from printing the final
“Successfully Installed” guidance when automatic `shakapacker:install`
fails, by tracking an `@shakapacker_setup_incomplete` state.
> 
> When setup is incomplete, the generator now emits a dedicated warning
message with manual recovery steps (bundle/shakapacker install + JS
package install) and advises against running `./bin/dev`; specs add
coverage for both the incomplete-message path and the failure flag being
set.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9a4eb58. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Installer now reports incomplete Shakapacker setup with a clear
next-steps warning; post-install messaging is consistently shown when
prerequisites pass.
* When Redux is selected during install via the installer flow,
redundant post-install instructions are suppressed.
* Installer guidance now uses the detected package manager for accurate
install commands.

* **Tests**
* Added coverage for incomplete-installation scenarios and
installer-invoked Redux behavior.

* **Documentation**
  * Cosmetic formatting and minor troubleshooting clarity updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ihabadham <[email protected]>
justin808 added a commit that referenced this pull request Apr 6, 2026
…2613)

## Summary
- track when automatic Shakapacker installation fails during
`react_on_rails:install`
- suppress the final success banner in that case
- emit explicit "installation incomplete" guidance instead (without
suggesting `./bin/dev`)
- add regression tests for failed Shakapacker install flow and
incomplete-message behavior

## Why
Fixes #2600: with `--ignore-warnings`, a failed `shakapacker:install`
previously still ended with `🎉 React on Rails Successfully Installed!`,
which was misleading when required Shakapacker files were missing.

## Testing
- `bundle exec rspec
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb:1660
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb:1895`
- `bundle exec rubocop
react_on_rails/lib/generators/react_on_rails/install_generator.rb
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: changes are limited to installer messaging/flow control
around Shakapacker setup failure, with regression tests covering the new
behavior.
> 
> **Overview**
> Prevents `react_on_rails:install` from printing the final
“Successfully Installed” guidance when automatic `shakapacker:install`
fails, by tracking an `@shakapacker_setup_incomplete` state.
> 
> When setup is incomplete, the generator now emits a dedicated warning
message with manual recovery steps (bundle/shakapacker install + JS
package install) and advises against running `./bin/dev`; specs add
coverage for both the incomplete-message path and the failure flag being
set.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9a4eb58. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Installer now reports incomplete Shakapacker setup with a clear
next-steps warning; post-install messaging is consistently shown when
prerequisites pass.
* When Redux is selected during install via the installer flow,
redundant post-install instructions are suppressed.
* Installer guidance now uses the detected package manager for accurate
install commands.

* **Tests**
* Added coverage for incomplete-installation scenarios and
installer-invoked Redux behavior.

* **Documentation**
  * Cosmetic formatting and minor troubleshooting clarity updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ihabadham <[email protected]>
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.

Generator still shows overall success banner after failed Shakapacker install with --ignore-warnings

2 participants