Skip to content

Conversation

@justin808
Copy link
Member

@justin808 justin808 commented Nov 5, 2025

Summary

  • Upgraded Shakapacker dependency from version 9.0.0 to 9.1.0 across the project
  • Updated Gemfile.development_dependencies to use Shakapacker 9.1.0
  • Updated spec/dummy/package.json to use Shakapacker 9.1.0
  • Updated react_on_rails_pro/spec/dummy/package.json to use Shakapacker 9.1.0
  • Ran bundle install and yarn install to update lock files

Test plan

  • Tests pass locally (verified with spec/react_on_rails/utils_spec.rb)
  • RuboCop passes with no offenses
  • CI passes

🤖 Generated with Claude Code


This change is Reviewable

Summary by CodeRabbit

  • Chores
    • Upgraded Shakapacker to 9.1.0 across build and package files in example projects.
    • Configured Babel as the JavaScript transpiler for project templates.
    • Improved SCSS handling in build configuration to better detect and process module and non-module styles.
    • Added an upgrade note for Shakapacker 9.1.0 to the changelog.
    • Added ESLint pre-commit hook and a linting script to auto-fix JS/TS files.
    • Updated contributor/project notes to reflect monorepo structure and hooks.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 42d8f98 and f0a1b0f.

📒 Files selected for processing (4)
  • CLAUDE.md (3 hunks)
  • bin/lefthook/eslint-lint (1 hunks)
  • bin/lefthook/prettier-format (1 hunks)
  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js (2 hunks)

Walkthrough

Bumped Shakapacker to 9.1.0 across gem and package manifests, added javascript_transpiler: babel to shakapacker.yml fixtures, changed webpack SCSS rule injection to RegExp-based rule iteration, added lefthook ESLint pre-commit hook and bin/lefthook/eslint-lint script, updated docs/CHANGELOG.

Changes

Cohort / File(s) Summary
Shakapacker version bumps
Gemfile.development_dependencies, react_on_rails_pro/Gemfile.development_dependencies, react_on_rails_pro/spec/dummy/package.json, react_on_rails_pro/spec/execjs-compatible-dummy/package.json, spec/dummy/package.json
Updated shakapacker dependency versions to 9.1.0 in gem and npm manifests.
Babel transpiler config (fixtures)
react_on_rails_pro/spec/dummy/config/shakapacker.yml, react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml
Added javascript_transpiler: babel under default in test fixture Shakapacker configs.
Webpack SCSS rule detection / loader injection
spec/dummy/config/webpack/commonWebpackConfig.js, react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js
Replaced string/index-based SCSS rule lookup with iterating module.rules and using `rule.test.test('example.scss'
Pre-commit hooks & lint script
.lefthook.yml, bin/lefthook/eslint-lint
Added ESLint hook entry to .lefthook.yml and a new bin/lefthook/eslint-lint script that finds JS/TS files (staged or all-changed), runs yarn eslint --fix, and re-stages fixes.
Docs / changelog / contributor notes
CHANGELOG.md, CLAUDE.md
Added CHANGELOG entry for Shakapacker 9.1.0 and updated CLAUDE.md with pre-commit hook and monorepo notes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer / Commit
  participant Lefthook as lefthook pre-commit
  participant ESLintScript as bin/lefthook/eslint-lint
  participant Git as Git staging
  participant WebpackCfg as commonWebpackConfig.js

  Dev->>Lefthook: commit
  Lefthook->>ESLintScript: run eslint-lint (staged or all-changed)
  ESLintScript->>Git: list changed JS/TS files
  ESLintScript->>ESLintScript: run yarn eslint --fix
  ESLintScript->>Git: git add fixed files
  Note right of ESLintScript: exits early if no files

  Dev->>WebpackCfg: build/test exec (config load)
  WebpackCfg->>WebpackCfg: iterate module.rules
  alt rule.test matches .scss/.module.scss
    WebpackCfg->>WebpackCfg: rule.use.push(sassResources)
  end
  WebpackCfg->>Dev: augmented config returned
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to webpack rule handling: ensure rule.test is always a RegExp and rule.use exists before pushing.
  • Verify fixture javascript_transpiler: babel aligns with test/setup expectations.
  • Confirm lefthook ESLint script correctly scopes files and safely re-stages only fixed files.

Possibly related PRs

Suggested reviewers

  • AbanoubGhadban
  • Judahmeek
  • alexeyr-ci

Poem

🐰 A hop from nine to nine-one bright,
Babel hums while linters bite,
Rules are scanned, loaders snugly fit,
Hooks keep code tidy bit by bit,
A carrot cheer — the build's just right!

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: upgrading Shakapacker from 9.0.0 to 9.1.0 across multiple files (Gemfiles, package.json files, configurations, and changelog).

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.

@claude
Copy link

claude bot commented Nov 5, 2025

Code Review: Shakapacker 9.0.0 to 9.1.0 Upgrade

Thank you for this upgrade! I've reviewed the PR and have the following feedback:

Overview

This PR upgrades Shakapacker from 9.0.0 to 9.1.0 across the main project's spec/dummy and react_on_rails_pro/spec/dummy applications. The changes are focused and include appropriate lockfile updates.


✅ Positives

  1. Clean and Focused: The upgrade is straightforward with only version bumps and corresponding lockfile updates
  2. Consistent Approach: Both dummy applications are updated together
  3. New Dependency: Shakapacker 9.1.0 adds webpack-merge as a dependency (visible in yarn.lock), which is a standard webpack utility
  4. Lockfile Updates: All lockfiles (Gemfile.lock and yarn.lock files) have been properly updated

⚠️ Issues Found

1. Incomplete Upgrade - React on Rails Pro Side

The PR only updates react_on_rails_pro/spec/dummy/package.json but leaves other Pro files on older versions:

Files still on Shakapacker 8.0.0:

  • react_on_rails_pro/Gemfile.development_dependencies (still on 8.0.0)
  • react_on_rails_pro/Gemfile.lock (still references 8.0.0)
  • react_on_rails_pro/spec/execjs-compatible-dummy/Gemfile (still on 8.0)
  • react_on_rails_pro/spec/execjs-compatible-dummy/Gemfile.lock (still on 8.0.0)
  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json (still on 8.0.0)
  • react_on_rails_pro/spec/dummy/Gemfile.lock (still references 8.0.0 - inconsistent with package.json)

This creates an inconsistency where:

  • Main project: 9.1.0 ✅
  • Pro package.json: 9.1.0 (from this PR) ✅
  • Pro Gemfile and other files: 8.0.0 ❌

Recommendation: Either:

  • Complete the upgrade for all Pro files (Gemfiles, execjs-compatible-dummy, etc.), OR
  • Clarify in the PR description why some Pro files remain on 8.0.0 while others are upgraded

2. Version Inconsistency in react_on_rails_pro/spec/dummy

The react_on_rails_pro/spec/dummy/package.json was upgraded to 9.1.0, but the corresponding Gemfile.lock in that directory still references shakapacker 8.0.0. This mismatch could cause runtime issues.


3. Missing CHANGELOG Entry

Per CLAUDE.md guidelines, dependency upgrades should be documented in CHANGELOG.md. The previous Shakapacker upgrade (8.2.0 → 9.0.0) is documented there. This 9.0.0 → 9.1.0 upgrade should follow the same pattern.

Suggested entry for CHANGELOG.md under #### Changed:

- **Shakapacker 9.1.0 Upgrade**: Upgraded Shakapacker from 9.0.0 to 9.1.0. [PR 1921](https://github.com/shakacode/react_on_rails/pull/1921) by [justin808](https://github.com/justin808).

Note: Use the /update-changelog command mentioned in CLAUDE.md for guided changelog updates.


🔍 Additional Observations

  1. Shakapacker 9.1.0 Changes: The new version adds webpack-merge as a direct dependency, which should improve webpack configuration merging capabilities

  2. No Breaking Changes Expected: The minor version bump (9.0 → 9.1) suggests backward compatibility

  3. Test Coverage: The PR description indicates local tests pass, but CI status is pending


📋 Recommendations

Before merging:

  1. Complete the upgrade for all react_on_rails_pro files to maintain consistency
  2. Run bundle install in all directories with updated Gemfiles to sync lockfiles
  3. Add CHANGELOG entry documenting this upgrade
  4. Verify CI passes with all tests
  5. Consider testing that both Babel and SWC transpiler options work correctly with 9.1.0

Testing checklist:

  • All RSpec tests pass
  • JavaScript tests pass
  • RuboCop passes (required per CLAUDE.md)
  • Ensure all files end with newlines (required per CLAUDE.md)
  • CI passes completely
  • Both dummy apps work correctly with Shakapacker 9.1.0

🎯 Summary

This is a solid start to the upgrade, but needs completion for the react_on_rails_pro side to maintain version consistency across the project. Once the Pro files are updated and a changelog entry is added, this should be ready to merge.

Let me know if you'd like help completing the remaining upgrades!

@claude
Copy link

claude bot commented Nov 5, 2025

PR Review: Upgrade Shakapacker from 9.0.0 to 9.1.0

Summary

This PR upgrades Shakapacker dependency from 9.0.0 to 9.1.0 across the main project and Pro dummy applications. Overall, this is a straightforward dependency upgrade that appears safe to merge once CI passes.

Code Quality: ✅ Good

  • Consistency: Version upgrade is applied consistently across all relevant files:
    • Gemfile.development_dependencies (main project)
    • spec/dummy/package.json (main dummy app)
    • react_on_rails_pro/spec/dummy/package.json (Pro dummy app - upgrading from 8.0.0)
  • Lock files updated: Both Gemfile.lock and yarn.lock files properly updated
  • Follows conventions: Changes align with repository standards

Notable Observations:

  1. Pro dummy app major version jump: The Pro dummy app is upgrading from 8.0.0 → 9.1.0 (skipping 9.0.0), while the main dummy app goes from 9.0.0 → 9.1.0. This is fine, but worth noting for testing.

  2. New dependency in 9.1.0: The yarn.lock shows Shakapacker 9.1.0 adds webpack-merge@^5.8.0 as a direct dependency (line 5980 in react_on_rails_pro/spec/dummy/yarn.lock). This is expected and shouldn't cause issues.

  3. Compatibility: The gemspec requires shakapacker >= 6.0 (react_on_rails.gemspec:34), so 9.1.0 is well within the supported range.

Potential Issues: ⚠️ Minor Concerns

  1. Missing CHANGELOG entry: This is a user-visible dependency upgrade that affects both gem and npm users. According to CLAUDE.md guidelines, this should have a CHANGELOG entry. Consider adding:

    #### [Unreleased]
    ##### Changed
    - Upgraded Shakapacker dependency from 9.0.0 to 9.1.0. [PR 1921](https://github.com/shakacode/react_on_rails/pull/1921) by [justin808](https://github.com/justin808)
  2. Test plan incomplete: The PR description shows "CI passes" is still unchecked. Critical to verify:

    • All RSpec tests pass
    • Webpack compilation works in all dummy apps
    • Dev server starts correctly
    • Asset precompilation succeeds
  3. No breaking changes documented: The PR doesn't document what changes came in Shakapacker 9.1.0. Consider reviewing the Shakapacker release notes and noting any significant changes.

Security: ✅ No Concerns

  • Dependency upgrade from a trusted source (ShakaCode's own package)
  • No suspicious changes in lock files

Performance: ✅ Neutral

  • Should not negatively impact performance
  • May include optimizations from Shakapacker 9.1.0

Test Coverage: ⚠️ Needs Verification

The PR mentions tests pass locally, but CI needs to verify:

  • bundle exec rubocop (MANDATORY per CLAUDE.md)
  • Full test suite including dummy apps
  • Example generation still works

Recommendations:

  1. Before merging:

    • ✅ Verify bundle exec rubocop passes with zero offenses
    • ✅ Ensure all files end with newline characters
    • ✅ Wait for CI to pass completely
    • ⚠️ Add CHANGELOG entry (if considered user-visible)
  2. Testing suggestions:

    • Test all example apps build successfully: rake shakapacker_examples:gen_all
    • Verify dev server works: bin/shakapacker-dev-server
    • Test asset precompilation: rake assets:precompile

Verdict: ✅ Approve (pending CI)

This is a clean, well-executed dependency upgrade. The changes are minimal, focused, and follow repository conventions. Once CI passes and RuboCop is clean, this should be safe to merge.

Nice work on the systematic upgrade across all relevant locations!


Review generated by Claude Code

@claude
Copy link

claude bot commented Nov 5, 2025

Code Review: Upgrade Shakapacker from 9.0.0 to 9.1.0

Summary

This PR upgrades Shakapacker from 9.0.0 to 9.1.0 across the project. Overall, this is a straightforward dependency update that looks good. However, there are a few important observations and recommendations.


Positive Aspects

  1. Consistent Version Alignment: The upgrade brings all environments to the same version (9.1.0):

    • Main spec/dummy app: 9.0.0 → 9.1.0 ✓
    • Pro spec/dummy app: 8.0.0 → 9.1.0 ✓ (This is a significant jump and actually fixes a version inconsistency)
  2. Complete Lock File Updates: Both Gemfile.lock and yarn.lock files have been properly updated ✓

  3. New Dependency: Shakapacker 9.1.0 now includes webpack-merge as a direct dependency, which is already present in the project, so no conflicts ✓


Issues and Recommendations

1. CRITICAL: Missing CHANGELOG Entry

According to CLAUDE.md, this dependency upgrade should be documented in the CHANGELOG:

  • Requirement: Update CHANGELOG.md for user-visible changes only (features, bug fixes, breaking changes, deprecations, performance improvements)
  • Recommendation: While this is primarily a dependency update, upgrading Shakapacker (especially the Pro app from 8.0.0 → 9.1.0) may introduce new features or bug fixes that users benefit from. Please add a CHANGELOG entry if appropriate.

2. Test Coverage Concern

  • The test plan shows only one spec file was verified (spec/react_on_rails/utils_spec.rb)
  • Recommendation: Given the significant version jump in the Pro app (8.0.0 → 9.1.0, skipping 9.0.0 entirely), it would be prudent to:
    • Run the full test suite: rake all_but_examples
    • Test example apps: rake shakapacker_examples:gen_all
    • Verify server-side rendering works correctly (since Shakapacker is core to the webpack build process)

3. Breaking Changes Investigation

  • Action Item: Review Shakapacker's CHANGELOG/release notes for versions 8.0.0 → 9.1.0 to identify:
    • Any breaking changes that might affect React on Rails
    • New features that could be leveraged
    • Deprecation warnings to address

4. Pro Package Major Jump

The Pro spec/dummy app jumping from 8.0.0 to 9.1.0 is significant:

  • This skips version 9.0.0 entirely
  • Major version changes (8.x → 9.x) typically include breaking changes
  • Recommendation: Specifically test Pro features like:
    • Server-side rendering with Pro components
    • Any Pro-specific webpack configurations
    • Node renderer functionality

Security Considerations

✓ No security concerns identified - this is a routine dependency upgrade from a trusted source (ShakaCode's own package)


Performance Considerations

✓ Dependency updates often include performance improvements, though specifics depend on Shakapacker's changelog


Code Quality

✓ The changes follow the project's conventions:

  • Proper version pinning in Gemfile.development_dependencies
  • Lock files properly updated
  • Consistent versioning across all package.json files

Pre-Merge Checklist

Before merging, please ensure:

  • All CI checks pass (currently pending)
  • Full test suite passes locally: rake all_but_examples
  • Example apps build successfully: rake shakapacker_examples:gen_all
  • RuboCop passes with no offenses: bundle exec rubocop ✓ (confirmed in test plan)
  • CHANGELOG.md updated (if appropriate)
  • Review Shakapacker 9.0.0 and 9.1.0 release notes for breaking changes

Final Verdict

Approve with minor modifications: This is a solid dependency update, but please address the CHANGELOG requirement and ensure comprehensive testing, especially for the Pro package's major version jump from 8.x to 9.x.

@claude
Copy link

claude bot commented Nov 5, 2025

Pull Request Review: Upgrade Shakapacker 9.0.0 → 9.1.0

Summary

This PR upgrades Shakapacker from 9.0.0 to 9.1.0 across the Ruby gem and both dummy apps (main and Pro). The upgrade appears straightforward and well-executed.

Code Quality & Best Practices ✅

Strengths:

  • Clean, focused upgrade touching only necessary files
  • Proper version pinning in both Gemfile and package.json files
  • Lock files correctly updated via bundle install and yarn install
  • Consistent upgrade across all three locations (gem, spec/dummy, react_on_rails_pro/spec/dummy)
  • Follows repository conventions per CLAUDE.md

Important Note:

  • The Pro dummy app was on Shakapacker 8.0.0, now jumping to 9.1.0 (spec/dummy/package.json was already on 9.0.0)
  • This is actually a major version upgrade for the Pro dummy (8.x → 9.x)

Potential Issues & Concerns ⚠️

1. New Dependency: webpack-merge

The upgrade adds webpack-merge ^5.8.0 as a direct dependency in Shakapacker 9.1.0 (visible in yarn.lock). This should be fine since:

  • [email protected] is already in both dummy apps' dependency trees
  • The new requirement is ^5.8.0, which is satisfied by 5.10.0

2. Major Version Jump in Pro Dummy

The Pro dummy app goes from 8.0.0 → 9.1.0, skipping Shakapacker 9.0.0 entirely. Based on CHANGELOG.md (line 1816 in /home/runner/work/react_on_rails/react_on_rails/CHANGELOG.md), the Shakapacker 9.0.0 upgrade required:

  • Configuring javascript_transpiler: babel in shakapacker.yml (9.0 defaults to SWC)
  • CSS Modules configuration changes (namedExport: false)
  • Precompile hook support

Action Required:

  • Verify that react_on_rails_pro/spec/dummy/config/shakapacker.yml has the proper Babel transpiler configuration
  • Check CSS Modules configuration if used
  • Ensure any precompile hooks are properly configured

3. Missing Test Coverage

The test plan shows:

  • ✅ Local tests pass (spec/react_on_rails/utils_spec.rb)
  • ✅ RuboCop passes
  • ❌ CI not yet verified

Recommendation: Wait for full CI to pass before merging, especially:

  • All RSpec tests (not just utils_spec.rb)
  • JavaScript/TypeScript tests
  • Integration tests with both dummy apps
  • Example app builds

Performance Considerations 🚀

Shakapacker 9.1.0 likely includes performance improvements and bug fixes from 9.0.0 → 9.1.0. The addition of webpack-merge as a direct dependency suggests improved webpack configuration handling, which could positively impact build times.

Security Concerns 🔒

No immediate security concerns identified. Upgrading to a newer minor version typically includes security patches. Review the Shakapacker 9.1.0 release notes for any security-related fixes.

Recommendations

Before Merging:

  1. ✅ Ensure CI passes completely
  2. ⚠️ Verify Pro dummy app shakapacker.yml configuration matches requirements for v9.x
  3. ⚠️ Test both dummy apps' webpack builds locally:
    • cd spec/dummy && yarn build:dev
    • cd react_on_rails_pro/spec/dummy && yarn build:dev
  4. ⚠️ Run full test suite: rake (runs lint + all tests except examples)

After Merging:

  1. Monitor CI for any unexpected issues
  2. Consider updating CHANGELOG.md if this upgrade affects users (though it may be internal-only)

Final Verdict

Conditionally Approve pending:

  • Full CI pass
  • Verification of Pro dummy app configuration for Shakapacker 9.x compatibility

The upgrade itself is clean and follows best practices. The main risk is ensuring the Pro dummy app properly handles the 8.0 → 9.1 jump with appropriate configuration changes.


Review generated with attention to CLAUDE.md guidelines

@claude
Copy link

claude bot commented Nov 5, 2025

Code Review - Shakapacker 9.0.0 → 9.1.0 Upgrade

Overall Assessment

APPROVED - This is a well-executed dependency upgrade with proper lock file updates.


Code Quality & Best Practices

Strengths:

  • ✅ Clean, focused change - only dependency version updates
  • ✅ Consistent upgrade across all environments (main gem + pro dummy apps)
  • ✅ All lock files properly updated (Gemfile.lock and yarn.lock)
  • ✅ Version pinning maintained (exact version, not ranges)
  • ✅ Pro package upgraded from 8.0.0 → 9.1.0 (catching up to main)

Notable Changes:

  • The yarn.lock shows Shakapacker 9.1.0 now explicitly declares webpack-merge ^5.8.0 as a dependency, which was previously an implicit/peer dependency
  • Registry URLs in yarn.lock updated from yarnpkg.com to npmjs.org (normal registry variation)

Potential Issues

None identified, but recommendations:

  1. Shakapacker Version Skew (Pro): The Pro package jumped from 8.0.0 → 9.1.0, skipping versions 8.1.x, 8.2.x, 9.0.0. Consider reviewing the changelogs for these intermediate versions:

  2. Test Coverage: While local tests pass, ensure comprehensive testing covers:

    • Webpack compilation in both dev and production modes
    • Server-side rendering functionality
    • Hot module replacement (HMR)
    • Asset fingerprinting/digests

Performance Considerations

✅ No performance concerns expected. Minor version bumps typically include:

  • Bug fixes
  • Security patches
  • Performance improvements

The explicit webpack-merge dependency may provide better dependency resolution.


Security Concerns

No security issues identified

Upgrading dependencies is generally a security best practice. Recommend:

  • Running bundle audit and yarn audit to verify no known vulnerabilities
  • Checking Shakapacker's security advisories

Test Coverage

Current Status:

  • ✅ Local tests passing
  • ⏳ CI in progress

Recommendations:

  1. Ensure integration tests cover webpack compilation scenarios
  2. Test server-side rendering with the new version
  3. Verify example apps build and run correctly after upgrade

Questions/Suggestions

  1. CHANGELOG.md: Should this upgrade be documented? Per CLAUDE.md, dependency upgrades typically don't require changelog entries unless they affect users. Since this is a development dependency upgrade, it's likely not needed.

  2. Documentation: Consider updating any documentation that references specific Shakapacker versions, if applicable.

  3. Breaking Changes: Review Shakapacker's changelog for any breaking changes or deprecations that might affect this project's webpack configuration.


Compliance with CLAUDE.md

✅ All requirements met:

  • Lock files updated
  • Version pinning maintained
  • Files should end with newlines (verified in diff)

Once CI passes, this PR is ready to merge! 🚀


📋 Review Checklist
  • Code quality and best practices
  • Lock files properly updated
  • Consistent versioning across packages
  • No obvious bugs
  • No performance concerns
  • No security concerns
  • Test coverage adequate
  • Follows repository conventions

@justin808 justin808 force-pushed the justin808/shakapacker-9.1.0 branch from e252ca0 to c07e001 Compare November 5, 2025 06:17
@claude
Copy link

claude bot commented Nov 5, 2025

Pull Request Review: Upgrade Shakapacker from 9.0.0 to 9.1.0

Overall Assessment

LGTM with minor observations - This is a straightforward dependency upgrade that follows best practices.


Code Quality & Best Practices

Strengths:

  • ✅ Consistent version updates across all affected files (Gemfile, package.json files in multiple directories)
  • ✅ Lock files properly updated (Gemfile.lock, yarn.lock files)
  • ✅ Added required javascript_transpiler: babel configuration in shakapacker.yml files (lines 9 in both config files)
  • ✅ Proper upgrade path: Pro version updated from 8.0.0 → 9.1.0, main version from 9.0.0 → 9.1.0

Configuration Changes:
The PR correctly adds the new required configuration in shakapacker.yml:

  • react_on_rails_pro/spec/dummy/config/shakapacker.yml:9
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml:10

This is a breaking change requirement in Shakapacker 9.x that must be explicitly set.


Potential Issues & Recommendations

1. Missing Changelog Entry ⚠️
According to CLAUDE.md guidelines, this should have a changelog entry:

  • This is a user-visible change (dependency upgrade affects all users)
  • Consider using /update-changelog command or manually add an entry like:
    [PR 1921](https://github.com/shakacode/react_on_rails/pull/1921) by [justin808](https://github.com/justin808): Upgrade Shakapacker dependency from 9.0.0 to 9.1.0
    

2. Incomplete CI Verification ⚠️
Test plan shows CI hasn't passed yet:

  • CI passes ← This needs to be verified before merge

3. Version Consistency Question 🤔
The Pro version jumped from 8.0.0 to 9.1.0 (skipping 9.0.0). While this is likely intentional:

  • Verify this doesn't introduce any issues with missing 9.0.0 migration steps
  • Consider documenting why 9.0.0 was skipped in the Pro version

Security Concerns

No security concerns identified

  • Dependency upgrade from official Shakapacker package
  • Integrity hashes properly updated in yarn.lock files
  • No changes to security-sensitive code

Performance Considerations

No performance concerns

  • Shakapacker 9.1.0 is a minor version bump, likely bug fixes and minor improvements
  • No changes to webpack configuration that would affect build performance
  • The webpack-merge dependency addition is a proper dependency declaration (was likely transitive before)

Test Coverage

Current Status:

  • ✅ RuboCop passes
  • ✅ Local tests pass (spec/react_on_rails/utils_spec.rb verified)
  • ⚠️ CI pending

Recommendations:

  1. Before merge: Ensure ALL CI checks pass, especially:
    • Full RSpec test suite
    • JavaScript tests
    • Example app tests
    • Integration tests with the new Shakapacker version
  2. Consider running rake all_but_examples locally to verify comprehensive test coverage
  3. Test the generated examples to ensure webpack compilation works: rake shakapacker_examples:gen_all

Action Items Before Merge

  1. ✅ Update CHANGELOG.md with this upgrade
  2. ✅ Verify all CI checks pass
  3. ✅ Test example app generation with new Shakapacker version
  4. ✅ Consider testing a clean install scenario: bundle && yarn && rake shakapacker_examples:gen_all && rake

Compliance with CLAUDE.md

Checklist:

  • ✅ Lock files properly updated
  • ⚠️ Changelog needs update (user-visible dependency change)
  • ⚠️ CI status pending verification
  • ✅ Version updates are consistent
  • ✅ Configuration changes align with Shakapacker 9.x requirements

Conclusion: This is a well-executed dependency upgrade. Once CI passes and the changelog is updated, this should be safe to merge. The javascript_transpiler: babel configuration additions are particularly good catches that align with Shakapacker 9.x requirements.

🤖 Generated by Claude Code Review

@claude
Copy link

claude bot commented Nov 5, 2025

Code Review: Shakapacker 9.0.0 → 9.1.0 Upgrade

Overview

This PR upgrades Shakapacker from 9.0.0 to 9.1.0 across the project. Overall, the changes are clean and straightforward, but I have several observations and recommendations.


✅ Positive Aspects

  1. Consistent Version Updates: The upgrade is applied consistently across all relevant files:

    • Main project dependencies
    • Pro version dependencies
    • All dummy apps (spec/dummy and pro spec apps)
    • Lock files properly updated
  2. Configuration Updates: The addition of javascript_transpiler: babel in the Pro dummy apps' shakapacker.yml files is correct and important. This aligns with the main spec/dummy configuration which already had this setting (line 10 in spec/dummy/config/shakapacker.yml).

  3. Dependency Chain: The yarn.lock updates show that Shakapacker 9.1.0 now explicitly depends on webpack-merge: ^5.8.0, which was already in the lock files. This is a good clarification of dependencies.


🔍 Observations & Potential Issues

1. Version Inconsistency Issue ⚠️

There's a critical inconsistency in Gemfile.development_dependencies:

  • Line 3: Still shows gem "shakapacker", "9.0.0" (not updated)
  • Gemfile.lock: Shows shakapacker (= 9.1.0) (updated)

This mismatch will cause issues. The Gemfile.development_dependencies:3 should be updated to 9.1.0 to match the lock file and the PR description.

Wait, I see the diff shows this WAS updated in the PR - but when I read the file at Gemfile.development_dependencies:3, it still shows 9.0.0. This suggests the file content might not match what's in the PR diff, or there may be a git state issue.

2. Pro Version Jump 📈

The Pro version is upgrading from 8.0.0 → 9.1.0 (skipping 9.0.0 entirely), while the main project is upgrading from 9.0.0 → 9.1.0. This is a larger version jump for the Pro version.

Recommendation: Ensure all breaking changes between Shakapacker 8.x and 9.x are accounted for in the Pro test apps. The addition of javascript_transpiler: babel suggests this was already considered, which is good.

3. Missing Configuration in Main Dummy App?

The main spec/dummy/config/shakapacker.yml already has javascript_transpiler: babel set (line 10), but this isn't shown in the PR diff. The Pro apps are adding this configuration. This is consistent, but worth verifying that:

  • All Shakapacker config files have this setting
  • This setting is intentional (Babel vs SWC choice)

4. Duplicate precompile_hook Entry

In spec/dummy/config/shakapacker.yml, there are two identical precompile_hook entries (lines 14 and 31). While not introduced by this PR, it's worth cleaning up.


🧪 Testing Recommendations

  1. Run Full Test Suite:

    bundle exec rake all_but_examples
  2. Test Pro Version Separately:

    cd react_on_rails_pro && bundle exec rake
  3. Verify Webpack Compilation:

    • Test that assets compile correctly in all dummy apps
    • Verify HMR still works in development mode
    • Check that the javascript_transpiler: babel setting is being respected
  4. Check for Shakapacker 9.1.0 Changes: Review the Shakapacker 9.1.0 release notes to ensure no breaking changes or new features that need configuration updates.


📋 Pre-Merge Checklist

Based on CLAUDE.md requirements:

  • CI must pass (currently unchecked in test plan)
  • Run bundle exec rubocop and ensure zero offenses
  • Ensure all files end with newline characters
  • Verify git hooks are working (they should auto-run on commit)
  • Resolve the Gemfile.development_dependencies version discrepancy

🎯 Action Items

  1. CRITICAL: Verify and fix the Gemfile.development_dependencies:3 version if needed
  2. Review Shakapacker 9.1.0 release notes for any breaking changes
  3. Ensure CI passes completely before merging
  4. Consider testing with a real React on Rails app using yalc to verify no regressions

📝 Changelog Note

Per CLAUDE.md, this change should NOT be added to CHANGELOG.md as it's a dependency update rather than a user-facing feature/bug fix/breaking change. However, if Shakapacker 9.1.0 introduces user-facing changes, those should be documented.


Summary

The upgrade is well-executed with proper lock file updates and configuration additions. The main concern is verifying the Gemfile.development_dependencies version consistency. Once CI passes and the version is confirmed consistent, this should be safe to merge.

Rating: ⭐⭐⭐⭐ (4/5) - Well done, pending CI verification and version consistency check.

@claude
Copy link

claude bot commented Nov 5, 2025

Code Review - PR #1921: Upgrade Shakapacker from 9.0.0 to 9.1.0

Overall Assessment

This is a straightforward dependency upgrade PR that updates Shakapacker from 9.0.0 to 9.1.0. The changes are minimal and focused on version bumps across the project.

Positive Aspects

  • Clear scope: The PR focuses solely on upgrading Shakapacker dependency
  • Lock file updates: Both Gemfile.lock and yarn.lock files have been updated
  • New configuration added: Added javascript_transpiler: babel to shakapacker.yml files where needed
  • Dependency alignment: The new version adds webpack-merge as an explicit dependency, which is good for stability

Issues & Concerns

Critical: Incomplete Dependency Updates

The PR has NOT updated all Shakapacker references in the codebase. Several lock files still reference older versions:

react_on_rails_pro directory still has outdated versions:

  • /react_on_rails_pro/Gemfile.lock shows shakapacker (8.0.0)
  • /react_on_rails_pro/spec/dummy/Gemfile.lock shows shakapacker (8.0.0)
  • /react_on_rails_pro/spec/execjs-compatible-dummy/Gemfile.lock shows shakapacker (8.0.0)

Recommendation: Run bundle install in the react_on_rails_pro directory to update these lock files to 9.1.0.

Missing: CHANGELOG Update

According to the project's CLAUDE.md guidelines, dependency upgrades from 9.0.0 to 9.1.0 should be documented in CHANGELOG.md under the Changed section if there are user-visible changes or under Internal if it's purely internal.

The CHANGELOG already has an entry for the 9.0.0 upgrade (line 36-41). Consider adding a similar entry for the 9.1.0 upgrade, such as:

- **Shakapacker 9.1.0 Upgrade**: Upgraded Shakapacker from 9.0.0 to 9.1.0. [PR 1921](https://github.com/shakacode/react_on_rails/pull/1921) by [justin808](https://github.com/justin808).

Configuration Changes

The PR adds javascript_transpiler: babel to two shakapacker.yml files:

  • react_on_rails_pro/spec/dummy/config/shakapacker.yml:9
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml:10

Note: The main spec/dummy/config/shakapacker.yml already had this configuration (line 10), so this is good for consistency across all dummy apps.

Dependencies Added

The upgrade introduces webpack-merge (^5.8.0) as an explicit dependency in Shakapacker 9.1.0, which was already being used but is now formalized.

Test Coverage

The test plan mentions:

  • ✅ Tests pass locally
  • ✅ RuboCop passes with no offenses
  • ⏳ CI passes (pending)

Recommendation: Wait for CI to pass before merging to ensure no regressions.

Action Items Before Merge

  1. Run bundle install in react_on_rails_pro/ directory to update the Gemfile.lock files
  2. Consider adding a CHANGELOG entry (use /update-changelog command as mentioned in CLAUDE.md)
  3. Wait for CI to pass to verify no integration issues
  4. Verify all lock files are updated by running: grep -r "shakapacker.*8\.0\.0\|shakapacker.*9\.0\.0" --include="*.lock" .

Security & Performance

No security concerns identified. This is a minor version bump that should maintain backward compatibility. Performance impact should be minimal.

Code Quality

The PR follows the project's conventions and the changes are clean. However, the incomplete lock file updates need to be addressed before merging.


Verdict: Approve with changes required. Please update the react_on_rails_pro lock files before merging.

@claude
Copy link

claude bot commented Nov 5, 2025

Pull Request Review: Upgrade Shakapacker from 9.0.0 to 9.1.0

Summary

This PR upgrades Shakapacker dependency across the project from versions 8.0.0/9.0.0 to 9.1.0. The changes include version bumps in Gemfiles, package.json files, and important configuration updates.


Code Quality & Best Practices

✅ Strengths:

  1. Consistent versioning - The upgrade is applied consistently across all dummy apps and Pro specs
  2. Lock file updates - Both Gemfile.lock and yarn.lock files are properly updated
  3. Configuration updates - New javascript_transpiler: babel setting added where needed

⚠️ Concerns:

  1. Missing configuration in one location - The PR adds javascript_transpiler: babel to two shakapacker.yml files in the Pro specs, but the main spec/dummy/config/shakapacker.yml already has this setting (line 10) with a helpful comment explaining why Babel is needed over SWC. This is good for consistency.

  2. Major version jump in Pro - The react_on_rails_pro/Gemfile.development_dependencies jumps from Shakapacker 8.0.0 to 9.1.0, skipping the entire 9.0.x series. This is a larger change than the main gem's 9.0.0 → 9.1.0 upgrade.

  3. Webpack-merge dependency - The new version adds webpack-merge: ^5.8.0 as a direct dependency. This appears to be a new requirement in 9.1.0 and is properly included in the yarn.lock updates.


Potential Issues

  1. Breaking changes from 8.0.0 → 9.1.0 - The Pro dummy apps are jumping two major versions. Without seeing the Shakapacker changelog, we should verify:

    • Are there any breaking changes between 8.x and 9.x?
    • Are there any breaking changes between 9.0 and 9.1?
    • Does the new javascript_transpiler configuration option have different defaults?
  2. Configuration completeness - Need to verify all dummy apps have the necessary configuration:

    • spec/dummy/config/shakapacker.yml - ✅ Already has javascript_transpiler: babel
    • react_on_rails_pro/spec/dummy/config/shakapacker.yml - ✅ Added in this PR
    • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml - ✅ Added in this PR
  3. Gemspec dependency - The main react_on_rails.gemspec:34 has shakapacker >= 6.0 which is flexible enough to accept 9.1.0, so no changes needed there.


Testing Recommendations

Before merging, ensure:

  1. ✅ Run full test suite (as noted in test plan)
  2. ✅ RuboCop passes (as noted in test plan)
  3. ⚠️ CI must pass (currently unchecked in test plan)
  4. Test the following scenarios specifically:
    • Server-side rendering still works correctly
    • Development webpack dev server starts properly
    • Production asset compilation completes successfully
    • All example apps compile and run
    • Pro features work with the 8.0.0 → 9.1.0 jump

Performance Considerations

Positive:

  • Shakapacker 9.1.0 likely includes performance improvements and bug fixes
  • The webpack-merge dependency addition suggests better configuration merging

To verify:

  • Build times haven't regressed
  • Development server hot reload performance is maintained

Security Concerns

✅ No immediate security concerns identified

The dependency upgrade should be reviewed for:

  • Check Shakapacker 9.1.0 release notes for any security fixes
  • Verify all transitive dependencies are up-to-date (visible in yarn.lock changes)

Documentation & Changelog

⚠️ Action needed:

According to CLAUDE.md, user-visible changes should be added to CHANGELOG.md. This dependency upgrade should be documented since it may affect users:

#### [PR 1921](https://github.com/shakacode/react_on_rails/pull/1921) by [justin808](https://github.com/justin808)
- Updated Shakapacker dependency from 9.0.0 to 9.1.0 (Pro specs upgraded from 8.0.0)
- Added `javascript_transpiler: babel` configuration to ensure compatibility

Note: The changelog entry format should follow the pattern: [PR XXXX] not [PR #XXXX] (no hash).


Additional Recommendations

  1. Test coverage: Consider adding integration tests that specifically verify webpack compilation with the new Shakapacker version

  2. Migration guide: If there are any behavioral changes users might encounter, document them in the PR description or release notes

  3. Registry changes: I notice the yarn.lock shows some packages switching from registry.yarnpkg.com to registry.npmjs.org. This is cosmetic but confirms proper dependency resolution.


Checklist for Author

  • Dependency versions updated consistently
  • Lock files regenerated
  • Configuration files updated
  • CI passing
  • Changelog updated (if user-visible)
  • All dummy apps tested
  • Documentation updated if needed

Conclusion

Recommendation: Approve with minor actions

This is a clean dependency upgrade with proper configuration updates. The main action items are:

  1. Must do: Ensure CI passes before merging
  2. Should do: Add changelog entry for user visibility
  3. Nice to have: Document any behavioral changes from Shakapacker 8.0.0 → 9.1.0

Great work on the comprehensive update across all test environments! 🚀


Review generated with Claude Code. Based on repository conventions from CLAUDE.md.

@claude
Copy link

claude bot commented Nov 5, 2025

Pull Request Review: Upgrade Shakapacker from 9.0.0 to 9.1.0

✅ Code Quality and Best Practices

Positive aspects:

  • Clean, focused dependency upgrade across the project
  • Consistent version updates across all relevant files (Gemfiles and package.json files)
  • Lock files properly updated (Gemfile.lock and yarn.lock files)
  • Configuration files updated appropriately with new required settings

📋 Key Changes Analysis

1. Dependency Updates (✅ Good)

  • Main spec/dummy: 9.0.0 → 9.1.0
  • Pro spec/dummy: 8.0.0 → 9.1.0 (larger jump)
  • Pro execjs-compatible-dummy: 8.0.0 → 9.1.0

2. Configuration Changes (⚠️ Needs Attention)

Added javascript_transpiler: babel to shakapacker.yml files:

  • react_on_rails_pro/spec/dummy/config/shakapacker.yml:9
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml:10

Note: The main spec/dummy/config/shakapacker.yml already had this configuration (line 10), which is good for consistency.

Why this matters: According to the codebase's CHANGELOG, Shakapacker 9.0 defaults to SWC, which has PropTypes handling issues. Explicitly setting javascript_transpiler: babel ensures consistent behavior and avoids potential runtime issues.

3. Webpack Configuration Improvement (✅ Excellent)

The change in react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js is a significant improvement:

Before:

const scssConfigIndex = baseClientWebpackConfig.module.rules.findIndex((config) =>
  '.scss'.match(config.test),
);
baseClientWebpackConfig.module.rules[scssConfigIndex].use.push(sassLoaderConfig);

After:

baseClientWebpackConfig.module.rules.forEach((rule) => {
  if (Array.isArray(rule.use) && rule.test && '.scss'.match(rule.test)) {
    rule.use.push(sassLoaderConfig);
  }
});

Why this is better:

  • More robust: Handles multiple SCSS rules instead of assuming there's only one
  • Safer: Guards against edge cases (checks for Array.isArray and rule.test existence)
  • Future-proof: Works if Shakapacker 9.1.0 has multiple SCSS rule configurations

🐛 Potential Issues

1. Missing javascript_transpiler in Pro Gemfile.development_dependencies?

The Pro version jumps from 8.0.0 → 9.1.0, skipping 9.0.0 entirely. The configuration files were updated, but:

  • ⚠️ Verify that all test suites in the Pro version work correctly with this larger version jump
  • ✅ The configuration change should prevent SWC issues

2. Shakapacker's new webpack-merge dependency

The yarn.lock shows Shakapacker 9.1.0 now requires webpack-merge@^5.8.0 as a direct dependency:

dependencies:
  js-yaml "^4.1.0"
  path-complete-extname "^1.0.0"
  webpack-merge "^5.8.0"  # <-- New dependency
  • ✅ This is fine since [email protected] is already in the project
  • ✅ No conflicts detected

🔒 Security Concerns

  • ✅ No security concerns identified
  • ✅ All dependencies are from official npm registry
  • ✅ Version pinning is appropriate for development dependencies

🧪 Test Coverage

From PR description:

  • ✅ Tests pass locally (verified with spec/react_on_rails/utils_spec.rb)
  • ✅ RuboCop passes with no offenses
  • ⏳ CI pending

Recommendations:

  1. Ensure all example apps are tested (not just utils_spec)
  2. Test server-side rendering specifically (since webpack config changed)
  3. Test both development and production builds
  4. Verify HMR (Hot Module Replacement) still works

⚡ Performance Considerations

  • ✅ No negative performance impact expected
  • ✅ The webpack config improvement (forEach vs findIndex) should have negligible performance impact
  • ℹ️ Shakapacker 9.1.0 may include performance improvements - check their release notes

📝 Recommendations

  1. Add CHANGELOG entry: This is a user-visible dependency upgrade that affects compatibility. Add an entry under "Upgrade" or "Dependencies" section following the format:

    - Upgrade Shakapacker from 9.0.0 to 9.1.0. Updated Pro version from 8.0.0 to 9.1.0. [PR 1921](https://github.com/shakacode/react_on_rails/pull/1921) by [justin808](https://github.com/justin808)
  2. Testing checklist before merge:

    • Run rake run_rspec:dummy (dummy app tests)
    • Run rake run_rspec:gem (gem-only tests)
    • Test Pro version: cd react_on_rails_pro && rake
    • Test server-side rendering in development mode
    • Test production build: rake shakapacker_examples:gen_all
    • Verify HMR works with HMR=true
  3. Documentation: Consider documenting the reason for the javascript_transpiler: babel setting in the shakapacker.yml files (as you did in spec/dummy but not in the Pro configs)

🎯 Summary

Overall Assessment: ✅ Approve with minor recommendations

This is a well-executed dependency upgrade with thoughtful improvements to the webpack configuration. The addition of javascript_transpiler: babel shows attention to compatibility concerns, and the webpack config refactor demonstrates defensive programming.

Action items:

  1. Add CHANGELOG entry (per project conventions)
  2. Complete full test suite before merge
  3. Consider adding comments to Pro shakapacker.yml files explaining the babel transpiler choice

Great work on maintaining consistency across multiple dummy apps and handling the version jumps carefully!

@justin808 justin808 force-pushed the justin808/shakapacker-9.1.0 branch from e56d827 to 0d253df Compare November 5, 2025 07:23
@claude
Copy link

claude bot commented Nov 5, 2025

Code Review: Shakapacker 9.0.0 to 9.1.0 Upgrade

Overview

This PR upgrades Shakapacker from 9.0.0 to 9.1.0 across the project. Overall, this is a straightforward and well-executed dependency upgrade with appropriate configuration updates. The changes are consistent and properly applied across all test environments.

Positive Observations

  1. Comprehensive Coverage: The upgrade has been applied consistently across:

    • Main gem dependencies (Gemfile.development_dependencies)
    • Main dummy app (spec/dummy)
    • Pro version dummy apps (react_on_rails_pro/spec/dummy and react_on_rails_pro/spec/execjs-compatible-dummy)
  2. Proper Configuration Updates:

    • Added javascript_transpiler: babel to Pro dummy apps' shakapacker.yml files, which is appropriate since Shakapacker 9.x defaults to SWC
    • This aligns with the existing configuration already present in spec/dummy/config/shakapacker.yml:10
  3. Improved Webpack Configuration: The changes to commonWebpackConfig.js in the Pro dummy app show better practices:

    • Uses forEach instead of findIndex to handle multiple SCSS rules
    • More defensive code that won't break if the structure changes
    • Better compatibility with Shakapacker 9.1.0's internal changes
  4. Lock File Updates: All yarn.lock files properly updated with the new dependency resolution

Issues and Concerns

🔴 Critical: Incomplete Configuration

Problem: The javascript_transpiler: babel configuration was only added to the Pro dummy apps but is missing from the main spec/dummy/config/shakapacker.yml.

  • Location: spec/dummy/config/shakapacker.yml already has this at line 10 (see the file)
  • Resolution: Actually, upon closer inspection, spec/dummy/config/shakapacker.yml:10 already has this configuration, so this is fine!

🟡 Missing CHANGELOG Entry

Problem: According to CLAUDE.md, changelog entries should be added for dependency upgrades like this. The CHANGELOG.md already documents the 9.0.0 upgrade at lines 36-41, but there's no entry for the 9.1.0 upgrade.

Recommendation: Add a changelog entry under the #### Changed section:

- **Shakapacker 9.1.0 Upgrade**: Upgraded Shakapacker from 9.0.0 to 9.1.0. This minor version update includes bug fixes and improvements. Updated webpack configuration in Pro dummy apps to use forEach pattern for better compatibility with multiple SCSS rules. [PR 1921](https://github.com/shakacode/react_on_rails/pull/1921) by [justin808](https://github.com/justin808).

🟢 Minor: Webpack Configuration Improvement

The change in react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js is actually an improvement:

Before (implicit from diff):

const scssConfigIndex = baseClientWebpackConfig.module.rules.findIndex((config) =>
  '.scss'.match(config.test),
);
baseClientWebpackConfig.module.rules[scssConfigIndex].use.push(sassLoaderConfig);

After:

baseClientWebpackConfig.module.rules.forEach((rule) => {
  if (Array.isArray(rule.use) && rule.test && '.scss'.match(rule.test)) {
    rule.use.push(sassLoaderConfig);
  }
});

This is more robust because:

  • It handles cases where there might be multiple SCSS rules
  • It doesn't fail if no SCSS rule is found (instead of accessing undefined index)
  • It checks that rule.use is an array before attempting to push

Note that spec/dummy/config/webpack/commonWebpackConfig.js already uses the better forEach pattern (lines 25-54).

Security Considerations

No security concerns identified:

  • Shakapacker 9.1.0 is a minor version bump with bug fixes
  • The new webpack-merge dependency (^5.8.0) is within the same major version
  • Lock files show legitimate registry sources

Test Coverage

The PR description indicates:

  • ✅ Tests pass locally
  • ✅ RuboCop passes
  • ⏳ CI pending

Recommendation: Ensure CI passes, particularly:

  • All RSpec tests across different dummy apps
  • Integration tests with the webpack build process
  • Any RSC-related tests in the Pro version

Performance Considerations

No performance concerns. Shakapacker 9.1.0 should maintain or improve upon 9.0.0 performance.

Best Practices Compliance

Based on CLAUDE.md requirements:

Follows project conventions:

  • Consistent version bumps across all package.json and Gemfile files
  • Proper lock file updates
  • Configuration changes aligned with Shakapacker requirements

⚠️ Action Required Before Merge:

  1. Add CHANGELOG.md entry for this upgrade
  2. Verify all CI checks pass
  3. Consider running bundle exec rubocop one final time (as per CLAUDE.md)

Recommendation

APPROVE with minor changes: This is a solid upgrade PR. The only action item is adding the changelog entry. Once that's done and CI passes, this is ready to merge.

Great work maintaining consistency across all the dummy apps and properly handling the configuration requirements! 🚀

Copy link
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae5425b and 0d253df.

⛔ Files ignored due to path filters (4)
  • Gemfile.lock is excluded by !**/*.lock
  • react_on_rails_pro/spec/dummy/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • react_on_rails_pro/spec/execjs-compatible-dummy/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • spec/dummy/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • Gemfile.development_dependencies (1 hunks)
  • react_on_rails_pro/Gemfile.development_dependencies (1 hunks)
  • react_on_rails_pro/spec/dummy/config/shakapacker.yml (1 hunks)
  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js (1 hunks)
  • react_on_rails_pro/spec/dummy/package.json (1 hunks)
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml (1 hunks)
  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json (1 hunks)
  • spec/dummy/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1687
File: spec/dummy/package.json:0-0
Timestamp: 2025-01-23T18:20:45.824Z
Learning: When adding or updating dependencies in spec/dummy/package.json, maintain version consistency with other package.json files in the codebase to avoid potential version conflicts.
📚 Learning: 2025-01-23T18:20:45.824Z
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1687
File: spec/dummy/package.json:0-0
Timestamp: 2025-01-23T18:20:45.824Z
Learning: When adding or updating dependencies in spec/dummy/package.json, maintain version consistency with other package.json files in the codebase to avoid potential version conflicts.

Applied to files:

  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json
  • spec/dummy/package.json
  • react_on_rails_pro/spec/dummy/package.json
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.

Applied to files:

  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json
  • react_on_rails_pro/Gemfile.development_dependencies
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml
  • react_on_rails_pro/spec/dummy/package.json
  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.

Applied to files:

  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json
  • react_on_rails_pro/Gemfile.development_dependencies
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml
  • react_on_rails_pro/spec/dummy/package.json
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.

Applied to files:

  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json
  • react_on_rails_pro/Gemfile.development_dependencies
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml
  • react_on_rails_pro/spec/dummy/config/shakapacker.yml
  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: build-dummy-app-webpack-test-bundles
  • GitHub Check: build (22)
  • GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
  • GitHub Check: build-dummy-app-webpack-test-bundles (3.2, 20, minimum)
  • GitHub Check: build
  • GitHub Check: claude-review
🔇 Additional comments (6)
spec/dummy/package.json (1)

54-54: LGTM! Version consistency maintained.

The shakapacker upgrade to 9.1.0 is consistent across all package.json files in the codebase.

Based on learnings

react_on_rails_pro/spec/dummy/package.json (1)

66-66: Version upgrade looks good.

The shakapacker upgrade from 8.0.0 to 9.1.0 maintains consistency with other package.json files. The test plan indicates tests pass locally.

Based on learnings

Gemfile.development_dependencies (1)

3-3: LGTM!

The shakapacker gem version update to 9.1.0 is consistent with the package.json updates across the project.

react_on_rails_pro/spec/execjs-compatible-dummy/package.json (1)

33-33: Version update is consistent.

The shakapacker upgrade to 9.1.0 maintains version consistency across the project.

Based on learnings

react_on_rails_pro/Gemfile.development_dependencies (1)

10-10: LGTM!

The shakapacker gem version update is consistent with the corresponding package.json updates in the react_on_rails_pro directory.

react_on_rails_pro/spec/dummy/config/shakapacker.yml (1)

9-9: javascript_transpiler: babel is optional—Babel is the default transpiler in Shakapacker.

Babel is the default/transpiler Shakapacker expects, but it's not strictly required. Shakapacker ships a Babel preset and lists Babel packages as peer dependencies, yet you can opt into alternatives (SWC, esbuild-loader) or provide your own Babel config. Adding this setting explicitly works fine for clarity about the configured transpiler, or it can be removed as redundant if the default is sufficient.

justin808 and others added 8 commits November 5, 2025 10:43
Update Shakapacker dependency to version 9.1.0 across the project:
- Updated Gemfile.development_dependencies
- Updated spec/dummy/package.json
- Updated react_on_rails_pro/spec/dummy/package.json
- Ran bundle install and yarn install to update lock files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Update Shakapacker from 8.0.0 to 9.1.0 in:
- react_on_rails_pro/Gemfile.development_dependencies
- react_on_rails_pro/spec/execjs-compatible-dummy/package.json

This fixes the version mismatch error in CI where the gem was 8.0.0
but the node package was detected as 9.1.0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Shakapacker 9.1.0 defaults to SWC transpiler, but the Pro dummy apps
don't have swc-loader installed. Configure them to use Babel instead
by adding javascript_transpiler: babel to shakapacker.yml.

This fixes the build error:
"Your Shakapacker config specified using swc, but swc-loader package
is not installed."

Updated:
- react_on_rails_pro/spec/dummy/config/shakapacker.yml
- react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Shakapacker 9.1.0 changed how webpack rules are structured. The
findIndex approach was failing because it returned -1 when no SCSS
rule was found, causing "Cannot read properties of undefined".

Updated to use forEach pattern (matching main spec/dummy) which:
- Safely iterates through all rules
- Checks if rule.use is an array before accessing it
- Handles multiple SCSS rules if present

This fixes the build error:
"TypeError: Cannot read properties of undefined (reading 'push')"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Document the Shakapacker 9.1.0 upgrade in the Changed section,
including the webpack configuration improvements for Pro dummy apps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Changed from incorrect '.scss'.match(rule.test) to correct
rule.test.test('.scss') in webpack configuration.

The previous code was calling match() on a string with a RegExp
parameter, when it should use the RegExp's test() method to check
if a string matches the pattern.

Fixed in both:
- spec/dummy/config/webpack/commonWebpackConfig.js
- react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Changed rule.test.test('.scss') to rule.test.test('example.scss')
because webpack SCSS rules typically use patterns like /\.scss$/
which require a full filename to match properly, not just the
extension.

The string '.scss' doesn't match /\.scss$/ but 'example.scss' does.

This fixes the test failures where CSS wasn't being loaded, making
React components appear as empty divs (not visible).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The forEach approach with RegExp.test() broke Pro dummy tests.
Reverting to the original findIndex approach that was working
on master, which uses '.scss'.match(rule.test).

While '.scss'.match(rule.test) is technically backwards (should be
rule.test.test('.scss')), it works correctly and tests pass.

The main spec/dummy still uses the improved forEach pattern since
it was already updated as part of the Shakapacker 9.0 upgrade.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@justin808 justin808 force-pushed the justin808/shakapacker-9.1.0 branch from d9e719e to dee2edf Compare November 5, 2025 20:43
Copy link
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9e719e and dee2edf.

⛔ Files ignored due to path filters (4)
  • Gemfile.lock is excluded by !**/*.lock
  • react_on_rails_pro/spec/dummy/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • react_on_rails_pro/spec/execjs-compatible-dummy/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • spec/dummy/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • CHANGELOG.md (1 hunks)
  • Gemfile.development_dependencies (1 hunks)
  • react_on_rails_pro/Gemfile.development_dependencies (1 hunks)
  • react_on_rails_pro/spec/dummy/config/shakapacker.yml (1 hunks)
  • react_on_rails_pro/spec/dummy/package.json (1 hunks)
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml (1 hunks)
  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json (1 hunks)
  • spec/dummy/config/webpack/commonWebpackConfig.js (1 hunks)
  • spec/dummy/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • CHANGELOG.md
  • react_on_rails_pro/Gemfile.development_dependencies
  • react_on_rails_pro/spec/execjs-compatible-dummy/package.json
  • react_on_rails_pro/spec/execjs-compatible-dummy/config/shakapacker.yml
  • react_on_rails_pro/spec/dummy/config/shakapacker.yml
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1687
File: spec/dummy/package.json:0-0
Timestamp: 2025-01-23T18:20:45.824Z
Learning: When adding or updating dependencies in spec/dummy/package.json, maintain version consistency with other package.json files in the codebase to avoid potential version conflicts.
📚 Learning: 2025-01-23T18:20:45.824Z
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1687
File: spec/dummy/package.json:0-0
Timestamp: 2025-01-23T18:20:45.824Z
Learning: When adding or updating dependencies in spec/dummy/package.json, maintain version consistency with other package.json files in the codebase to avoid potential version conflicts.

Applied to files:

  • spec/dummy/package.json
  • react_on_rails_pro/spec/dummy/package.json
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.

Applied to files:

  • react_on_rails_pro/spec/dummy/package.json
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.

Applied to files:

  • react_on_rails_pro/spec/dummy/package.json
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.

Applied to files:

  • react_on_rails_pro/spec/dummy/package.json
  • spec/dummy/config/webpack/commonWebpackConfig.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: build
  • GitHub Check: build-dummy-app-webpack-test-bundles
  • GitHub Check: lint-js-and-ruby
  • GitHub Check: build-dummy-app-webpack-test-bundles
  • GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
  • GitHub Check: rspec-package-tests (3.2, minimum)
  • GitHub Check: rspec-package-tests (3.4, latest)
  • GitHub Check: markdown-link-check
  • GitHub Check: claude-review
🔇 Additional comments (3)
spec/dummy/package.json (1)

54-54: LGTM! Version upgrade is consistent.

The shakapacker upgrade from 9.0.0 to 9.1.0 aligns with the PR objective and maintains version consistency with other package.json files in the codebase.

Gemfile.development_dependencies (1)

3-3: LGTM! Gem version consistent with package updates.

The shakapacker gem upgrade to 9.1.0 is consistent with the JavaScript package updates throughout the PR.

react_on_rails_pro/spec/dummy/package.json (1)

66-66: Verify the major version upgrade.

This upgrades shakapacker from 8.0.0 to 9.1.0, which includes a major version bump. While the related babel transpiler configuration changes suggest migration work has been done, please ensure this environment's tests pass with the upgrade.

Based on learnings

@justin808
Copy link
Member Author

@claude review this PR.

@claude
Copy link

claude bot commented Nov 5, 2025

Claude finished @justin808's task —— View job


PR Review: Upgrade Shakapacker from 9.0.0 to 9.1.0

I've reviewed this PR and found both positive aspects and critical issues that need to be addressed before merging.


✅ Positive Aspects

  1. Comprehensive Version Updates: The upgrade is consistently applied across:

    • Main project Gemfile and package.json
    • Main spec/dummy app
    • Pro spec/dummy and execjs-compatible-dummy apps
  2. Proper Configuration: Added javascript_transpiler: babel to Pro dummy apps' shakapacker.yml files, which is important for compatibility (Shakapacker 9.x defaults to SWC)

  3. CHANGELOG Entry: The PR includes a properly formatted CHANGELOG entry following project conventions

  4. Lock Files Updated: All Gemfile.lock and yarn.lock files have been properly regenerated


🔴 Critical Issue: CI Failures

The CI is currently failing due to a webpack configuration error in the Pro dummy app. Here's the problem:

Error Details

[webpack-cli] Failed to load webpack.config.js
TypeError: Cannot read properties of undefined (reading 'push')
    at commonWebpackConfig.js:32:59

Root Cause

The file react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js still uses the old, broken approach for detecting SCSS rules:

Current code (lines 29-32):

const scssConfigIndex = baseClientWebpackConfig.module.rules.findIndex((config) =>
  '.scss'.match(config.test),
);
baseClientWebpackConfig.module.rules[scssConfigIndex].use.push(sassLoaderConfig);

Problems:

  1. findIndex returns -1 when no match is found, causing baseClientWebpackConfig.module.rules[-1] to be undefined
  2. The .match() approach is backwards - it should be config.test.test('.scss')
  3. This doesn't handle multiple SCSS rules (global .scss and .module.scss)

Solution Required

The Pro dummy app's webpack config needs to be updated to use the same forEach approach that was correctly applied to the main spec/dummy app at spec/dummy/config/webpack/commonWebpackConfig.js:25-54:

// Process webpack rules in single pass for efficiency
baseClientWebpackConfig.module.rules.forEach((rule) => {
  if (Array.isArray(rule.use)) {
    // Add sass-resources-loader to all SCSS rules (both .scss and .module.scss)
    if (rule.test && rule.test.test('example.scss')) {
      rule.use.push(sassLoaderConfig);
    }
  }
});

Note: The test should use 'example.scss' or better yet, check for both .scss and .module.scss patterns to ensure the loader is applied to all SCSS rules.


⚠️ Additional Observations

1. Inconsistent Updates

The main spec/dummy webpack config was updated with the improved forEach pattern, but the Pro dummy app was left with the broken findIndex approach. This inconsistency needs to be resolved.

2. CodeRabbit's Review Comments

CodeRabbit correctly identified this issue in their review, but it appears the fix was only partially applied (main dummy app fixed, but not Pro dummy app).

3. Version Jumps

  • Main spec/dummy: 9.0.0 → 9.1.0 (minor bump) ✅
  • Pro spec/dummy: 8.0.0 → 9.1.0 (skipped 9.0.0) ⚠️

The Pro version is jumping from 8.0.0 to 9.1.0, which is fine since the required configuration changes (javascript_transpiler: babel) have been added.


📋 Required Actions Before Merge

  1. Fix the Pro webpack config at react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js:

    • Replace the findIndex/array access approach with the forEach pattern
    • Ensure it matches the pattern used in spec/dummy/config/webpack/commonWebpackConfig.js
    • Test with both .scss and .module.scss files
  2. Verify CI passes after the fix

  3. Consider checking if there are any other Pro config files that might need similar updates


📝 Review Summary

This PR does a good job of upgrading Shakapacker across the project, but there's a critical webpack configuration bug in the Pro dummy app that's causing CI failures. The fix is straightforward - apply the same forEach pattern that was correctly implemented in the main dummy app.

The CHANGELOG entry is well-formatted and follows project conventions. All version numbers are consistent and lock files are properly updated.

Recommendation: Fix the Pro webpack config issue and re-run CI before merging.


Updated the rule detection to test against both 'example.scss' and
'example.module.scss' so sass-resources-loader is applied to both
global SCSS rules and CSS Module SCSS rules.

This fixes test failures where CSS Modules weren't being processed
correctly because the detection only matched regular .scss files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The findIndex approach with '.scss'.match(config.test) was failing
in Shakapacker 9.1.0 because the webpack rule structure changed.

Updated Pro dummy to use the same forEach pattern as main dummy:
- Tests both 'example.scss' and 'example.module.scss'
- Safely checks if rule.use is an array before pushing
- Handles both regular SCSS and CSS Module SCSS files

This fixes the build error:
"TypeError: Cannot read properties of undefined (reading 'push')"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
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_pro/spec/dummy/config/webpack/commonWebpackConfig.js (1)

32-33: Consider guarding against duplicate loaders.

If this configuration is processed multiple times (e.g., during hot reloads or when imported by multiple configs), sassLoaderConfig could be added repeatedly to the same rule.

Apply this diff to prevent duplicates:

-  if (Array.isArray(rule.use) && rule.test instanceof RegExp && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {
+  const hasSassResourcesLoader = rule.use.some(use => use.loader === 'sass-resources-loader');
+  if (Array.isArray(rule.use) && rule.test instanceof RegExp && !hasSassResourcesLoader && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {
     rule.use.push(sassLoaderConfig);
   }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dee2edf and 895bea8.

📒 Files selected for processing (2)
  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js (1 hunks)
  • spec/dummy/config/webpack/commonWebpackConfig.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • spec/dummy/config/webpack/commonWebpackConfig.js
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.

Applied to files:

  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.

Applied to files:

  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.

Applied to files:

  • react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: build-dummy-app-webpack-test-bundles
  • GitHub Check: build
  • GitHub Check: lint-js-and-ruby
  • GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
  • GitHub Check: rspec-package-tests (3.4, latest)
  • GitHub Check: rspec-package-tests (3.2, minimum)
  • GitHub Check: build-dummy-app-webpack-test-bundles
  • GitHub Check: claude-review
  • GitHub Check: markdown-link-check

Comment on lines 31 to 35
baseClientWebpackConfig.module.rules.forEach((rule) => {
if (Array.isArray(rule.use) && rule.test && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {
rule.use.push(sassLoaderConfig);
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add a type guard to prevent potential runtime errors.

The code assumes rule.test is a RegExp, but if it's a function or another type (which webpack allows), calling .test() will throw a TypeError.

Apply this diff to add a safety check:

 // Add sass-resources-loader to all SCSS rules (both .scss and .module.scss)
 baseClientWebpackConfig.module.rules.forEach((rule) => {
-  if (Array.isArray(rule.use) && rule.test && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {
+  if (Array.isArray(rule.use) && rule.test instanceof RegExp && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {
     rule.use.push(sassLoaderConfig);
   }
 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
baseClientWebpackConfig.module.rules.forEach((rule) => {
if (Array.isArray(rule.use) && rule.test && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {
rule.use.push(sassLoaderConfig);
}
});
baseClientWebpackConfig.module.rules.forEach((rule) => {
if (Array.isArray(rule.use) && rule.test instanceof RegExp && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {
rule.use.push(sassLoaderConfig);
}
});
🤖 Prompt for AI Agents
In react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js around
lines 31 to 35, the loop calls rule.test.test(...) assuming rule.test is a
RegExp; add a type guard to avoid TypeError when rule.test is a function or
other type. Update the condition to verify Array.isArray(rule.use) && rule.test
instanceof RegExp && (rule.test.test('example.scss') ||
rule.test.test('example.module.scss')), so .test is only invoked when rule.test
is a RegExp.

justin808 and others added 2 commits November 5, 2025 15:27
The commonWebpackConfig.js file had a long conditional that needed to be
split across multiple lines according to Prettier rules in the Pro package.

This was not caught by pre-commit hooks because the root .prettierignore
excludes react_on_rails_pro/, but CI runs linting separately in that
directory with its own rules.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Previously, pre-commit hooks only ran RuboCop, Prettier, and trailing
newline checks, but did NOT run ESLint. This meant ESLint errors could
slip through and only be caught in CI.

Changes:
- Created bin/lefthook/eslint-lint hook script that auto-fixes ESLint issues
- Added ESLint hook to .lefthook.yml pre-commit configuration
- Updated CLAUDE.md to document:
  - The complete list of pre-commit hooks that run
  - The monorepo structure with separate Pro package linting
  - Why CI lints both directories separately

The hook follows the same pattern as other hooks:
- Detects changed JS/TS files (staged + unstaged + untracked)
- Runs ESLint with --fix to auto-correct issues
- Re-stages fixed files automatically

This prevents the frustrating situation where local commits succeed but
CI fails on ESLint violations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7210588 and 42d8f98.

📒 Files selected for processing (3)
  • .lefthook.yml (1 hunks)
  • CLAUDE.md (2 hunks)
  • bin/lefthook/eslint-lint (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CLAUDE.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: build
  • GitHub Check: lint-js-and-ruby
  • GitHub Check: rspec-package-tests (3.2, minimum)
  • GitHub Check: rspec-package-tests (3.4, latest)
  • GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
  • GitHub Check: build-dummy-app-webpack-test-bundles (3.2, 20, minimum)
  • GitHub Check: build-dummy-app-webpack-test-bundles
  • GitHub Check: build-dummy-app-webpack-test-bundles
  • GitHub Check: markdown-link-check
🔇 Additional comments (2)
bin/lefthook/eslint-lint (1)

1-3: Good use of bash strict mode.

The shebang and set -euo pipefail are excellent practices for catching errors early in shell scripts.

.lefthook.yml (1)

14-16: LGTM: ESLint hook integration is consistent.

The new ESLint hook follows the existing pattern and is properly integrated alongside other linting hooks. The all-changed context aligns with the other hooks in this file.


# Re-stage files if running on staged or all-changed context
if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
echo $files | xargs -r git add
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider portability: xargs -r is GNU-specific.

The -r flag on line 25 prevents xargs from running when there's no input, but it's a GNU extension not available on macOS by default. The revised solution above using -0 with null-delimited input addresses this, as the array expansion will naturally handle the empty case.

🤖 Prompt for AI Agents
In bin/lefthook/eslint-lint around line 25, avoid the GNU-only xargs -r flag;
instead either guard the call so it only runs when there are files or feed
null-delimited input to a portable xargs. Replace the current pipeline that uses
xargs -r with a pattern that prints/outputs filenames separated by NUL and
invokes xargs -0 git add, or wrap the git-add pipeline in a simple shell
conditional that checks for non-empty files before calling xargs; this removes
the -r dependency and keeps behavior safe on macOS.

justin808 and others added 2 commits November 5, 2025 16:04
Shakapacker 9 changed the CSS Modules default configuration from default
exports to named exports (namedExport: true). This breaks existing code
that uses `import styles from './style.module.css'` syntax.

This commit adds webpack configuration to override Shakapacker 9's CSS
Modules settings and restore backward compatibility with the v8 behavior.

Changes:
- Override namedExport: false to support default imports
- Set exportLocalsConvention: 'camelCase' to match existing usage
- Add configuration in Pro dummy commonWebpackConfig
- Matches the fix already applied to regular dummy in previous commits

This fixes CI test failures where React components weren't rendering
because CSS module imports were failing at runtime.

Related to Shakapacker upgrade from 8.0.0 to 9.1.0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add comprehensive debugging guide for Webpack/Shakapacker configuration
issues, including:

- Debug script templates for inspecting webpack rules
- Step-by-step debugging workflow
- Common issues and solutions (especially CSS Modules in Shakapacker 9)
- Best practices for analyzing webpack configuration

This documentation captures the debugging approach used to identify and
fix the CSS Modules issue during the Shakapacker 9.1.0 upgrade.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The previous hooks only linted files in the root directory, but the
react_on_rails_pro/ directory has its own ESLint and Prettier configs
that need to be run separately. This caused CI failures when Pro files
had linting issues that weren't caught locally.

Changes:
1. Updated bin/lefthook/eslint-lint to:
   - Separate files into root and Pro directories
   - Run ESLint in Pro directory with Pro's config for Pro files
   - Track exit codes and fail if either check fails

2. Updated bin/lefthook/prettier-format to:
   - Separate files into root and Pro directories
   - Run Prettier in Pro directory with Pro's config for Pro files

3. Fixed Prettier formatting in commonWebpackConfig.js:
   - Condensed multi-line conditional to single line per Pro's config

This ensures local pre-commit hooks match CI behavior exactly, preventing
the frustrating situation where commits succeed locally but fail in CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@claude
Copy link

claude bot commented Nov 6, 2025

Code Review: Shakapacker 9.0.0 to 9.1.0 Upgrade

Thank you for this upgrade PR! Overall, this is a well-structured dependency upgrade with good attention to backward compatibility. Here's my detailed review:


✅ Strengths

1. Comprehensive Dependency Updates

  • All shakapacker references updated consistently across:
    • Root Gemfile.development_dependencies
    • Pro Gemfile.development_dependencies
    • All dummy app package.json files
    • Lock files properly regenerated

2. Excellent Documentation

  • Added comprehensive webpack debugging guide in CLAUDE.md:90-137
  • Clear explanation of CSS Modules compatibility issues
  • Practical troubleshooting steps with code examples
  • Monorepo structure documentation improvements

3. Improved Developer Experience

  • New ESLint pre-commit hook (bin/lefthook/eslint-lint) adds automated linting
  • Enhanced prettier-format script handles both root and Pro directories separately
  • Better separation of concerns for monorepo structure

4. Backward Compatibility

  • CSS Modules configuration properly handles Shakapacker 9.x defaults
  • namedExport: false override maintains compatibility with existing import styles from syntax
  • javascript_transpiler: babel configured in shakapacker.yml files

🔍 Code Quality Observations

Webpack Configuration Consistency

spec/dummy/config/webpack/commonWebpackConfig.js:28 - Good improvement:

if (rule.test && (rule.test.test('example.scss') || rule.test.test('example.module.scss'))) {

Using .test.test() is more reliable than string matching with .match().

react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js:31-39 - Consider consolidating:
The Pro version has two separate forEach loops (lines 31-39 for sass-loader, lines 57-76 for CSS modules), while the open-source version combines them efficiently in a single pass (spec/dummy/config/webpack/commonWebpackConfig.js:25-53).

Recommendation: Consider refactoring the Pro version to use the same single-pass pattern as the open-source version for consistency and better performance.


🐛 Potential Issues

1. Bash Script Quoting (bin/lefthook/eslint-lint)

Lines 26, 34, 45, 56:

printf "  %s\n" $root_files  # Missing quotes
echo $root_files | xargs -r git add  # Missing quotes

Issue: Unquoted variables can cause word splitting if filenames contain spaces.

Fix: Quote the variables:

printf "  %s\n" "$root_files"
echo "$root_files" | xargs -r git add

Same issue in bin/lefthook/prettier-format at lines 24, 33, 52, 61.

2. Error Handling in Bash Scripts

bin/lefthook/eslint-lint:28, 50:

if \! yarn run eslint $root_files --report-unused-disable-directives --fix; then
  exit_code=1
fi

Issue: The script continues executing even after failures, potentially masking issues.

Consideration: With set -euo pipefail at the top, failed commands normally exit immediately. The current pattern catches errors and continues, which is intentional for running both root and Pro linting. This is actually fine, but the exit code handling could be clearer.


🔒 Security Considerations

No security concerns identified:

  • Shakapacker 9.1.0 is a legitimate, minor version upgrade
  • No changes to authentication, authorization, or data handling
  • No exposure of sensitive information
  • Lock files properly updated

⚡ Performance Considerations

Positive:

  • Single-pass webpack rule processing in spec/dummy (lines 25-53) is more efficient
  • Pre-commit hooks run only on changed files (fast feedback loop)

Suggestion:

  • Pro dummy app still uses two passes through webpack rules. Consider consolidating for consistency and marginal performance gain.

🧪 Test Coverage

Current State:

  • ✅ PR mentions tests pass locally
  • ✅ RuboCop passes
  • ⏳ CI pending

Recommendations:

  1. Add specific test for CSS Modules: Ensure the namedExport: false configuration works as expected
  2. Test webpack config in both dummy apps: Verify sass-resources-loader properly added to all SCSS rules
  3. Verify HMR still works: The Pro dummy app has HMR-specific plugin configuration (lines 41-49)

📝 Additional Suggestions

1. CHANGELOG.md Format

Line 44: Good formatting! The PR link format matches project conventions.

Consider adding a note about the breaking change potential if users were relying on Shakapacker defaults.

2. Missing Trailing Newlines?

According to CLAUDE.md requirements, all files must end with newlines. The CI will catch this, but verify:

bundle exec rubocop

3. Testing the New ESLint Hook

The new bin/lefthook/eslint-lint script hasn't been battle-tested yet. Consider:

  • Testing with files containing spaces in names
  • Testing when only Pro files change
  • Testing when both root and Pro files change

📋 Checklist Before Merge

  • Fix bash script quoting issues in bin/lefthook/eslint-lint and bin/lefthook/prettier-format
  • Verify all files end with newlines (bundle exec rubocop)
  • Consider consolidating Pro webpack config for consistency
  • Wait for CI to pass (especially lint-js-and-ruby workflow)
  • Test the new ESLint pre-commit hook manually
  • Verify CSS Modules work in both dummy apps

🎯 Overall Assessment

Rating: 8.5/10

This is a solid upgrade PR with good attention to compatibility and developer experience. The main issues are:

  1. Minor bash scripting improvements needed (quoting)
  2. Slight inconsistency between open-source and Pro webpack configs
  3. New pre-commit hook needs validation

The comprehensive documentation additions are excellent and will help future maintainers troubleshoot webpack issues.

Recommendation: Approve with minor fixes


📚 References

@justin808 justin808 merged commit 7d61170 into master Nov 6, 2025
28 checks passed
@justin808 justin808 deleted the justin808/shakapacker-9.1.0 branch November 6, 2025 02:42
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.

2 participants