Skip to content

Conversation

@justin808
Copy link
Member

@justin808 justin808 commented Nov 22, 2025

Summary

This PR adds the package as a workspace package, completing the monorepo structure for React on Rails.

⚠️ Depends on: #2097 (buildConsoleReplay refactoring) - merge that first

Changes

Package Structure

  • ✨ Create workspace package
  • 📦 Move node-renderer code from to new monorepo location
  • 📝 Add package.json, babel.config.js, tsconfig.json for the new package
  • 🔧 Update root package.json to include node-renderer in workspaces

Configuration Updates

  • 🔧 Update ESLint config to handle node-renderer's TypeScript/ESM requirements
    • Disable import resolution rules (ESM requires .js extensions but ESLint can't resolve them for .ts files)
    • Disable unsafe type rules for external libraries
    • Allow non-null assertions and missing expect in tests
  • 📝 Update .prettierignore to exclude node-renderer test fixtures
  • 📝 Update .gitignore for node-renderer build artifacts
  • 📄 Update LICENSE.md to include node-renderer package

CI Workflow Updates

  • 🔧 Update Pro workflows for node-renderer package location
  • 📝 Pin Node.js versions for Pro workflows (22.12.x for most, 22.11.0 for package tests)
  • 🔧 Update cache paths for workspace structure
  • 📝 Add step to build react-on-rails before Pro linting

Testing

All checks pass:

  • ✅ Clean install passes: yarn install
  • ✅ Build passes: yarn run build
  • ✅ RuboCop linting passes: bundle exec rubocop
  • ✅ ESLint passes: yarn run eslint . --max-warnings 0
  • ✅ Prettier formatting passes: yarn start format.listDifferent

Merge Order

  1. First: Merge Keep original buildConsoleReplay parameter order (disable ESLint rule) #2097 (buildConsoleReplay refactoring)
  2. Then: Merge this PR (it's rebased on Keep original buildConsoleReplay parameter order (disable ESLint rule) #2097)

Next Steps

After this PR merges, the next PRs in the sequence will add:

  • Cleanup of old node-renderer location
  • Documentation updates for monorepo structure
  • Additional tooling improvements

Related

🤖 Generated with Claude Code

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 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 23 minutes and 53 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 0263541 and 18f82b6.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (74)
  • .github/workflows/pro-integration-tests.yml (3 hunks)
  • .github/workflows/pro-lint.yml (2 hunks)
  • .github/workflows/pro-test-package-and-gem.yml (4 hunks)
  • .gitignore (1 hunks)
  • .prettierignore (1 hunks)
  • LICENSE.md (1 hunks)
  • eslint.config.ts (4 hunks)
  • package.json (4 hunks)
  • packages/react-on-rails-pro-node-renderer/babel.config.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/package.json (1 hunks)
  • packages/react-on-rails-pro-node-renderer/script/preinstall.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/ReactOnRailsProNodeRenderer.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/default-node-renderer.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/integrations/api.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/integrations/honeybadger.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/integrations/sentry.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/integrations/sentry6.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/master.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/master/restartWorkers.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/configBuilder.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/debug.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/errorReporter.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/fileExistsAsync.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/licensePublicKey.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/licenseValidator.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/locks.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/log.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/packageJson.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/sharedConsoleHistory.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/tracing.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/truthy.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/shared/utils.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/tsconfig.json (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/worker.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/worker/authHandler.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/worker/checkProtocolVersionHandler.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/worker/handleGracefulShutdown.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/worker/handleRenderRequest.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/worker/types.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/src/worker/vm.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/concurrentHtmlStreaming.test.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/bundle.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/loadable-stats-other.json (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/loadable-stats.json (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/bionicworkshop/fa6ccf6b/authorsPageRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/bionicworkshop/fa6ccf6b/landingPageRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/bionicworkshop/fa6ccf6b/postPageRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/bionicworkshop/fa6ccf6b/signInPageWithFlashRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/friendsandguests/1a7fe417/layoutNavbarRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/friendsandguests/1a7fe417/listingIndexRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/friendsandguests/1a7fe417/listingsShowRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/friendsandguests/1a7fe417/userShowRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/friendsandguests/1a7fe417/welcomePageRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/react-webpack-rails-tutorial/ec974491/appRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/react-webpack-rails-tutorial/ec974491/navigationBarAppRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/react-webpack-rails-tutorial/ec974491/routerAppRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/spec-dummy/9fa89f7/reduxAppRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/spec-dummy/asyncComponentsTreeForTestingRenderingRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/spec-dummy/e5e10d1/consoleLogsInAsyncServerRequest.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/fixtures/secondary-bundle.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/handleRenderRequest.test.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/helper.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/htmlStreaming.test.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/httpRequestUtils.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/licenseValidator.test.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/redisClient.test.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/serverRenderRSCReactComponent.test.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/shared/smartTrim.test.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/shared/tracing.test.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/testingNodeRendererConfigs.js (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/tsconfig.json (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/vm.test.ts (1 hunks)
  • packages/react-on-rails-pro-node-renderer/tests/worker.test.ts (1 hunks)
  • packages/react-on-rails/tests/buildConsoleReplay.test.js (1 hunks)
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-pro-node-renderer-package

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 22, 2025

Code Review - PR #2094: Add Pro Node Renderer Package to Workspace

Summary

This PR successfully integrates the Pro Node Renderer package into the monorepo workspace structure. The changes are well-organized and follow the project's conventions. Overall, this is a solid piece of infrastructure work.


✅ Strengths

1. Excellent Code Organization

  • Clean separation of the node-renderer as a workspace package
  • Proper TypeScript configuration with tsconfig.json for both source and tests
  • Well-structured test suite with 10 test files covering core functionality

2. Good Configuration Management

  • ESLint config properly handles TypeScript/ESM requirements with appropriate rule overrides
  • .prettierignore updated to exclude large test fixtures (avoiding unnecessary formatting runs)
  • .gitignore correctly excludes build artifacts while tracking source code

3. Strong Test Coverage

The test suite includes comprehensive coverage:

  • vm.test.ts - Virtual machine context management
  • worker.test.ts - Worker process handling
  • handleRenderRequest.test.ts - Request processing
  • licenseValidator.test.ts - License validation
  • HTML streaming tests (both concurrent and standard)
  • Integration tests with real project fixtures

4. Proper Build Script Management

  • prepare script correctly guards against missing builds
  • Root package.json updated to build all three workspace packages in sequence

5. Bug Fix Included

  • Fixed buildConsoleReplay parameter ordering to comply with default-param-last ESLint rule
  • This demonstrates attention to linting compliance

⚠️ Issues and Concerns

1. CRITICAL: Potential .gitignore Conflict

The new .gitignore entries may conflict with existing patterns. Line 23 has /node_package/lib while new lines 71-72 have packages/*/lib/. If the code moved from node_package to packages, line 23 should likely be removed.

Recommendation: Verify if /node_package/lib still exists and remove the old pattern if obsolete.

2. CRITICAL: Missing Build Script Testing

According to CLAUDE.md (Testing Build Scripts section), MANDATORY testing is required after modifying package.json or build configs.

Question for PR author: Have you manually tested:

  1. yarn run prepack succeeds?
  2. yarn run yalc.publish (for react-on-rails-pro-node-renderer) succeeds?
  3. Build artifacts exist at expected paths?

This is critical because the prepack script runs during npm install and failures are often silent.

3. Security: License Validation Exit Behavior

In packages/react-on-rails-pro-node-renderer/src/shared/licenseValidator.ts:32-37, the code calls process.exit(1) on invalid license. While appropriate for production, consider:

  • Does this interfere with test suites or CI?
  • Should there be an environment variable to disable license checks in test/development?

Current safeguard: The code checks isProduction() before enforcing some validations, which is good.

4. ESLint Configuration: Overly Broad Rule Disabling

In eslint.config.ts:232-264, many import and type-safety rules are disabled for Pro packages. While the comment explains ESM requires .js extensions that ESLint can't resolve for .ts files, disabling all unsafe type rules reduces type safety.

Recommendation: Consider documenting that TypeScript compiler provides these checks, so ESLint disabling is acceptable. Also add a CI step that explicitly runs yarn workspace react-on-rails-pro-node-renderer run type-check.

5. Potential Issue: preinstall Script May Fail

In packages/react-on-rails-pro-node-renderer/script/preinstall.js:19-31, the script references link-source which doesn't exist in package.json. This will fail (gracefully) on every install.

Questions:

  1. Is link-source expected to be defined later?
  2. Should this script reference something that actually exists?
  3. Is this preinstall script even necessary for the node-renderer package?

6. Documentation: Missing CHANGELOG Entries

According to CLAUDE.md (Changelog section), this is a Pro-only feature, so it should have an entry in /react_on_rails_pro/CHANGELOG.md.

Recommendation: Add an entry in the Pro changelog.


🔍 Performance Considerations

Positive:

  • VM context caching prevents repeated VM initialization
  • Shared console history reduces memory overhead
  • Build artifacts are properly excluded from version control

Potential concern:

  • Large test fixtures (600k+ lines in some bundles) will increase repo clone time
  • Consider documenting why these fixtures are necessary vs. generating them dynamically

🧪 Test Coverage Assessment

Strengths:

  • 10 test files covering core functionality
  • Real-world fixtures from actual projects
  • Tests for streaming, VM isolation, license validation, error handling

Gaps:

  • No integration tests showing the package working within the full monorepo
  • No tests for the preinstall script behavior
  • No CI workflow changes visible to run node-renderer tests

Recommendation: Verify that CI runs the node-renderer tests.


📋 Pre-Merge Checklist

Based on CLAUDE.md requirements:

  • Run bundle exec rubocop - ensure ALL violations fixed
  • Run yarn run eslint . --max-warnings 0 - ensure passing
  • Run yarn start format.listDifferent - ensure no formatting issues
  • Test build scripts: yarn run prepack
  • Test yalc publish: yarn run yalc.publish for all packages
  • Verify build artifacts exist
  • Update CHANGELOG: Add entry to /react_on_rails_pro/CHANGELOG.md
  • Verify CI passes: All GitHub Actions workflows green
  • Clean install test: rm -rf node_modules && yarn install

🎯 Recommendations Summary

Must Fix Before Merge:

  1. Test yalc publish for the new package manually
  2. Add CHANGELOG entry to Pro changelog
  3. Verify/remove old /node_package/lib pattern from .gitignore

Should Consider:

  1. Review and potentially simplify the preinstall.js script
  2. Document why ESLint unsafe rules are disabled
  3. Add explicit CI step for node-renderer type-check and tests

Nice to Have:

  1. Document purpose of large test fixtures
  2. Consider if license validation should have a test/dev bypass mode

✨ Conclusion

This is solid infrastructure work that properly integrates the Pro Node Renderer into the monorepo. The code quality is high, test coverage is comprehensive, and the configuration changes are appropriate.

Primary concerns are process-related (testing build scripts, CHANGELOG) rather than code quality issues. Once the pre-merge checklist is completed, this should be safe to merge.

Great work on maintaining clean separation between open-source and Pro packages! 🚀


Review completed by Claude Code following CLAUDE.md guidelines

@claude
Copy link

claude bot commented Nov 22, 2025

Code Review - PR #2094: Add Pro Node Renderer Package to Workspace

Thank you for this well-structured PR! I've reviewed the changes and have several observations and recommendations:


Strengths

1. Excellent PR Organization

  • Clear commit message and description
  • Testing checklist provided
  • Part of a well-planned incremental approach (monorepo-completion)
  • Good use of descriptive comments in configuration changes

2. Proper Build Artifact Management

The .gitignore changes correctly:

  • Exclude packages/*/lib/ (build outputs)
  • Track source code in packages/
  • Exclude test reports (junit.xml)

3. Good ESLint Configuration Strategy

  • Properly documents why rules are disabled (ESM/TypeScript resolution issues)
  • Separate rule sets for node-renderer vs pro package
  • Excludes test config files to avoid ESM/CJS conflicts

4. buildConsoleReplay Parameter Fix

The parameter reordering to comply with default-param-last is correct and follows best practices.


⚠️ Issues & Concerns

1. CRITICAL: Verify Build Script Testing

Per CLAUDE.md section "Testing Build and Package Scripts":

CRITICAL: Build scripts are infrastructure code that MUST be tested manually

Before merging, you MUST test:

# 1. Test the prepack script
yarn run prepack

# 2. Test yalc publish (CRITICAL)
yarn run yalc.publish

# 3. Verify build artifacts exist at expected paths
ls -la lib/ReactOnRails.full.js
ls -la packages/react-on-rails-pro-node-renderer/lib/*.js

# 4. Test clean install
rm -rf node_modules
yarn install

Why this matters: The PR modifies:

  • Root package.json build script: yarn workspace react-on-rails-pro-node-renderer run build
  • Adds new workspace with its own build process
  • Changes could break yalc publish silently (as happened before with 7-week undetected failure)

2. ESLint Config: Too Many Rules Disabled

The ESLint changes disable a LOT of import rules:

// For react-on-rails-pro package (lines 232-241):
'import/no-cycle': 'off',
'import/no-relative-packages': 'off',
'import/no-duplicates': 'off',
'import/extensions': 'off',
'import/order': 'off',
'import/no-self-import': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/export': 'off',

Concerns:

  • import/no-cycle and import/no-self-import catch real bugs
  • Disabling these globally for the package hides potential issues
  • The comment says "TypeScript compiler validates these" but TS doesn't catch circular dependencies

Recommendation:

  • Consider using // eslint-disable-next-line for specific problem lines
  • Or add a TODO comment to re-enable these after fixing underlying issues
  • At minimum, document WHY each specific rule needs to be disabled

3. Global Ignores for Test Files

Lines 54-57 globally ignore test files:

'packages/*/tests/**',
'packages/*/*.test.{js,jsx,ts,tsx}',
'packages/*/babel.config.js',
'packages/*/jest.config.js',

But later (lines 250-264) there's a specific test file configuration. This seems contradictory.

Question: Are test files being linted or not? The global ignore would prevent the test rules from ever applying.

Recommendation: Remove global ignore and rely on the test-specific configuration instead.

4. Package.json Script Changes

Changed from:

"start": "nps",
"lint": "nps eslint",

To:

"start": "yarn run nps",
"lint": "yarn run nps",

Question: Why is this change needed? In a package.json script, nps should already be in PATH from node_modules/.bin.

Concern: This might indicate a PATH issue or environment problem that should be investigated rather than worked around.

5. Missing CHANGELOG Update

Per CLAUDE.md:

Update CHANGELOG.md for user-visible changes only

This is a Pro-only feature, so should this be documented in:

  • /react_on_rails_pro/CHANGELOG.md (Pro changelog)

Or is this infrastructure-only (no changelog needed)?

6. File Path with Space Character

packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/spec-dummy-web-target/9fa89f7 /reduxAppRenderingRequest.js

Note the space before the final /. This will cause issues on many systems.

Action Required: Remove the space from the directory name.

7. Security: License Validation Code

The PR includes licenseValidator.ts with JWT verification. Quick security checks:

✅ Uses jsonwebtoken library (good)
✅ Has public key for verification
To verify: Ensure license validation errors fail gracefully and don't expose sensitive info


🔍 Testing Recommendations

Verify These Scenarios:

  1. Clean workspace install:

    git clean -fdx
    yarn install
    yarn build
  2. Yalc publish workflow:

    yarn run yalc.publish
    # Verify all three packages publish successfully
  3. Linting passes:

    bundle exec rubocop
    yarn run eslint . --max-warnings 0
  4. Type checking:

    yarn run type-check
  5. Test the node-renderer package:

    cd packages/react-on-rails-pro-node-renderer
    yarn test

📋 Before Merging Checklist

  • Fix file path with space character
  • Test all build scripts manually (prepack, yalc.publish)
  • Verify clean install works
  • Decide on test file linting strategy (global ignore vs specific config)
  • Document/justify all disabled ESLint rules or reduce scope
  • Consider re-enabling import/no-cycle and import/no-self-import
  • Explain why yarn run nps is needed vs nps
  • Update appropriate CHANGELOG if user-visible

💡 Minor Suggestions

  1. Consider adding a comment in package.json explaining the build order dependency (react-on-rails before react-on-rails-pro before node-renderer)

  2. The preinstall.js script is well-documented but could benefit from better error messages to help developers debug PATH/yalc issues


Overall, this is a well-organized PR with good documentation. The main concerns are around build script testing (mandatory per CLAUDE.md) and the overly broad ESLint rule disabling. Please address the critical issues before merging.

Let me know if you need clarification on any of these points!

@claude
Copy link

claude bot commented Nov 22, 2025

Code Review: Add Pro Node Renderer Package to Workspace

Thank you for this PR! I've reviewed the changes to add the react-on-rails-pro-node-renderer package to the monorepo. Here's my feedback:


Positive Aspects

  1. Well-structured monorepo integration: The workspace setup in package.json correctly includes the new package alongside the existing ones.

  2. Security-conscious license validation (licenseValidator.ts:117-122):

    • Properly enforces RS256 algorithm only, preventing algorithm confusion attacks
    • Good inline comments explaining the security rationale
    • Appropriate grace period handling for expired licenses in production
  3. Node.js version pinning: Pinning to specific Node versions (22.11.0 and 22.12.x) with clear comments about the V8 bug is excellent practice.

  4. ESLint configuration: The granular ESLint rules for the node-renderer package appropriately disable problematic import resolution rules while maintaining type safety through TypeScript.


⚠️ Issues and Concerns

1. CRITICAL: Inconsistent Test Command in CI Workflow

File: .github/workflows/pro-test-package-and-gem.yml:239

The PR description states the test command was changed to:

- name: Run JS unit tests for Pro package
  run: yarn workspace react-on-rails-pro-node-renderer run ci

However, the current file shows:

- name: Run JS unit tests for Pro package
  run: yarn run nps test.ci

Impact: This could cause CI failures or run the wrong tests.

Resolution needed: Verify which command is correct and ensure the workflow file matches the intended behavior.


2. CRITICAL: Missing Mandatory Testing per CLAUDE.md

Per CLAUDE.md → "Testing Build and Package Scripts":

If you modify package.json, package-scripts.yml, or build configs:

  1. Test the prepack script: yarn run prepack
  2. Test yalc publish (CRITICAL): yarn run yalc.publish

Required actions before merge:

# From repo root
yarn run yalc.publish

# Also test the new package specifically
cd packages/react-on-rails-pro-node-renderer
yarn run yalc:publish

This is especially important given the historical context documented in CLAUDE.md about yalc publish failures going undetected for 7 weeks.


3. Large Binary Test Fixture

File: packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/bionicworkshop/fa6ccf6b/server-bundle.js (3.4MB)

Concern: This single file accounts for most of the 602k line addition. Large binary-like files in git:

  • Bloat repository size permanently (git history stores all versions)
  • Slow down clones and pulls
  • May cause diff/merge conflicts

Recommendations:

  1. Consider generating this fixture dynamically during test setup
  2. Use Git LFS for large test fixtures if they must be versioned
  3. Add to .prettierignore (✅ already done for tests/fixtures/projects)

4. Potential Race Condition in License Validation

File: packages/react-on-rails-pro-node-renderer/src/shared/licenseValidator.ts:24-26

let cachedLicenseData: LicenseData | undefined;
let cachedGraceDaysRemaining: number | undefined;

Concern: Module-level state is not thread-safe in Node.js cluster mode. If multiple workers call getValidatedLicenseData() simultaneously before caching completes, you could have:

  • Race conditions in multi-worker scenarios
  • Multiple file reads/JWT verifications

Impact: Low severity (license validation runs once at startup), but worth noting.

Suggestion: Consider using a promise-based initialization pattern or accepting the current behavior as acceptable for startup-only code.


5. ESLint Configuration Complexity

File: eslint.config.ts:257-274

Disabling 11+ ESLint rules for the node-renderer package suggests potential issues:

'import/named': 'off',
'import/no-unresolved': 'off',
// ... 9 more disabled rules

Questions:

  1. Are these disables truly necessary, or could some be fixed?
  2. Could TypeScript's project references help resolve import issues?
  3. Should unsafe type rules be addressed rather than disabled?

Recommendation: While pragmatic for initial integration, consider filing follow-up issues to incrementally re-enable these rules with proper fixes.


6. Inconsistent Node Version Strategy Across Workflows

Different workflows use different Node versions:

  • lint-js-and-ruby.yml: 22.11.0
  • pro-integration-tests.yml: 22.12.x
  • playwright.yml: Uses setup action default

Concern: Testing against different Node versions in different jobs could mask version-specific issues.

Recommendation: Document the rationale for different versions or standardize to a single version + range.


📋 Minor Issues

  1. Unused exports (licenseValidator.ts:235, 245, 258):

    • isEvaluation(), getGraceDaysRemaining(), reset() have @public TODO: Remove this line when actually used comments
    • Consider removing if truly unused or file issues for future use
  2. Missing error handling (licenseValidator.ts:84):

    • ESLint disable for consistent-return suggests the function doesn't always return
    • handleInvalidLicense() calls process.exit(1), which is correct but could use a type annotation (never return type is used correctly)

🎯 Required Actions Before Merge

  1. Verify and fix the CI test command (issue TODO for first version #1)
  2. Run yarn run yalc.publish and confirm it succeeds (issue Make work with turbolinks and better helper #2)
  3. ⚠️ Consider fixture size strategy (issue Add linting and CI scripts #3) - at minimum, document why it's needed

📖 Documentation Suggestions

  1. Update CLAUDE.md to document the node-renderer package location and its role
  2. Add a comment in eslint.config.ts explaining why so many rules are disabled for node-renderer
  3. Document the Node version pinning strategy across workflows

Overall Assessment

This is a well-structured PR that properly integrates the node-renderer package into the monorepo. The security-conscious license validation and thoughtful ESLint configuration are commendable.

However, please address the CRITICAL items (#1 and #2) before merging to prevent CI failures and maintain the quality standards documented in CLAUDE.md.

The large test fixture (#3) warrants discussion but shouldn't block the PR if it's genuinely needed for integration tests.


Recommendation: Request changes for items #1 and #2, then approve after verification.

Generated with Claude Code

@claude
Copy link

claude bot commented Nov 22, 2025

PR Review: Add Pro Node Renderer Package to Workspace

I've completed a thorough review of this PR. Overall, this is well-structured work that successfully adds the Pro Node Renderer package to the monorepo. The changes are carefully organized and follow the project's conventions. Here's my detailed feedback:


✅ Strengths

1. Excellent PR Organization

  • Clear, well-scoped changes focused on a single objective
  • Comprehensive PR description with testing checklist
  • Part of a larger effort but appropriately broken down for review

2. Proper Monorepo Integration

  • Correctly adds packages/react-on-rails-pro-node-renderer to workspaces in root package.json
  • Proper gitignore/prettierignore updates to handle new package
  • LICENSE.md correctly updated to reflect Pro licensing

3. Bug Fix Included

  • buildConsoleReplay parameter ordering fix (lines 57-60 in buildConsoleReplay.ts) correctly addresses ESLint's default-param-last rule
  • This is a good catch that improves code quality

4. CI/Workflow Updates

  • Node version pinning with clear comments explaining the V8 bug workaround (issue #56010)
  • Appropriate workflow adjustments for the new package structure

⚠️ Issues & Recommendations

1. CRITICAL: Build Script Testing Required

Per CLAUDE.md's "Testing Build and Package Scripts" guidance, you MUST manually test these before merging:

# Test the prepack script
yarn run prepack

# CRITICAL: Test yalc publish (as per CLAUDE.md requirements)
yarn run yalc.publish

# Verify build artifacts exist at expected paths
ls -la packages/react-on-rails-pro-node-renderer/lib/

# Test clean install
rm -rf node_modules
yarn install

Why this is critical: The prepare script in package.json (line 84) runs during installation. If the build path is wrong, users won't be able to install the package. This has bitten the project before (see CLAUDE.md examples).

2. ESLint Configuration Concerns

Location: eslint.config.ts lines 232-253 and 257-273

The ESLint config disables many important rules for the node-renderer package:

// Disabled rules include:
'import/no-cycle': 'off',
'import/no-duplicates': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
// ... and more

Concern: While the comments explain these are needed for ESM/TypeScript conflicts, this is a very broad exemption. Consider:

  1. Are all these exemptions necessary? Some (like import/no-cycle) are important for catching bugs
  2. Can you scope exemptions more narrowly? Perhaps only for specific files with external library usage?
  3. Document technical debt: If these are temporary workarounds, add TODOs

Recommendation:

  • Review each disabled rule and document why it's needed
  • Consider file-specific overrides instead of package-wide exemptions
  • Add comments explaining which external libraries cause the no-unsafe-* issues

3. Security: License Validation

Location: packages/react-on-rails-pro-node-renderer/src/shared/licenseValidator.ts

The license validation looks solid overall, but a few observations:

Good:

  • Grace period handling is sensible
  • Exits process on invalid license (appropriate for Pro package)
  • Supports both env var and file-based licenses

⚠️ Consider:

  • Line 32-36: handleInvalidLicense calls process.exit(1) - ensure this doesn't break graceful shutdown in production
  • Caching mechanism (lines 24-26) is module-level - document that this is intentional for performance
  • Consider rate limiting or alerting on repeated license validation failures in production

4. Dependency Management

Location: packages/react-on-rails-pro-node-renderer/package.json

Good:

  • Peer dependencies properly marked as optional (lines 65-74)
  • Version ranges are reasonable (^4.29.0 || ^5.2.1 for Fastify)

Potential issue:

  • Line 54: "react-on-rails": "*" in devDependencies
  • The * version can lead to unpredictable installs
  • Recommendation: Use workspace:* to explicitly reference the workspace package

5. Test Coverage Question

The PR adds extensive test fixtures (97K+ lines in server bundles). Questions:

  1. Are these fixtures necessary? Can they be generated/minimized?
  2. Performance: Large fixtures slow down git operations
  3. Maintenance: Fixtures can become stale

Consider: Using smaller synthetic fixtures or generating them in CI

6. CI Workflow Path Changes

Location: Multiple workflow files

  • Line changes in .github/workflows/pro-test-package-and-gem.yml (lines 102, 205, 238, 244)
  • Cache paths changed from react_on_rails_pro/**/yarn.lock to **/yarn.lock

Verify:

  • Ensure this doesn't accidentally cache unintended directories
  • Test that cache invalidation works correctly with the new pattern

🔍 Minor Observations

1. Consistency: yarn run prefix

Lines 71-74 in root package.json now use yarn run nps instead of nps. Good for consistency, though verify all scripts work the same way.

2. Prettier Ignore for Fixtures

Line 5 in .prettierignore correctly excludes test fixtures. Good catch to prevent formatting massive fixture files.

3. TypeScript Configuration

The new package has its own tsconfig.json in src/ directory - verify this doesn't conflict with any workspace-level TypeScript config.


📋 Pre-Merge Checklist

Before merging, ensure you've completed:

  • Run yarn run yalc.publish (MANDATORY per CLAUDE.md)
  • Run bundle exec rubocop with zero offenses (MANDATORY)
  • Verify trailing newlines on all modified files
  • Test build: yarn build succeeds
  • Test clean install: rm -rf node_modules && yarn install
  • Verify no hardcoded path issues (grep for old paths)
  • All CI checks passing (currently in progress)
  • Review ESLint exemptions and add TODOs if needed

🎯 Verdict

This is solid work that's nearly ready to merge. The main blocker is ensuring build scripts are tested per CLAUDE.md requirements. The ESLint exemptions warrant a quick review, but they're not blockers if intentional.

Action items before merge:

  1. ✅ Run manual testing checklist above (especially yalc publish)
  2. ⚠️ Review/document ESLint exemptions
  3. ✅ Ensure all CI passes

Great job breaking down the monorepo work into reviewable chunks! 🚀


Review generated with Claude Code

@justin808 justin808 force-pushed the add-pro-node-renderer-package branch from 324185a to 9febddb Compare November 22, 2025 23:05
@claude
Copy link

claude bot commented Nov 22, 2025

PR Review: Add Pro Node Renderer Package to Workspace

This PR successfully integrates the react-on-rails-pro-node-renderer package into the monorepo workspace structure. Overall, the changes are well-structured and follow best practices.

🚨 CRITICAL - MUST DO BEFORE MERGE

1. Test Build Scripts (MANDATORY per CLAUDE.md)

You MUST manually test these commands before merging:

  • yarn run prepack
  • yarn run yalc.publish
  • ls -la packages/react-on-rails-pro-node-renderer/lib/
  • rm -rf node_modules && yarn install

Why: The PR adds a new workspace package with build scripts that run during installation. If these fail, users cannot install the package. See .claude/docs/testing-build-scripts.md for historical context.

2. Verify Path Changes

The PR changes cache-dependency-path from 'react_on_rails_pro//yarn.lock' to '/yarn.lock'. Verify this covers all packages and doesn't break CI caching.

⚠️ HIGH PRIORITY ISSUES

3. ESLint: Too Many Disabled Rules

Lines 257-274 in eslint.config.ts disable nearly ALL import validation rules for node-renderer. This creates a significant blind spot for code quality.

Recommendation: Consider using eslint-import-resolver-typescript. At minimum, keep import/no-cycle enabled - circular dependencies cause real runtime issues.

4. Node Version Inconsistency

  • pro-integration-tests.yml uses '22.12.x'
  • pro-lint.yml uses '22.11.0'

Why the difference? Comments mention issue #56010 - was it fixed in 22.11.0 or 22.12.0? Use consistent pinning across all workflows.

5. Test Fixture Size

The PR adds 500,000+ lines of test fixture JS bundles (200+ MB). This bloats the repo and slows clones. Consider Git LFS or generating fixtures during test setup.

💡 POSITIVE OBSERVATIONS

✅ buildConsoleReplay parameter fix correctly implements default-param-last
✅ Proper package.json structure with exports field
✅ Good .gitignore updates - ignores build artifacts but tracks source
✅ Well-organized test structure
✅ LICENSE.md correctly updated

🔒 SECURITY NOTE

The PR adds jsonwebtoken@^9.0.2 for license validation. Ensure JWT secrets are never committed and license validation has proper error handling.

✅ TESTING CHECKLIST

Before merging:

  • yarn run prepack succeeds
  • yarn run yalc.publish works
  • yarn install works in fresh clone
  • yarn build creates artifacts at expected paths
  • yarn test passes
  • bundle exec rubocop passes with zero offenses
  • CI workflows pass

OVERALL ASSESSMENT

Status: ⚠️ Approve with required testing

This is well-structured PR with good code quality. However, manual testing of build scripts is MANDATORY per project guidelines.

Main concerns:

  1. Too many ESLint rules disabled (code quality risk)
  2. Large test fixtures (repo bloat)
  3. Node version inconsistency

These should be addressed before merge or in immediate follow-up PRs.

Great work on the monorepo restructuring! 🚀


Review by Claude Code following React on Rails contribution guidelines

@justin808 justin808 force-pushed the add-pro-node-renderer-package branch from 9febddb to fc78ad4 Compare November 22, 2025 23:12
@justin808
Copy link
Member Author

Update: This PR has been rebased to depend on #2097 (buildConsoleReplay refactoring). Please merge #2097 first, then this PR will be ready to merge.

@justin808 justin808 force-pushed the add-pro-node-renderer-package branch from fc78ad4 to e28b66b Compare November 23, 2025 00:25
@justin808
Copy link
Member Author

Updated! PR has been rebased directly on master (removing dependency on #2097). The ESLint rule violation in buildConsoleReplay has been suppressed with an eslint-disable comment. Ready to merge! ✅

@justin808
Copy link
Member Author

/run-skipped-ci

@github-actions
Copy link
Contributor

🚀 Full CI Mode Enabled

Triggered all workflows for full CI coverage

Note: Added the full-ci label to this PR. All future commits will run the full CI suite (including minimum dependency tests) until the label is removed.

To disable full CI mode, use the /stop-run-skipped-ci command.

View progress in the Actions tab.

justin808 and others added 2 commits November 22, 2025 15:00
This PR adds the react-on-rails-pro-node-renderer package as a workspace package,
completing the monorepo structure for React on Rails.

**Changes:**
- Create `packages/react-on-rails-pro-node-renderer/` workspace package
- Move node-renderer code from `react_on_rails_pro/packages/node-renderer/` to new location
- Add package.json, babel.config.js, tsconfig.json for the new package
- Update root package.json to include node-renderer in workspaces
- Update ESLint config to handle node-renderer's TypeScript/ESM requirements
- Update .prettierignore to exclude node-renderer test fixtures
- Update .gitignore for node-renderer build artifacts
- Update LICENSE.md to include node-renderer package
- Fix buildConsoleReplay parameter ordering (default-param-last ESLint rule)

**Testing:**
- ✅ Clean install passes: `yarn install`
- ✅ Build passes: `yarn run build`
- ✅ Linting passes: `bundle exec rubocop` and `yarn run eslint`
- ✅ Formatting passes: `yarn start format.listDifferent`

This is part 1 of splitting the monorepo-completion work into reviewable PRs.

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

Co-Authored-By: Claude <noreply@anthropic.com>
…ning

- Pin Node.js to 22.11.0/22.12.x to avoid V8 bug #56010
- Update Pro test workflow to use node-renderer package location
- Update Pro lint workflow to build react-on-rails before linting
- Update Playwright workflow yarn commands
- Fix cache paths for workspace structure
@justin808 justin808 force-pushed the add-pro-node-renderer-package branch from e28b66b to 18f82b6 Compare November 23, 2025 01:01
@justin808
Copy link
Member Author

Rebased on latest master

Resolved merge conflict in buildConsoleReplay.ts (kept master's eslint-disable comment style).

Changes incorporated from master:

Build and all linters pass. Ready to merge!

@claude
Copy link

claude bot commented Nov 23, 2025

PR Review: Add Pro Node Renderer Package to Workspace

I've reviewed this PR that adds the react-on-rails-pro-node-renderer package as a workspace package to the monorepo. Here's my detailed feedback:


✅ Strengths

1. Well-Structured Monorepo Integration

  • Clean workspace setup in root package.json
  • Proper separation of concerns with dedicated package directory
  • Correct LICENSE.md updates to reflect Pro package licensing
  • Good .gitignore patterns for workspace packages

2. Security Best Practices

  • ✅ Authentication handler (authHandler.ts:19-35) uses timingSafeEqual for constant-time password comparison to prevent timing attacks
  • ✅ Proper error handling in auth that doesn't leak information
  • ✅ License validation with graceful degradation and grace periods
  • ✅ JWT-based license verification with proper public key cryptography

3. Configuration & CI Updates

  • Node version pinning with clear rationale (V8 bug #56010)
  • Workspace-aware cache paths (**/yarn.lock instead of just react_on_rails_pro/**/yarn.lock)
  • ESLint config properly handles TypeScript/ESM complexities for node-renderer

4. Test Coverage

  • 10 test files with 683 test cases/describes - excellent coverage
  • Tests cover critical paths: worker, VM, streaming, license validation, Redis client
  • Good use of fixtures for real-world rendering scenarios

⚠️ Issues & Recommendations

1. CRITICAL: Large Binary Test Fixtures (602KB additions!)

The PR adds 97,350+ lines in a single fixture file:

packages/react-on-rails-pro-node-renderer/tests/fixtures/projects/bionicworkshop/fa6ccf6b/server-bundle.js

Problem: These are bundled JavaScript files that bloat the repository.

Recommendations:

  • Use Git LFS for large test fixtures (>100KB)
  • Consider generating these fixtures on-demand during tests instead of committing them
  • Or compress/minify fixtures further if they must be committed
  • Add a comment in .gitattributes for future reference

Example approach:

# Add to .gitattributes
packages/*/tests/fixtures/**/*.js filter=lfs diff=lfs merge=lfs -text

2. Build Script Testing Required (Per CLAUDE.md)

According to .claude/docs/testing-build-scripts.md, you MUST manually test these before merging:

# REQUIRED: Test prepack script
cd packages/react-on-rails-pro-node-renderer
yarn run prepack  # Should succeed

# CRITICAL: Test yalc publish
yarn run yalc:publish  # Should publish successfully

# Verify build artifacts exist
ls -la lib/ReactOnRailsProNodeRenderer.js
ls -la lib/integrations/*.js

Have these been tested? Please confirm in a comment.

3. Path Hardcoding Risk

The workflow changes reference specific paths:

path: packages/react-on-rails-pro-node-renderer/jest

Recommendation: Verify these paths exist after the test runs. Consider using environment variables or wildcards if the path structure might change.

4. ESLint Config Concerns

The new ESLint rules disable many import checks:

'import/no-cycle': 'off',
'import/no-relative-packages': 'off',
'import/no-duplicates': 'off',
// ... and 8 more

Question: Are all these suppressions necessary? Specifically:

  • import/no-cycle - Circular dependencies can cause runtime issues
  • import/no-duplicates - Duplicate imports bloat bundles

Recommendation: Document why each rule is disabled (with code comments) or create targeted suppressions instead of blanket disables.

5. Missing Trailing Newlines Check

Per CLAUDE.md:

ALWAYS ensure files end with a newline character

Action: Run this before committing:

bundle exec rubocop  # Should catch missing newlines in Ruby
yarn start format.listDifferent  # Should catch JS/TS issues

6. Dependency Version Ranges

package.json has wide version ranges:

"fastify": "^4.29.0 || ^5.2.1",
"@fastify/formbody": "^7.4.0 || ^8.0.2"

Recommendation: Ensure CI tests against both minimum and maximum versions to catch breaking changes. Consider tightening ranges after initial release.

7. Redis Dependency Not Listed

Tests reference Redis (tests/redisClient.test.ts) but it's only in devDependencies:

"redis": "^5.0.1"  // in devDependencies

Question: Should this be in peerDependencies or optionalDependencies if the node renderer can use Redis for caching?


🔍 Code Quality Observations

Positive:

  • ✅ TypeScript types are well-defined
  • ✅ Good error handling patterns throughout
  • ✅ Proper use of async/await
  • ✅ License validator has comprehensive error messages
  • ✅ Worker graceful shutdown handling

Minor Issues:

  • Some files have commented-out debug code (worker.ts:37-42) - consider removing before production
  • preinstall.js script could benefit from better error messages for debugging

📋 Pre-Merge Checklist

Based on CLAUDE.md requirements:

  • Run bundle exec rubocop and fix ALL violations
  • Run yarn start format.listDifferent - should show no differences
  • Manually test yarn run prepack
  • Manually test yarn run yalc:publish
  • Verify build artifacts at expected paths
  • Ensure all files end with newlines
  • Consider Git LFS for large fixtures
  • Document ESLint rule suppressions
  • Test with both minimum and maximum dependency versions (if possible)

🎯 Verdict

This PR represents solid engineering work with good security practices and comprehensive test coverage. The main concerns are:

  1. Repository bloat from large test fixtures (urgent)
  2. Build script validation required per project guidelines (urgent)
  3. ESLint suppressions need justification/refinement (important)

Recommendation: Address the critical issues (fixtures and build testing) before merging. The rest can be addressed in follow-up PRs if needed.


Nice work overall! The monorepo structure is coming together well. 🚀

cc: Please confirm build script testing has been completed per CLAUDE.md requirements.

@justin808
Copy link
Member Author

closed in favor of #2069

@justin808 justin808 closed this Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants