Skip to content

Commit 4c4ee87

Browse files
committed
Merge remote-tracking branch 'origin/main' into codex/pr-3231-reviews
* origin/main: fix(pro-dummy): make manual node-renderer validation reliable (#3200) [codex] Add Markdown Prettier CI check (#3242) Add /stress-test Claude Code command for adversarial QA (#3207)
2 parents 64aa542 + 61a98b7 commit 4c4ee87

16 files changed

Lines changed: 858 additions & 8 deletions

File tree

.claude/commands/stress-test.md

Lines changed: 617 additions & 0 deletions
Large diffs are not rendered by default.

.claude/docs/manual-dev-environment-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Automated tests can pass while the development environment is completely broken. CI starts services explicitly and runs in a controlled environment — it does not exercise `bin/dev`, Procfile orchestration, or the actual browser experience. This guide ensures agents verify the dev environment works end-to-end before submitting a PR.
44

5-
**Related:** [PR Testing Guide](pr-testing-guide.md), [Testing Build Scripts](testing-build-scripts.md)
5+
**Related:** [PR Testing Guide](pr-testing-guide.md), [Testing Build Scripts](testing-build-scripts.md), [Validating Node Renderer Changes](validating-node-renderer-changes.md)
66

77
## The Rule
88

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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+
Ruby 3.3.x is the documented baseline for the Pro dummy app, and this workflow
25+
has also been verified on Ruby 3.4.8. On Ruby 3.5+, the dummy's Gemfile pulls in
26+
`ostruct`, `logger`, and `benchmark` as explicit gems for stdlib compatibility.
27+
If a newer Ruby hits unrelated incompatibilities, fall back to the documented
28+
Ruby version.
29+
30+
```bash
31+
cd react_on_rails_pro/spec/dummy
32+
bundle install
33+
34+
# Optional fallback if your local Ruby fails:
35+
mise shell ruby@3.3.7 # or rbenv/asdf equivalent
36+
bundle install
37+
```
38+
39+
## Step 1: Rebuild the Renderer Package
40+
41+
Pick **one** of these depending on how you plan to iterate:
42+
43+
**One-shot rebuild (recommended for a single validation pass):**
44+
45+
```bash
46+
pnpm --filter react-on-rails-pro-node-renderer run build
47+
```
48+
49+
**Or use the dummy's convenience script:**
50+
51+
```bash
52+
cd react_on_rails_pro/spec/dummy
53+
pnpm run node-renderer:fresh # builds, then starts the renderer standalone
54+
```
55+
56+
This starts the renderer in the foreground on port 3800. For a full-stack dummy
57+
run, either stop it before Step 2 and let `bin/dev` start the renderer, or leave
58+
it running and comment out the `node-renderer:` line in `Procfile.dev` before
59+
running `bin/dev`.
60+
61+
**Watch mode (recommended when iterating on the renderer source):**
62+
63+
Either uncomment the `node-renderer-build` line in `react_on_rails_pro/spec/dummy/Procfile.dev`,
64+
or in a separate terminal run:
65+
66+
```bash
67+
pnpm --filter react-on-rails-pro-node-renderer run build-watch
68+
```
69+
70+
> If you skip this step, the dummy app will silently keep using the previous lib build.
71+
> Symptoms: a fix you just applied does not change behavior, or a regression you expected
72+
> to see does not appear.
73+
74+
## Step 2: Start the Dummy App
75+
76+
```bash
77+
cd react_on_rails_pro/spec/dummy
78+
bin/dev
79+
```
80+
81+
Verify:
82+
83+
- [ ] `bin/dev` starts without `overlay.sockPort should be a number` (webpack-dev-server)
84+
- [ ] `bin/dev` starts without `cannot load such file -- ostruct` (Rails precompile)
85+
- [ ] All Procfile.dev processes are healthy after 30 seconds
86+
- [ ] The `node-renderer` process logs that it bound to port 3800
87+
88+
## Step 3: Exercise the SSR Endpoints
89+
90+
For PRs touching streaming, hydration, RSC, or VM-context code, hit the routes that
91+
actually exercise the renderer (not just static pages):
92+
93+
- [ ] `http://localhost:3000/stream_native_metadata` — renders without `ReferenceError`
94+
(e.g. `performance is not defined`) in the renderer logs
95+
- [ ] `http://localhost:3000/hybrid_metadata_streaming` — same
96+
- [ ] Any route specifically related to your change
97+
98+
For each route:
99+
100+
- [ ] Page returns 200 and renders SSR content (view-source shows component markup)
101+
- [ ] No errors in the `node-renderer` Procfile pane
102+
- [ ] No errors in the Rails server log
103+
- [ ] No errors in the browser console
104+
105+
## Step 4: Confirm You Tested the New Code
106+
107+
It is easy to validate stale lib output without realizing it. Confirm:
108+
109+
- [ ] The built `lib/` file corresponding to your edit is newer than the `src/`
110+
file you changed. Compare the specific files with `stat` or use a
111+
per-file freshness check, for example:
112+
`find packages/react-on-rails-pro-node-renderer/lib -newer packages/react-on-rails-pro-node-renderer/src/<changed-file>.ts | head`
113+
- [ ] If you used watch mode, you saw a rebuild line in the watcher output after your
114+
most recent edit
115+
- [ ] Restart the `node-renderer` Procfile process after the rebuild — `node` does not
116+
hot-reload required modules
117+
118+
## Reporting Results in the PR
119+
120+
```markdown
121+
## Node Renderer Validation
122+
123+
- [x] Rebuilt `react-on-rails-pro-node-renderer` package
124+
- [x] Verified the rebuilt `lib/` file is newer than the changed `src/` file
125+
- [x] `bin/dev` starts cleanly
126+
- [x] `/stream_native_metadata` renders without errors
127+
- [x] `/hybrid_metadata_streaming` renders without errors
128+
- [x] No errors in node-renderer logs
129+
```
130+
131+
If you cannot validate manually (e.g. no local Ruby toolchain), say so explicitly and
132+
note that the change is type-checked / unit-tested only.

.github/workflows/check-markdown-links.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,60 @@ on:
1010
- '**.md'
1111
- '.github/workflows/check-markdown-links.yml'
1212
- '.lychee.toml'
13+
- '.prettierignore'
14+
- '.prettierrc'
15+
- 'pnpm-lock.yaml'
1316
pull_request:
1417
paths:
1518
- '**.md'
1619
- '.github/workflows/check-markdown-links.yml'
1720
- '.lychee.toml'
21+
- '.prettierignore'
22+
- '.prettierrc'
23+
- 'pnpm-lock.yaml'
1824
schedule:
1925
# Run daily at 3am UTC to catch stale cached links
2026
# See: https://lychee.cli.rs/github_action_recipes/caching/
2127
- cron: '0 3 * * *'
2228
workflow_dispatch:
2329

2430
jobs:
31+
markdown-format-check:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Setup pnpm
37+
uses: pnpm/action-setup@v4
38+
39+
- name: Setup Node
40+
uses: ./.github/actions/setup-node-with-retry
41+
with:
42+
# Pin to 22.11.0 (LTS) to avoid V8 bug in 22.21.0
43+
node-version: '22.11.0'
44+
cache: pnpm
45+
cache-dependency-path: pnpm-lock.yaml
46+
47+
- name: Install dependencies
48+
run: pnpm install --frozen-lockfile --ignore-scripts --filter='{.}'
49+
50+
- name: Check markdown formatting
51+
shell: bash
52+
run: |
53+
markdown_files=()
54+
while IFS= read -r -d '' file; do
55+
if [ -f "$file" ] && [ ! -L "$file" ]; then
56+
markdown_files+=("$file")
57+
fi
58+
done < <(git ls-files -z -- '*.md' '*.mdx' '*.markdown')
59+
60+
if [ "${#markdown_files[@]}" -eq 0 ]; then
61+
echo "No markdown files to check."
62+
exit 0
63+
fi
64+
65+
pnpm exec prettier --check -- "${markdown_files[@]}"
66+
2567
markdown-link-check:
2668
runs-on: ubuntu-latest
2769
steps:

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ Use these docs for Claude-oriented operational guidance:
4545
- `.claude/docs/docs-competitive-landscape.md`
4646
- `.claude/docs/docs-templates.md`
4747
- `.claude/docs/manual-dev-environment-testing.md`
48+
- `.claude/docs/validating-node-renderer-changes.md`
4849

4950
For Pro-package specifics, also read `react_on_rails_pro/CLAUDE.md`.

docs/oss/building-features/node-renderer/debugging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ It is a `pnpm` workspace app and already points at the local packages in this mo
1414

1515
### Quick start: debugging with the full stack running
1616

17-
If you already have the dummy app running via `bin/dev` (which uses `Procfile.dev`), the node renderer is already listening on port 3800 with `--inspect` enabled. To debug:
17+
If you already have the dummy app running via `bin/dev` (which uses `Procfile.dev`), the node renderer is listening on port 3800 but without `--inspect`. To attach a debugger you first need to restart it with `--inspect` — either stop the renderer process and run `pnpm run node-renderer:debug`, or temporarily add `--inspect` to the `node-renderer:` entry in `Procfile.dev` and `overmind restart node-renderer`. Then:
1818

1919
1. Open `chrome://inspect` in Chrome and connect to the renderer process.
2020
2. Use overmind to isolate renderer logs: `overmind connect node-renderer` (Ctrl-B to detach).
@@ -42,7 +42,7 @@ Use this when you need full control over the renderer process — different flag
4242
1. If you want to attach a debugger instead, run:
4343
```bash
4444
cd react_on_rails_pro/spec/dummy
45-
pnpm run node-renderer-debug
45+
pnpm run node-renderer:debug
4646
```
4747
1. Reload the page that triggers the SSR issue and reproduce the problem.
4848
1. If you change Ruby code in loaded gems, restart the Rails server.

react_on_rails_pro/CLAUDE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ The node renderer is a standalone Fastify HTTP server (separate Node.js process)
5858
- Integrations: Sentry, Honeybadger (optional peer deps)
5959
- Protocol versioning: `protocolVersion` in package.json must match gem expectations
6060

61+
**Validating source changes against the dummy app:** the dummy consumes the _built_
62+
`packages/react-on-rails-pro-node-renderer/lib/**`, so edits under `src/**` are not
63+
picked up until the package is rebuilt. Use one of:
64+
65+
- `pnpm --filter react-on-rails-pro-node-renderer run build` (one-shot)
66+
- `cd react_on_rails_pro/spec/dummy && pnpm run node-renderer:fresh` (rebuild + start)
67+
- `pnpm --filter react-on-rails-pro-node-renderer run build-watch` (watch in another shell)
68+
69+
See `.claude/docs/validating-node-renderer-changes.md` for the full checklist.
70+
6171
### Yalc Dependency Chain
6272

6373
Pro dummy's preinstall builds and links packages in this order:

react_on_rails_pro/Gemfile.development_dependencies

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ group :development, :test do
5454
gem "rbs", require: false
5555
gem "scss_lint", require: false
5656
gem "fakefs", require: "fakefs/safe"
57+
58+
# Ruby 3.5+ removed these from the default gem set; they must now be declared explicitly
59+
# to avoid `cannot load such file` errors from gems that lazy-require them (e.g. jbuilder).
60+
gem "benchmark", require: false
61+
gem "logger", require: false
62+
gem "ostruct", require: false
5763
end
5864

5965
group :test do

react_on_rails_pro/Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ GEM
247247
racc (~> 1.4)
248248
nokogiri (1.19.2-x86_64-linux-gnu)
249249
racc (~> 1.4)
250+
ostruct (0.6.3)
250251
package_json (0.2.0)
251252
parallel (1.27.0)
252253
parser (3.3.10.0)
@@ -475,6 +476,7 @@ PLATFORMS
475476

476477
DEPENDENCIES
477478
amazing_print
479+
benchmark
478480
bootsnap
479481
bundler
480482
capybara (>= 3.38.0)
@@ -490,9 +492,11 @@ DEPENDENCIES
490492
jquery-rails
491493
launchy
492494
listen
495+
logger
493496
net-http
494497
net-imap
495498
net-smtp
499+
ostruct
496500
pg
497501
pry (>= 0.14.1)
498502
pry-byebug!

react_on_rails_pro/spec/dummy/Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ GEM
271271
racc (~> 1.4)
272272
nokogiri (1.19.2-x86_64-linux-musl)
273273
racc (~> 1.4)
274+
ostruct (0.6.3)
274275
package_json (0.2.0)
275276
parallel (1.27.0)
276277
parser (3.3.10.0)
@@ -524,6 +525,7 @@ PLATFORMS
524525

525526
DEPENDENCIES
526527
amazing_print
528+
benchmark
527529
bootsnap
528530
capybara (>= 3.38.0)
529531
capybara-screenshot
@@ -538,9 +540,11 @@ DEPENDENCIES
538540
jquery-rails
539541
launchy
540542
listen
543+
logger
541544
net-http
542545
net-imap
543546
net-smtp
547+
ostruct
544548
pg
545549
prism-rails
546550
pry (>= 0.14.1)

0 commit comments

Comments
 (0)