Commit 0d87ea7
authored
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 #18761 parent d527ddf commit 0d87ea7
File tree
26 files changed
+1664
-1483
lines changed- docs/contributor-info
- lib/react_on_rails
- rakelib
- react_on_rails_pro
- docs/contributors-info
- lib/react_on_rails_pro
- packages/node-renderer
- src/worker
- tests
- rakelib
- script
- spec/dummy
- spec/react_on_rails
- fixtures
26 files changed
+1664
-1483
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
109 | 119 | | |
110 | 120 | | |
111 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
23 | 22 | | |
24 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
25 | 41 | | |
26 | 42 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
33 | 54 | | |
34 | | - | |
| 55 | + | |
35 | 56 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
39 | 64 | | |
40 | 65 | | |
41 | 66 | | |
42 | 67 | | |
43 | 68 | | |
44 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
45 | 72 | | |
46 | 73 | | |
47 | | - | |
| 74 | + | |
48 | 75 | | |
49 | 76 | | |
50 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
51 | 89 | | |
52 | 90 | | |
53 | 91 | | |
| |||
107 | 145 | | |
108 | 146 | | |
109 | 147 | | |
110 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
111 | 151 | | |
112 | | - | |
| 152 | + | |
113 | 153 | | |
114 | 154 | | |
115 | 155 | | |
116 | 156 | | |
117 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
118 | 227 | | |
119 | 228 | | |
120 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
7 | 17 | | |
8 | | - | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
286 | 406 | | |
287 | 407 | | |
288 | 408 | | |
| |||
0 commit comments