Skip to content
Closed
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a6ae0c9
Phase 6: Restructure Ruby Gems to Final Monorepo Layout
justin808 Nov 23, 2025
06076ef
Fix critical Pro gemspec and Gemfile issues
justin808 Nov 23, 2025
d8f1135
Fix Pro gemspec paths after Phase 6 restructure
justin808 Nov 23, 2025
4020d80
Add REACT_ON_RAILS_PRO_LICENSE to missing workflows
justin808 Nov 23, 2025
c44e0e7
Fix ReactOnRailsPro::Utils uninitialized constant error
justin808 Nov 23, 2025
a1a6ebe
Fix example generation in monorepo with Pro gem
justin808 Nov 23, 2025
081e278
Skip Pro validation for example app RSpec tests
justin808 Nov 23, 2025
397959a
Fix critical bug: MIT gem was including Pro code
justin808 Nov 23, 2025
dfbb4cd
Fix gemspec to exclude entire react_on_rails_pro directory
justin808 Nov 23, 2025
3b4e0f4
Fix CI failures: Build packages before yalc publish
justin808 Nov 23, 2025
9d20573
Add missing Pro package RSpec test files
justin808 Nov 23, 2025
6b83769
Add gemspec validation and documentation
justin808 Nov 23, 2025
b244c43
Fix RuboCop line length violations in Pro specs
justin808 Nov 23, 2025
28c029d
Fix Pro workflow paths after Phase 6 restructuring
justin808 Nov 23, 2025
489c6ba
Fix workspace dependency resolution for react-on-rails
justin808 Nov 23, 2025
ac1dd0f
Fix Pro gem loading: Remove invalid .strip_heredoc call
justin808 Nov 23, 2025
f7935a5
Fix RuboCop config inheritance path in spec/pro
justin808 Nov 23, 2025
236f31d
Fix knip unused export warning for test utility function
justin808 Nov 23, 2025
a747026
Fix ESLint violations in Pro packages
justin808 Nov 23, 2025
7b01e50
Fix workspace dependencies and add clarifying comments
justin808 Nov 23, 2025
f31d034
Add auto-push instructions for test fixes to CLAUDE.md
justin808 Nov 23, 2025
0173f7a
Fix type safety in licenseValidator.ts: use nullish coalescing
justin808 Nov 23, 2025
604065e
Fix Prettier formatting violations
justin808 Nov 23, 2025
261244b
Fix ReactOnRailsPro::Utils constant loading issue
justin808 Nov 23, 2025
e329076
Add Bundler check to prevent false Pro gem detection in sibling struc…
justin808 Nov 23, 2025
eed0dfa
Fix dummy app tests: skip version validation in monorepo context
justin808 Nov 23, 2025
34b7a1f
Fix workspace dependency resolution for react-on-rails
justin808 Nov 23, 2025
6dd869b
Revert workspace resolutions - not needed and causes test failures
justin808 Nov 23, 2025
3a1784c
Add fakefs gem to test dependencies
justin808 Nov 23, 2025
34580c0
Fix Pro workflow gem installation path mismatch
justin808 Nov 23, 2025
73ef077
Fix Pro gem tests: add platform lock before bundle install
justin808 Nov 23, 2025
d43d32a
Fix release.rake paths for Phase 6 sibling gem structure
justin808 Nov 23, 2025
8521fba
Fix CONTRIBUTING.md and clarify workspace dependency guidance
justin808 Nov 23, 2025
4191060
Fix Pro gem tests: update cache key to use Gemfile.lock
justin808 Nov 23, 2025
e9e5f35
Fix ReactOnRailsPro::Utils constant detection
justin808 Nov 23, 2025
08333ad
Fix workspace dependency resolution - force workspace link
justin808 Nov 23, 2025
876025e
Update gem-release to 2.2.4 to fix Bundler error
justin808 Nov 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/read-me.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,36 @@ Most workflows use minimal permissions. The comment-triggered workflows require:
- `pull-requests: write` - To post comments and reactions
- `actions: write` - To trigger other workflows

## Required Secrets for Pro Workflows

Workflows that test React on Rails Pro features require the following repository secret:

### `REACT_ON_RAILS_PRO_LICENSE_V2`

This secret contains the Pro license key needed to run Pro features during CI. It must be configured as a repository secret in GitHub Actions.

**Workflows that require this secret:**

- `examples.yml` - When generating/testing examples with Pro features
- `integration-tests.yml` - When running integration tests that may use Pro features
- Any workflow that runs example apps or tests that might invoke Pro functionality

**Setting up the secret:**

1. Go to repository Settings → Secrets and variables → Actions
2. Add a new secret named `REACT_ON_RAILS_PRO_LICENSE_V2`
3. Set the value to a valid React on Rails Pro license key

**When adding new workflows:**
If your workflow runs any Rails application that might have the Pro gem available (example apps, dummy apps, integration tests), add this environment variable:

```yaml
env:
REACT_ON_RAILS_PRO_LICENSE: ${{ secrets.REACT_ON_RAILS_PRO_LICENSE_V2 }}
```

This prevents license validation failures during test runs in the monorepo where both MIT and Pro packages are present.

## Conditional Execution

Many workflows use change detection to skip unnecessary jobs:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
env:
REACT_ON_RAILS_PRO_LICENSE: ${{ secrets.REACT_ON_RAILS_PRO_LICENSE_V2 }}
SKIP_YARN_COREPACK_CHECK: 0
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -144,6 +145,10 @@ jobs:
run: |
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
sudo yarn global add yalc
- name: Build packages before yalc publish
# Build all workspace packages (react-on-rails, react-on-rails-pro, react-on-rails-pro-node-renderer)
# This ensures the lib/ directories are populated with compiled JS before yalc publish
run: yarn workspaces run build
- name: yalc publish for react-on-rails
# Use yarn workspace script to publish all workspace packages to yalc
# Runs the "yalc:publish" script defined in each workspace's package.json
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ jobs:
run: |
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
sudo yarn global add yalc
- name: Build react-on-rails package
run: cd packages/react-on-rails && yarn build
- name: yalc publish for react-on-rails
run: cd packages/react-on-rails && yalc publish
- name: yalc add react-on-rails
Expand Down Expand Up @@ -184,6 +186,8 @@ jobs:
)
strategy:
matrix: ${{ fromJson(needs.setup-integration-matrix.outputs.matrix) }}
env:
REACT_ON_RAILS_PRO_LICENSE: ${{ secrets.REACT_ON_RAILS_PRO_LICENSE_V2 }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -235,6 +239,8 @@ jobs:
run: |
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
sudo yarn global add yalc
- name: Build react-on-rails package
run: cd packages/react-on-rails && yarn build
- name: yalc publish for react-on-rails
run: cd packages/react-on-rails && yalc publish
- name: yalc add react-on-rails
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint-js-and-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ jobs:
run: |
yarn install --no-progress --no-emoji --frozen-lockfile
sudo yarn global add yalc
- name: Build react-on-rails package
run: cd packages/react-on-rails && yarn build
- name: yalc publish for react-on-rails
run: cd packages/react-on-rails && yalc publish
- name: yalc add react-on-rails
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pro-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ jobs:
uses: actions/cache@v4
with:
path: react_on_rails_pro/vendor/bundle
key: v4-pro-package-gem-cache-${{ hashFiles('react_on_rails_pro/react_on_rails_pro.gemspec') }}
key: v4-pro-package-gem-cache-${{ hashFiles('react_on_rails_pro.gemspec') }}

- name: Cache Pro package node modules
uses: actions/cache@v4
Expand Down Expand Up @@ -412,7 +412,7 @@ jobs:
uses: actions/cache@v4
with:
path: react_on_rails_pro/vendor/bundle
key: v4-pro-package-gem-cache-${{ hashFiles('react_on_rails_pro/react_on_rails_pro.gemspec') }}
key: v4-pro-package-gem-cache-${{ hashFiles('react_on_rails_pro.gemspec') }}

- name: Cache Pro package node modules
uses: actions/cache@v4
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/pro-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ jobs:
- name: Cache Pro package Ruby gems
uses: actions/cache@v4
with:
path: react_on_rails_pro/vendor/bundle
key: v4-pro-package-gem-cache-${{ hashFiles('react_on_rails_pro/react_on_rails_pro.gemspec') }}
path: vendor/bundle
key: v4-pro-package-gem-cache-${{ hashFiles('react_on_rails_pro.gemspec') }}

- name: Cache Pro dummy app node modules
uses: actions/cache@v4
Expand All @@ -134,6 +134,7 @@ jobs:
key: v4-pro-dummy-app-gem-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/Gemfile.lock') }}

- name: Install Ruby Gems for Pro package
working-directory: .
run: |
gem install bundler -v "2.5.4"
echo "Bundler version: "; bundle --version
Expand Down Expand Up @@ -166,9 +167,11 @@ jobs:
run: yarn workspace react-on-rails-pro build

- name: Lint Ruby
run: bundle exec rubocop --ignore-parent-exclusion
working-directory: .
run: bundle exec rubocop --ignore-parent-exclusion lib/react_on_rails_pro spec/pro

- name: Validate RBS type signatures
working-directory: .
run: bundle exec rake rbs:validate

- name: Lint JS
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/pro-test-package-and-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
cache-dependency-path: '**/yarn.lock'

- name: Print system information
working-directory: .
run: |
echo "Linux release: "; cat /etc/issue
echo "Current user: "; whoami
Expand Down Expand Up @@ -205,6 +206,7 @@ jobs:
cache-dependency-path: '**/yarn.lock'

- name: Print system information
working-directory: .
run: |
echo "Linux release: "; cat /etc/issue
echo "Current user: "; whoami
Expand Down Expand Up @@ -284,6 +286,7 @@ jobs:
bundler: 2.5.4

- name: Print system information
working-directory: .
run: |
echo "Linux release: "; cat /etc/issue
echo "Current user: "; whoami
Expand All @@ -294,10 +297,11 @@ jobs:
- name: Cache Pro package Ruby gems
uses: actions/cache@v4
with:
path: react_on_rails_pro/vendor/bundle
key: v4-pro-package-gem-cache-ruby${{ matrix.ruby-version }}-${{ hashFiles('react_on_rails_pro/react_on_rails_pro.gemspec') }}
path: vendor/bundle
key: v4-pro-package-gem-cache-ruby${{ matrix.ruby-version }}-${{ hashFiles('react_on_rails_pro.gemspec') }}

- name: Install Ruby Gems for Pro package
working-directory: .
run: |
gem install bundler -v "2.5.4"
echo "Bundler version: "; bundle --version
Expand All @@ -306,7 +310,8 @@ jobs:
bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3

- name: Run RSpec tests for Pro package
run: bundle exec rspec spec/react_on_rails_pro
working-directory: .
run: bundle exec rspec spec/pro/react_on_rails_pro

- name: Store test results
uses: actions/upload-artifact@v4
Expand All @@ -320,4 +325,4 @@ jobs:
if: always()
with:
name: pro-rspec-package-log-ruby${{ matrix.ruby-version }}
path: react_on_rails_pro/log/test.log
path: log/test.log
9 changes: 8 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ AllCops:
- '**/tmp/**/*'
- 'coverage/**/*'
- 'gen-examples/examples/**/*'
- 'lib/react_on_rails_pro/**/*' # Exclude Pro Ruby code (has its own linting)
- 'node_modules/**/*'
- 'react_on_rails_pro/**/*' # Exclude pro package (has its own linting)
- 'react_on_rails_pro/**/*' # Exclude Pro dummy app and test infrastructure
- 'spec/dummy/bin/*'
- 'spec/pro/**/*' # Exclude Pro specs (has its own linting)
- 'spec/fixtures/**/*'
- 'spec/react_on_rails/dummy-for-generators/**/*'
- 'tmp/**/*'
Expand All @@ -41,6 +43,11 @@ Naming/FileName:
- '**/Rakefile'
- '**/Steepfile'

Layout/ArgumentAlignment:
# Disabled due to RuboCop bug with Ruby 3.4: uninitialized constant StringIO
# See: https://github.com/rubocop/rubocop/issues
Enabled: false

Layout/LineLength:
Max: 120

Expand Down
File renamed without changes.
22 changes: 22 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,28 @@ These requirements are non-negotiable. CI will fail if not followed.
- Note in PR descriptions which fixes were tested locally vs. which are hypothetical
- Explain any testing limitations encountered

**CRITICAL - AUTOMATIC PUSHING FOR TEST FIXES:**

When the user asks you to "fix the tests" or "fix failing tests":

1. **ALWAYS push immediately after making test fixes** - don't wait to be asked
2. **Test fixes workflow:**
- Run linting: `bundle exec rubocop` and `yarn start format`
- Run the specific tests locally if possible
- Create commit with descriptive message about what was fixed
- Push immediately using `git push`
3. **Commit message format for test fixes:**
- Use clear, descriptive messages like "Fix RuboCop violations in helper_spec.rb"
- Include test command if relevant: "Fix failing integration tests (spec/system/integration_spec.rb)"
- Reference CI failure if applicable: "Fix CI failures in minimum config tests"
4. **After pushing:**
- Check CI status with `gh pr view --json statusCheckRollup`
- If there's a PR, optionally use `gh run watch` to monitor the workflow
5. **Exception:** Only skip auto-push if:
- You cannot test locally AND the fix is highly speculative
- The user explicitly asks you NOT to push
- There are multiple unrelated changes that need to be separated into different commits

**See also**: When facing complex PRs with multiple CI failures, refer to `.claude/docs/pr-splitting-strategy.md` for guidance on splitting large PRs into smaller, more manageable pieces.

---
Expand Down
54 changes: 54 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,60 @@ npm install <tarball path/URL>

or the equivalent command for your package manager.

## Gemspec File Management

**Important for Pro package contributors:**

The React on Rails Pro gemspec (`react_on_rails_pro.gemspec`) uses **explicit whitelisting** for included files rather than blacklisting. This is a security measure to ensure no unintended files are included in the Pro gem.

### What this means

When you add new Ruby files to the Pro package (`lib/react_on_rails_pro/`), they will **NOT** be automatically included in the gem. You must explicitly add them to the gemspec.

### How to update the gemspec

When adding new files to the Pro package:

1. **Add new Ruby files** to `lib/react_on_rails_pro/` as needed
2. **Update `react_on_rails_pro.gemspec`** to include them:

```ruby
s.files = Dir.glob("{lib/react_on_rails_pro.rb,lib/react_on_rails_pro/**/*}") +
Dir.glob("lib/tasks/{assets_pro.rake,v8_log_processor.rake}") +
# ... other files
```

The glob patterns should automatically pick up new files under `lib/react_on_rails_pro/`, but if you add new directories or file types, verify they're included.

3. **Run the gemspec validation test** to ensure your files are included:

```bash
bundle exec rspec spec/react_on_rails/gemspec_file_inclusion_spec.rb
```

This test verifies:

- MIT gem doesn't include any Pro files
- Pro gem includes all intended Pro files
- No cross-contamination between MIT and Pro packages

### Why whitelisting?

The previous blacklist approach accidentally included Pro files in the MIT gem, which is a licensing violation. Whitelisting ensures:

- ✅ Only intended files are included
- ✅ New files require conscious decision to include
- ✅ Prevents licensing violations
- ✅ CI will catch missing files via automated tests

### Troubleshooting

If you see test failures about missing files in the Pro gem:

1. Check if your new files are under `lib/react_on_rails_pro/`
2. Verify the glob patterns in `react_on_rails_pro.gemspec` match your file structure
3. Run `gem build react_on_rails_pro.gemspec` and inspect the built gem with `gem specification <gem-file>.gem files`

# Development Setup for Gem and Node Package Contributors

## Dev Initial Setup
Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

source "https://rubygems.org"

# Specify your gem"s dependencies in react_on_rails.gemspec
gemspec
# Specify your gem"s dependencies in react_on_rails.gemspec and react_on_rails_pro.gemspec
gemspec name: "react_on_rails"
gemspec name: "react_on_rails_pro"

eval_gemfile File.expand_path("./Gemfile.development_dependencies", __dir__)
Loading
Loading