Skip to content

Hide legacy Redux install generator path#4277

Merged
justin808 merged 17 commits into
mainfrom
codex/v17-redux-generator-policy-4272-4273
Jul 1, 2026
Merged

Hide legacy Redux install generator path#4277
justin808 merged 17 commits into
mainfrom
codex/v17-redux-generator-policy-4272-4273

Conversation

@justin808

@justin808 justin808 commented Jun 29, 2026

Copy link
Copy Markdown
Member

Why

React on Rails V17 should steer new applications toward the default component/RSC path instead of presenting Redux as normal new-app guidance. This keeps the legacy Redux scaffold available for existing scripted installs and direct generator use while making clear that runtime Redux APIs remain supported for compatibility.

Closes #4272.
Closes #4273.

What changed

  • Hide the react_on_rails:install --redux / -R option from public generator help and usage text.
  • Add a hidden legacy Redux warning for the install path, including early-failure handling, error-first ordering, and best-effort warning cleanup that does not suppress primary generator output.
  • Queue the direct legacy Redux generator warning before fallible scaffold work, while suppressing the duplicate warning when invoked by install.
  • Keep react_on_rails:react_with_redux available, but warn that it is a hidden legacy generator path and not recommended for new apps.
  • Remove --redux from recovery guidance so failed new-app installs do not recommend Redux.
  • Add focused generator specs for the hidden/deprecated policy, direct generator messaging, warning ordering, suppression guard behavior, and warning-failure fallback behavior.
  • Add a changelog entry for the user-visible generator policy change.

Validation

  • PASS: .agents/bin/agent-workflow-seam-doctor
  • PASS: .agents/skills/pr-batch/bin/pr-security-preflight --repo shakacode/react_on_rails 4272 4273
  • PASS: bundle exec rspec spec/react_on_rails/generators/install_generator_spec.rb:4395 spec/react_on_rails/generators/install_generator_spec.rb:4544 spec/react_on_rails/generators/install_generator_spec.rb:4569 spec/react_on_rails/generators/install_generator_spec.rb:4751 spec/react_on_rails/generators/install_generator_spec.rb:4765 spec/react_on_rails/generators/install_generator_spec.rb:4785 spec/react_on_rails/generators/install_generator_spec.rb:4794 spec/react_on_rails/generators/install_generator_spec.rb:4806 from react_on_rails/ (8 examples)
  • PASS: BUNDLE_GEMFILE=../Gemfile bundle exec rubocop lib/generators/react_on_rails/install_generator.rb lib/generators/react_on_rails/react_with_redux_generator.rb spec/react_on_rails/generators/install_generator_spec.rb from react_on_rails/
  • PASS: git diff --check
  • PASS: pre-commit and pre-push hooks with repo-compatible lychee 0.23.0 on PATH

CI recommendation

Generator output and install behavior changed, so this PR should get force-full hosted CI rather than docs-only or no hosted CI.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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

The Redux install option is hidden from generator help and usage text. Legacy warnings are emitted for install and standalone Redux generator paths, and the Tailwind validation text now includes legacy and default install commands. Specs and the changelog were updated.

Changes

Redux Generator Deprecation (V17)

Layer / File(s) Summary
Hide Redux option in help and usage
react_on_rails/lib/generators/USAGE, react_on_rails/lib/generators/react_on_rails/base_generator.rb, react_on_rails/lib/generators/react_on_rails/install_generator.rb, react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb, CHANGELOG.md
class_option :redux is hidden and relabeled as legacy/internal in the base and install generators, the Redux usage section is removed from generator docs, policy specs cover the hidden option metadata, and the changelog records the deprecation.
Install generator legacy warning flow
react_on_rails/lib/generators/react_on_rails/install_generator.rb, react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb
Adds add_legacy_redux_install_warning, calls it from run_generators and Shakapacker error handlers, updates the inline comment for the hidden Redux path, and extends the install-path warning specs.
Standalone Redux generator warning and Tailwind text
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
Adds LEGACY_REDUX_GENERATOR_WARNING, emits it in post-install messaging, changes the --tailwind error text, and adjusts the standalone Redux validation specs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested labels

review-needed

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: hiding the legacy Redux install generator path.
Linked Issues check ✅ Passed The PR matches the linked issues by hiding/deprecating Redux in install help, warning on legacy use, and adding tests plus changelog coverage.
Out of Scope Changes check ✅ Passed The changes stay within the Redux deprecation/hiding work and related specs/docs, with no clear unrelated additions.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/v17-redux-generator-policy-4272-4273

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.

@justin808

Copy link
Copy Markdown
Member Author

+ci-status

@justin808

Copy link
Copy Markdown
Member Author

+ci-force-full

@github-actions

Copy link
Copy Markdown
Contributor

CI Status

Head SHA: 209470deb46f
Changed files: 6
Docs-only heuristic (matches ci-changes-detector metadata paths): no
ready-for-hosted-ci label: absent
force-full-hosted-ci label: absent
Current hosted-CI waiver: not present for this SHA

Only the required gate is active unless hosted CI is requested.

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown

Greptile Summary

This PR hides the legacy Redux installer path from normal generator guidance. The main changes are:

  • Hidden --redux and -R install options.
  • Legacy warnings for install Redux and direct Redux generator use.
  • Recovery text that no longer recommends Redux.
  • Specs and changelog coverage for the new generator policy.

Confidence Score: 4/5

The legacy Redux recovery path needs a fix before merging.

  • A failed hidden Redux install can be retried as a non-Redux install.
  • The standalone Redux+Tailwind error points users to a command that does not add Redux.
  • The help hiding and warning behavior otherwise matches the stated policy.

react_on_rails/lib/generators/react_on_rails/install_generator.rb; react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb

Important Files Changed

Filename Overview
CHANGELOG.md Adds a changelog entry for the hidden legacy Redux install policy.
react_on_rails/lib/generators/USAGE Removes public Redux installer guidance from the usage text.
react_on_rails/lib/generators/react_on_rails/base_generator.rb Marks the shared Redux option as hidden legacy plumbing.
react_on_rails/lib/generators/react_on_rails/install_generator.rb Adds the hidden install warning, but recovery retries now drop the Redux state.
react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb Adds direct Redux generator warnings and changes the standalone Tailwind rejection guidance.
react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb Adds focused specs for hidden Redux help, recovery text, and legacy warnings.

Comments Outside Diff (1)

  1. react_on_rails/lib/generators/react_on_rails/install_generator.rb, line 800-818 (link)

    P1 Recovery Drops Redux State

    When rails generate react_on_rails:install --redux --ignore-warnings gets far enough to create the legacy HelloWorldApp scaffold and then reports an incomplete install, this recovery command reruns without --redux. Following it switches the retry to the non-Redux HelloWorld branch, which can leave mixed generated files and a hello_world view pointing at a different component than the original legacy install requested.

    Context Used: CLAUDE.md (source)

Reviews (1): Last reviewed commit: "Hide legacy Redux install generator path" | Re-trigger Greptile

@github-actions github-actions Bot added force-full-hosted-ci Bypass optimized hosted CI selection and run all hosted suites ready-for-hosted-ci Run optimized hosted GitHub CI for this PR labels Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Force-Full Hosted CI Requested

Triggered 9 workflow(s) for 209470deb46f.
Mode: force-full hosted CI (bypasses optimized change selection).
Added ready-for-hosted-ci and force-full-hosted-ci, so future commits will bypass optimized hosted CI selection until +ci-stop-full is used.

View progress in the Actions tab.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 209470deb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

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)

800-819: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the recovery command faithful to the requested install path.

Line 818 now drops --redux, but the generator still materially branches on that flag in Lines 245-267 and in react_on_rails/lib/generators/react_on_rails/base_generator.rb. If shakapacker:install fails before the child generators run, the suggested rerun command replays the default HelloWorld flow instead of the originally requested legacy Redux scaffold. Preserve the legacy flag here, or append an explicit follow-up step to run rails generate react_on_rails:react_with_redux so recovery still reaches the same result.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb` around
lines 800 - 819, The recovery command in recovery_install_command is missing the
legacy --redux path, so reruns can fall back to the default HelloWorld scaffold
instead of the originally requested Redux setup. Update the flag assembly to
preserve the explicit redux choice alongside the existing bundler, RSC, pro, and
agent-files options, or otherwise ensure the suggested recovery flow invokes
react_with_redux. Keep the suggested command faithful to the same install path
chosen by options handling in InstallGenerator and BaseGenerator.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Around line 44-45: The changelog bullet in CHANGELOG.md is missing the
repository’s standard PR-link suffix. Update this existing entry to match the
surrounding changelog format by appending the required PR reference and author
attribution text, keeping the current summary intact while adding the usual “[PR
…](…) by […](…).” trailer.

---

Outside diff comments:
In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb`:
- Around line 800-819: The recovery command in recovery_install_command is
missing the legacy --redux path, so reruns can fall back to the default
HelloWorld scaffold instead of the originally requested Redux setup. Update the
flag assembly to preserve the explicit redux choice alongside the existing
bundler, RSC, pro, and agent-files options, or otherwise ensure the suggested
recovery flow invokes react_with_redux. Keep the suggested command faithful to
the same install path chosen by options handling in InstallGenerator and
BaseGenerator.
🪄 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: ca352ccc-25fa-4049-9ce2-37a84c2fbc18

📥 Commits

Reviewing files that changed from the base of the PR and between c7b54be and 209470d.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • react_on_rails/lib/generators/USAGE
  • react_on_rails/lib/generators/react_on_rails/base_generator.rb
  • 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
💤 Files with no reviewable changes (1)
  • react_on_rails/lib/generators/USAGE

Comment thread CHANGELOG.md Outdated
@justin808 justin808 force-pushed the codex/v17-redux-generator-policy-4272-4273 branch from 209470d to ba301d9 Compare June 29, 2026 03:53

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@react_on_rails/lib/generators/react_on_rails/install_generator.rb`:
- Around line 792-794: Update the guidance text in the install generator so the
suggested legacy scaffold command uses the gem convention with bundle exec.
Locate the user-facing message in the install generator around the
react_with_redux reference and change the command example to include bundle exec
for the rails generate invocation.
- Around line 789-795: The warning in install_generator currently sends users
with `--redux --tailwind` to the standalone `ReactWithReduxGenerator`, but that
path does not accept Tailwind. Update the message logic around the legacy Redux
warning to branch on `use_tailwind?`: either keep Tailwind users on the install
generator path or explicitly note that Tailwind must not be combined with the
standalone Redux generator. Make sure the text in
`GeneratorMessages.add_warning` matches the actual validation in
`ReactWithReduxGenerator#validate_standalone_tailwind`.

In `@react_on_rails/lib/generators/react_on_rails/react_with_redux_generator.rb`:
- Around line 162-168: The install command examples in the generator text should
be updated to use the repo-standard Ruby invocation. In the ReactOnRails
generator message, adjust both the legacy Redux/Tailwind and default Tailwind
install examples so they are prefixed with bundle exec, keeping the references
in react_with_redux_generator consistent with the gem’s command usage
guidelines.

In `@react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb`:
- Around line 4510-4514: The spec is asserting against rendered output even
though `add_legacy_redux_install_warning` only queues a message. Update the
example in `install_generator_spec.rb` to assert on the queued buffer exposed by
`GeneratorMessages.messages`, or explicitly call the print/render path before
checking `GeneratorMessages.output`. Use the existing
`add_legacy_redux_install_warning` and `GeneratorMessages` symbols to keep the
test aligned with the method’s actual behavior.
🪄 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: 7b8299d0-0b2d-48f6-9438-fb0a63bae172

📥 Commits

Reviewing files that changed from the base of the PR and between 209470d and ba301d9.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • react_on_rails/lib/generators/USAGE
  • react_on_rails/lib/generators/react_on_rails/base_generator.rb
  • 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
💤 Files with no reviewable changes (1)
  • react_on_rails/lib/generators/USAGE
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • react_on_rails/lib/generators/react_on_rails/base_generator.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 Outdated
Comment thread react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb Outdated
@justin808 justin808 force-pushed the codex/v17-redux-generator-policy-4272-4273 branch from ba301d9 to 55e928a Compare June 29, 2026 04:28
@justin808

Copy link
Copy Markdown
Member Author

Address-review checkpoint after the 55e928af7 push:

Fixed and resolved review threads for:

  • preserving --redux in recovery guidance,
  • keeping Redux+Tailwind users on the hidden install path,
  • adding bundle exec to generator command examples,
  • asserting queued GeneratorMessages.messages, and
  • adding the changelog PR/author suffix.

Validation rerun locally:

  • bundle exec rspec spec/react_on_rails/generators/install_generator_spec.rb:4497 spec/react_on_rails/generators/install_generator_spec.rb:4507 spec/react_on_rails/generators/install_generator_spec.rb:4517 spec/react_on_rails/generators/install_generator_spec.rb:4680
  • BUNDLE_GEMFILE=../Gemfile bundle exec rubocop lib/generators/react_on_rails/install_generator.rb lib/generators/react_on_rails/react_with_redux_generator.rb spec/react_on_rails/generators/install_generator_spec.rb
  • git diff --check
  • pre-commit and pre-push hooks passed with pinned lychee 0.23.0.

Current blocker is external: claude-review fails with is_error=true, cost 0, turns 1; the workflow says to rotate CLAUDE_CODE_OAUTH_TOKEN and update the repo secret. Hosted CI is still running on the force-full request.

@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code review posted via inline comments below.

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
@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code Review — PR #4277: Hide legacy Redux install generator path

Overview: This PR hides the `--redux` / `-R` flag from public generator help text, adds legacy deprecation warnings when the hidden path is used, and adds focused specs for the new policy. The approach is sound, but there are three issues worth addressing before merge.


Finding 1 — HIGH: print_generator_messages not guarded by ensure in react_with_redux_generator (line 147)

rsc_generator.rb and pro_generator.rb both use an ensure block to guarantee message flushing even when an earlier action raises:

# rsc_generator.rb / pro_generator.rb pattern
ensure
  print_generator_messages unless options[:invoked_by_install]
end

react_with_redux_generator.rb calls print_generator_messages inside the add_redux_specific_messages action body (line 147). This means:

  1. If any public action before add_redux_specific_messages raises (e.g. add_redux_npm_dependenciesinstall_packages_with_fallback queues a warning then propagates an exception), all queued GeneratorMessages are silently dropped — the user sees no output.
  2. The pre-existing GeneratorMessages.add_error queued inside unsupported_standalone_tailwind? (line 156) is also dropped when validate_standalone_tailwind raises Thor::Error, because add_redux_specific_messages never runs.

The fix mirrors the established pattern: wrap the public action sequence in a method that has an ensure block, or add an ensure to the outer generator invocation.


Finding 2 — MEDIUM: Deprecation warning emitted before the generator run (install_generator.rb line 201)

add_legacy_redux_install_warning   # queues "hidden legacy Redux" warning
invoke_generators                  # may fail

The legacy warning is enqueued before invoke_generators and then flushed unconditionally in the ensure block at line 219–225. If the install fails (Shakapacker missing, npm error, etc.), users see "this is a hidden legacy path" alongside the failure message — making it harder to triage the actual error. Moving the call to after invoke_generators (or inside add_post_install_message) would surface the warning only on success, matching the intent of react_with_redux_generator's add_redux_specific_messages.


Finding 3 — LOW: Non-Tailwind warning guidance creates a deprecation cycle

The add_legacy_redux_install_warning for non-Tailwind paths (install_generator.rb ~line 796) says:

"Existing apps that need the legacy Redux scaffold can use the hidden react_with_redux generator. That generator is also legacy and emits its own warning: bundle exec rails generate react_on_rails:react_with_redux"

A user who follows this instruction then receives LEGACY_REDUX_GENERATOR_WARNING from react_with_redux_generator, which says not to use that generator either. Neither warning tells them what to actually do if they need Redux scaffolding — both point away from themselves. Consider replacing the second branch's guidance with a direct pointer to the relevant wiki/docs page, or collapsing the two warnings into a single message that covers both paths.


Nit — LEGACY_REDUX_GENERATOR_WARNING as class-body constant (react_with_redux_generator.rb line 16)

Defining a string constant in the class body at load time (vs. inside a method) can trigger already initialized constant warnings if the file is ever loaded more than once (Spring reload, certain test setups). Other generators avoid class-body string constants. Low risk given the current require-based loading, but worth noting as a style divergence.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 264b3cc249

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code Review

This PR cleanly demotes the Redux generator path from first-class to legacy: hiding it from help text, adding targeted deprecation warnings, and narrowing the public surface area. The refactor of ReactWithReduxGenerator to a single public run_generator action is a nice structural improvement. Three findings worth addressing before merge.


Finding 1 — Legacy warning is silently dropped on infrastructure errors (medium)

add_legacy_redux_install_warning is called on line 202, after invoke_generators on line 201. Both handle_shakapacker_gemfile_error and handle_shakapacker_install_error can raise Thor::Error when prerequisites are not met (lines 1099 and 1123). If either fires, execution jumps to the ensure block and add_legacy_redux_install_warning is never reached — the deprecation warning is never queued.

A user who types rails generate react_on_rails:install --redux on a machine without Shakapacker will see the infrastructure error but no hint that --redux is a deprecated path. Since the flag is hidden from --help, they probably found it in old docs or a tutorial; the missing notice means they may retry with the same deprecated flag rather than switching to the recommended path.

Fix: call add_legacy_redux_install_warning before invoke_generators, or move it into the ensure block (where it guards on options.redux?).


Finding 2 — bundle exec prefix is inconsistent across new warnings vs. existing recovery messages (low)

add_legacy_redux_install_warning emits:

bundle exec rails generate react_on_rails:react_with_redux
bundle exec rails generate react_on_rails:install --redux --tailwind

But recovery_install_command (line 835) returns rails generate react_on_rails:install ... without bundle exec. That string is embedded in the incomplete-install guidance (line 882) and the shakapacker error recovery messages. A user who sees both messages in one terminal session gets contradictory command formats.


Finding 3 — run_generators integration test does not cover the new call (low)

The test at spec line 4384 stubs invoke_generators and asserts add_post_install_message is received, but says nothing about add_legacy_redux_install_warning. Removing or misplacing that call would go undetected. Adding expect(install_generator).to receive(:add_legacy_redux_install_warning) closes the gap.

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb Outdated
@justin808 justin808 force-pushed the codex/v17-redux-generator-policy-4272-4273 branch from 74c43d5 to de095e2 Compare June 29, 2026 11:02
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
@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review: Hide legacy Redux install generator path

Overall the design is solid. The layered _once / _once_safely pattern handles the early-failure and best-effort warning cases correctly, and the test suite covers the key behavioral guarantees (ordering, deduplication, retry on failure, suppression when invoked by install).

Issues

1. Hardcoded recovery command drops --typescript (line 795, install_generator.rb)
When --redux --tailwind --typescript are all passed, add_legacy_redux_install_warning shows rails generate react_on_rails:install --redux --tailwind, silently omitting --typescript. The equivalent else branch has no such issue because it points to react_with_redux with no flags. See inline comment.

2. Subtle retry behavior in _once worth a comment (lines 817–822, install_generator.rb)
@legacy_redux_install_warning_added is intentionally not set when the inner method raises — allowing _safely to retry on the next invocation. This is tested, but looks like a bug to future readers. A single comment guards against accidental "cleanup". See inline comment.

Positive observations

  • Consolidating ReactWithReduxGenerator into a single public run_generator with private helpers is a meaningful correctness fix: the old code exposed all the step methods as public Thor actions, meaning Thor would run them alphabetically (not in source order). The new structure guarantees the intended sequence.
  • GeneratorMessages.messages and GeneratorMessages.output are the same object (alias), so spec tests using either are equivalent.
  • The ensure placement in run_generators ensures print_generator_messages always fires and that the legacy Redux advisory never suppresses the primary failure details.

@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

test

@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary - PR 4277: Hide legacy Redux install generator path. Well-structured deprecation shim. The _once_safely guard pattern is sound defensive programming, the error-first message ordering is correctly enforced, and the test suite covers the key scenarios (retry on failure, idempotency, ordering assertions, suppression when invoked-by-install). The overall approach - hide from help, keep the path functional, emit a prominent advisory - is the right gradualism for a breaking-ish change. Architecture: PR consolidates all action methods under a single run_generator public method (making helpers private). Strictly cleaner but behavioral change - subclasses overriding previously-public action methods will no longer have those called automatically by Rails. Bug fix: The ensure block silently fixes a pre-existing bug where print_generator_messages was never called when the standalone react_with_redux generator ran. Nits (see inline comments): (1) product_stack_install_flag ends with explicit nil return - redundant. (2) Legacy docs URL inlined as local variable - a private constant would be easier to maintain. (3) String-index ordering assertions in specs correct but could use a comment. No security or performance concerns. LGTM with the nits above.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea62f23f9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

[
"Existing apps that need the legacy Redux scaffold can use the hidden react_with_redux generator. " \
"That generator is also legacy and emits its own warning:",
"rails generate react_on_rails:react_with_redux"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve TypeScript in Redux fallback command

When rails generate react_on_rails:install --redux --typescript is used without Tailwind, this warning tells users to switch to rails generate react_on_rails:react_with_redux, but that generator's :typescript option defaults to false and uses it to choose the .jsx/.js scaffold. In a TypeScript app, following the emitted command creates JavaScript Redux files instead of the TypeScript scaffold the original install requested; include --typescript in this command when options.typescript? is true.

Useful? React with 👍 / 👎.

@claude

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review

This PR hides the legacy --redux install-generator path from public help/usage, adds best-effort legacy-Redux warnings (queued before fallible work, deduplicated via a _once guard, and made non-fatal via a rescue StandardError wrapper), and refactors react_with_redux_generator.rb to consolidate its public Thor::Group commands into a single run_generator entry point with an ensure print_generator_messages block (mirroring the existing rsc_generator.rb/pro_generator.rb convention).

I traced the full warning/printing control flow (install → react_with_redux/rsc/pro sub-generator invocation, the invoked_by_install suppression flag, the add_legacy_redux_install_warning_once[_safely] guard, and both handle_shakapacker_*_error paths) against the new specs and didn't find a path that double-prints, drops, or mis-orders the warning relative to primary error/output. A few things worth calling out as positive side effects rather than concerns:

  • recovery_install_command previously dropped --tailwind from the suggested re-run command entirely (a real pre-existing bug); this PR fixes that via the new optional_install_flags helper.
  • react_with_redux_generator.rb previously never called print_generator_messages when run standalone (none of its public methods did, and Thor::Group doesn't auto-print queued GeneratorMessages), so errors/info queued via GeneratorMessages.add_error/add_info were silently dropped for direct rails generate react_on_rails:react_with_redux invocations. The new run_generator + ensure print_generator_messages unless options[:invoked_by_install] fixes this and brings it in line with the rsc_generator/pro_generator pattern.
  • Making the former public helper methods (validate_standalone_tailwind, create_redux_directories, etc.) private is safe — confirmed there are no other callers of these methods in the codebase, and invoke "react_on_rails:react_with_redux" from install_generator.rb doesn't target a specific command name, so it correctly falls through to the single remaining public run_generator command.

No correctness, security, or performance issues survived review. Nothing to flag.

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
@claude

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review summary

Reviewed the generator changes that hide the legacy --redux install path and add deprecation warnings for it and react_with_redux.

Code quality / correctness

  • The InstallGenerator#run_generators ensure-block + @legacy_redux_install_warning_added guard correctly produces exactly one warning regardless of which path (success, prerequisites-not-met, Shakapacker gemfile/install error) triggers it, and keeps it after the primary error/success output — verified by tracing through run_generators, handle_shakapacker_gemfile_error, and handle_shakapacker_install_error. The 'queue once, rescue-and-retry-on-failure' semantics in add_legacy_redux_install_warning_once/_safely are sound: a raised warning leaves the flag unset so a later call can retry, and failures only go to warn (stderr) without masking the primary generator output.
  • Converting ReactWithReduxGenerator's several public Thor 'tasks' into one private-method-calling run_generator (mirroring InstallGenerator#run_generators) is safe — Thor::Group dispatches all public instance methods in declaration order either way, and run_generator is now the only public method. As a side effect this fixes a real gap: previously the standalone generator never called print_generator_messages, so error/warning text queued via GeneratorMessages (e.g. the old --tailwind-not-supported message) was silently dropped when running rails generate react_on_rails:react_with_redux directly. Good catch/fix, even if not called out explicitly as a fix in the description.
  • recovery_install_command now also echoes --tailwind, which it previously omitted — another incidental but correct fix, covered by the updated spec.
  • No security concerns: package-manager allow-listing in build_install_args is unchanged, and nothing here touches user-controlled input in an unsafe way.

Issues found (posted inline)

  1. The docs this PR's warning links to (docs/oss/api-reference/generator-details.md, also linked from USAGE's 'More Details') aren't updated — it still presents --redux as a normal, non-deprecated --help option, and docs/oss/getting-started/tutorial.md's 'Appendix: Redux Integration' still tells new-app users to run --redux with no mention it's now a hidden/legacy path. That undercuts the PR's stated goal of steering new apps away from Redux guidance.
  2. Minor: in ReactWithReduxGenerator#run_generator, the legacy-warning is queued before the Tailwind-support validation, so the deprecation warning prints before the 'not supported' error for react_on_rails:react_with_redux --tailwind — the reverse of the careful error-first ordering this PR establishes (and tests) on the InstallGenerator side.

Tests/rubocop weren't re-run here (sandboxed environment blocked bundle exec), so I relied on static tracing plus the existing/updated spec coverage, which looks thorough for the warning-ordering and suppression-guard behaviors.

@justin808 justin808 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Submitting pending review replies from the stacked PR closeout.

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

@justin808 justin808 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Submitting pending review replies from the stacked PR closeout.

Comment thread react_on_rails/lib/generators/react_on_rails/install_generator.rb
@justin808 justin808 added this pull request to the merge queue Jul 1, 2026
Merged via the queue into main with commit edfa32a Jul 1, 2026
72 checks passed
@justin808 justin808 deleted the codex/v17-redux-generator-policy-4272-4273 branch July 1, 2026 06:41
justin808 added a commit that referenced this pull request Jul 1, 2026
…st-surface-4274

* origin/main:
  Docs: frame Redux as legacy shared-store guidance (#4278)
  Hide legacy Redux install generator path (#4277)
  Add typed Rails action helper (#4260)
  Add Rails response type generation (#4259)
  Remove stale Pro RSpec encoding workaround (#4291)
  [Pro] Fix Gemfile loader source encoding under C locale (#4281)

# Conflicts:
#	react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb
justin808 added a commit that referenced this pull request Jul 1, 2026
…ered-rsc-rendering

* origin/main:
  Adopt agent-workflow binstubs (.agents/bin/ + AGENTS.md pointer) (#4264)
  [codex] Wire release harnesses into CI (#4266)
  Document bounded coordination audit fallback (#4283)
  Docs: frame Redux as legacy shared-store guidance (#4278)
  Hide legacy Redux install generator path (#4277)
  Add typed Rails action helper (#4260)
  Add Rails response type generation (#4259)
  Remove stale Pro RSpec encoding workaround (#4291)
  [Pro] Fix Gemfile loader source encoding under C locale (#4281)
  Fail fast for RSC on Rspack v1 (#4289)
  [codex] Document agent workflow trust boundary (#4288)
  Fix precompile hook forcing UTF-8 onto non-UTF-8 (national) locales (#4244)
  Regenerate Pro llms bundle (#4280)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

force-full-hosted-ci Bypass optimized hosted CI selection and run all hosted suites ready-for-hosted-ci Run optimized hosted GitHub CI for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-up: isolate or deprecate the standalone Redux generator Follow-up: deprecate Redux in the install generator without breaking 17.x

1 participant