You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unify release scripts and add strict version validation (#1881)
Unify release scripts and add strict version validation (#1881)
Why
- Version mismatches between gem and npm packages caused subtle runtime
errors that were difficult to diagnose.
- Separate release scripts for Core and Pro packages created maintenance
overhead and increased risk of version skew.
- Permissive version checking (warnings only) allowed misconfigurations
to reach production.
Summary
This PR consolidates release workflows into a single atomic process with
synchronized versioning across all five packages (react-on-rails gem/npm,
react-on-rails-pro gem/npm, and node-renderer). It replaces soft warnings
with strict fail-fast validation at boot time and request time, enforcing
exact version matching and preventing common misconfigurations.
Key improvements
- Unified release script manages all five packages atomically with single
version number, automatic Ruby version switching, and semver bump support
- Strict boot-time validation fails fast with actionable errors for missing
package.json, conflicting packages, semver wildcards, or version mismatches
- Node renderer validates gem version on every request (strict in dev,
permissive with warnings in prod) with normalization handling Ruby vs NPM
version format differences
- Command injection protection via Shellwords escaping and input validation
for all package manager commands
- Cache size management prevents unbounded memory growth in version comparison
- Improved wildcard and x-range detection in semver validation
- Dynamic package manager detection provides manager-specific install/remove
commands in error messages
Breaking changes
- Applications now fail to boot (instead of logging warnings) when package.json
is misconfigured with wrong versions, missing packages, or semver wildcards.
- Users must use exact versions in package.json (no ^, ~, >, <, * operators).
- Remote node renderer validates gem version at request time; version mismatches
in development now return 412 Precondition Failed (production allows with warning).
Migration: Update package.json to use exact versions matching installed gem.
Security
- Added command injection protection via Shellwords.escape for package names
and versions in all package manager command generation.
- Input validation enforces npm naming standards for package names and safe
semver patterns for versions.
- Defense-in-depth: validation before command generation plus escaping.
Impact
- Existing installs: Boot-time validation will surface any existing
misconfigurations immediately with clear remediation steps. Remote node
renderer users may see 412 errors in development if versions are mismatched.
- New installs: Prevented from launching with incorrect configurations;
error messages guide to correct package.json setup.
Upgrade/rollback notes
Before upgrading: Ensure package.json uses exact versions (e.g., "16.1.1"
not "^16.1.1") matching your installed gem version. For Pro users, ensure
react-on-rails-pro package matches react_on_rails_pro gem version.
To rollback after upgrade: If validation errors block your application,
either fix package.json per error message or temporarily rollback gem version
until package.json can be corrected.
References
- PR #1881
- Issue #1876
Copy file name to clipboardExpand all lines: CHANGELOG.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,8 @@ Changes since the last non-beta release.
27
27
28
28
-**Attribution Comment**: Added HTML comment attribution to Rails views containing React on Rails functionality. The comment automatically displays which version is in use (open source React on Rails or React on Rails Pro) and, for Pro users, shows the license status. This helps identify React on Rails usage across your application. [PR #1857](https://github.com/shakacode/react_on_rails/pull/1857) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
29
29
30
+
-**Improved Error Messages**: Error messages for version mismatches and package configuration issues now include package-manager-specific installation commands (npm, yarn, pnpm, bun). [PR #1881](https://github.com/shakacode/react_on_rails/pull/1881) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
31
+
30
32
#### Breaking Changes
31
33
32
34
-**React on Rails Core Package**: Several Pro-only methods have been removed from the core package and are now exclusively available in the `react-on-rails-pro` package. If you're using any of the following methods, you'll need to migrate to React on Rails Pro:
@@ -106,6 +108,14 @@ To migrate to React on Rails Pro:
106
108
107
109
These helpers are now defined exclusively in the `react-on-rails-pro` gem.
108
110
111
+
-**Strict Version Validation at Boot Time**: Applications now fail to boot (instead of logging warnings) when package.json is misconfigured with wrong versions, missing packages, or semver wildcards. Users must use exact versions in package.json (no ^, ~, >, <, \* operators). **Migration**: Update package.json to use exact versions matching installed gem (e.g., `"16.1.1"` not `"^16.1.1"`). [PR #1881](https://github.com/shakacode/react_on_rails/pull/1881) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
112
+
113
+
-**Node Renderer Version Validation** (Pro users only): Remote node renderer now validates gem version at request time. Version mismatches in development return 412 Precondition Failed (production allows with warning). **Migration**: Ensure react_on_rails_pro gem and @shakacode-tools/react-on-rails-pro-node-renderer package versions match. [PR #1881](https://github.com/shakacode/react_on_rails/pull/1881) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
114
+
115
+
#### Security
116
+
117
+
-**Command Injection Protection**: Added security hardening to prevent potential command injection in package manager commands. [PR #1881](https://github.com/shakacode/react_on_rails/pull/1881) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
The task updates versions in all the following files:
43
68
44
-
-`lib/react_on_rails/version.rb` (source of truth)
69
+
**Core package:**
70
+
71
+
-`lib/react_on_rails/version.rb` (source of truth for all packages)
45
72
-`package.json` (root workspace)
46
73
-`packages/react-on-rails/package.json`
47
-
-`packages/react-on-rails-pro/package.json` (both version field and react-on-rails dependency)
74
+
-`Gemfile.lock` (root)
48
75
-`spec/dummy/Gemfile.lock`
49
76
50
-
**Note:** The `react-on-rails-pro` package declares an exact version dependency on `react-on-rails` (e.g., `"react-on-rails": "16.2.0"`). This ensures users install compatible versions of both packages.
77
+
**Pro package:**
78
+
79
+
-`react_on_rails_pro/lib/react_on_rails_pro/version.rb` (VERSION only, not PROTOCOL_VERSION)
0 commit comments