|
| 1 | +# Validating Node Renderer Changes |
| 2 | + |
| 3 | +Manual validation checklist for changes under `packages/react-on-rails-pro-node-renderer/src/**`. |
| 4 | + |
| 5 | +**Why this exists:** the Pro dummy app consumes the _built_ renderer at |
| 6 | +`packages/react-on-rails-pro-node-renderer/lib/**`. Editing TypeScript under `src/` does |
| 7 | +nothing until that lib output is regenerated, so a correct fix can look broken (or worse, |
| 8 | +a regression can look fine because the dummy is still running stale lib output). |
| 9 | + |
| 10 | +**Related:** [Manual Dev Environment Testing](manual-dev-environment-testing.md) |
| 11 | + |
| 12 | +## When This Applies |
| 13 | + |
| 14 | +If your PR touches **any** of these, run through the checklist below: |
| 15 | + |
| 16 | +- `packages/react-on-rails-pro-node-renderer/src/**` |
| 17 | +- `packages/react-on-rails-pro-node-renderer/package.json` (especially `protocolVersion`, |
| 18 | + `exports`, or runtime dependencies) |
| 19 | +- Any worker pool, JWT auth, integrations (Sentry/Honeybadger), or VM-context code in the |
| 20 | + renderer |
| 21 | + |
| 22 | +## Pre-flight: Toolchain |
| 23 | + |
| 24 | +The Pro dummy app requires Ruby 3.3.x. If you are on a newer Ruby (3.5+), the dummy's |
| 25 | +Gemfile already pulls in `ostruct`, `logger`, and `benchmark` as explicit gems to silence |
| 26 | +warnings, but you may still hit unrelated incompatibilities. When in doubt, switch to the |
| 27 | +documented Ruby version: |
| 28 | + |
| 29 | +```bash |
| 30 | +mise use ruby@3.3.7 # or rbenv/asdf equivalent |
| 31 | +cd react_on_rails_pro/spec/dummy |
| 32 | +bundle install |
| 33 | +``` |
| 34 | + |
| 35 | +## Step 1: Rebuild the Renderer Package |
| 36 | + |
| 37 | +Pick **one** of these depending on how you plan to iterate: |
| 38 | + |
| 39 | +**One-shot rebuild (recommended for a single validation pass):** |
| 40 | + |
| 41 | +```bash |
| 42 | +pnpm --filter react-on-rails-pro-node-renderer run build |
| 43 | +``` |
| 44 | + |
| 45 | +**Or use the dummy's convenience script:** |
| 46 | + |
| 47 | +```bash |
| 48 | +cd react_on_rails_pro/spec/dummy |
| 49 | +pnpm run node-renderer:fresh # builds the package, then starts the renderer |
| 50 | +``` |
| 51 | + |
| 52 | +**Watch mode (recommended when iterating on the renderer source):** |
| 53 | + |
| 54 | +Either uncomment the `node-renderer-build` line in `react_on_rails_pro/spec/dummy/Procfile.dev`, |
| 55 | +or in a separate terminal run: |
| 56 | + |
| 57 | +```bash |
| 58 | +pnpm --filter react-on-rails-pro-node-renderer run build-watch |
| 59 | +``` |
| 60 | + |
| 61 | +> If you skip this step, the dummy app will silently keep using the previous lib build. |
| 62 | +> Symptoms: a fix you just applied does not change behavior, or a regression you expected |
| 63 | +> to see does not appear. |
| 64 | +
|
| 65 | +## Step 2: Start the Dummy App |
| 66 | + |
| 67 | +```bash |
| 68 | +cd react_on_rails_pro/spec/dummy |
| 69 | +bin/dev |
| 70 | +``` |
| 71 | + |
| 72 | +Verify: |
| 73 | + |
| 74 | +- [ ] `bin/dev` starts without `overlay.sockPort should be a number` (webpack-dev-server) |
| 75 | +- [ ] `bin/dev` starts without `cannot load such file -- ostruct` (Rails precompile) |
| 76 | +- [ ] All Procfile.dev processes are healthy after 30 seconds |
| 77 | +- [ ] The `node-renderer` process logs that it bound to port 3800 |
| 78 | + |
| 79 | +## Step 3: Exercise the SSR Endpoints |
| 80 | + |
| 81 | +For PRs touching streaming, hydration, RSC, or VM-context code, hit the routes that |
| 82 | +actually exercise the renderer (not just static pages): |
| 83 | + |
| 84 | +- [ ] `http://localhost:3000/stream_native_metadata` — renders without `ReferenceError` |
| 85 | + (e.g. `performance is not defined`) in the renderer logs |
| 86 | +- [ ] `http://localhost:3000/hybrid_metadata_streaming` — same |
| 87 | +- [ ] Any route specifically related to your change |
| 88 | + |
| 89 | +For each route: |
| 90 | + |
| 91 | +- [ ] Page returns 200 and renders SSR content (view-source shows component markup) |
| 92 | +- [ ] No errors in the `node-renderer` Procfile pane |
| 93 | +- [ ] No errors in the Rails server log |
| 94 | +- [ ] No errors in the browser console |
| 95 | + |
| 96 | +## Step 4: Confirm You Tested the New Code |
| 97 | + |
| 98 | +It is easy to validate stale lib output without realizing it. Confirm: |
| 99 | + |
| 100 | +- [ ] `lib/` mtime is newer than the `src/` file you changed (compare |
| 101 | + `ls -la packages/react-on-rails-pro-node-renderer/lib/` against |
| 102 | + `ls -la packages/react-on-rails-pro-node-renderer/src/`) |
| 103 | +- [ ] If you used watch mode, you saw a rebuild line in the watcher output after your |
| 104 | + most recent edit |
| 105 | +- [ ] Restart the `node-renderer` Procfile process after the rebuild — `node` does not |
| 106 | + hot-reload required modules |
| 107 | + |
| 108 | +## Reporting Results in the PR |
| 109 | + |
| 110 | +```markdown |
| 111 | +## Node Renderer Validation |
| 112 | + |
| 113 | +- [x] Rebuilt `react-on-rails-pro-node-renderer` package |
| 114 | +- [x] Verified `lib/` mtime newer than `src/` after edit |
| 115 | +- [x] `bin/dev` starts cleanly |
| 116 | +- [x] `/stream_native_metadata` renders without errors |
| 117 | +- [x] `/hybrid_metadata_streaming` renders without errors |
| 118 | +- [x] No errors in node-renderer logs |
| 119 | +``` |
| 120 | + |
| 121 | +If you cannot validate manually (e.g. no local Ruby toolchain), say so explicitly and |
| 122 | +note that the change is type-checked / unit-tested only. |
0 commit comments