Docs(generator): note Pro production devtool for source-mapped SSR stacks (#3893)#4113
Conversation
…acks (#3893) The generated serverWebpackConfig disables source maps in production (`devtool: false`). That silently defeats the Pro Node renderer's source-mapped SSR stack traces (shipped in #3940) in production, since there is no production server-bundle map to remap frames against. Add a comment in the Pro branch of the template documenting how to opt in (`devtool: 'source-map'` external, or `'inline-source-map'`), mirroring docs/oss/building-features/node-renderer/debugging.md, with the never-serve-publicly caveat. Comment-only; the default is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
+ci-run-hosted |
Hosted CI RequestedTriggered 9 workflow(s) for View progress in the Actions tab. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
react_on_rails/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt (1)
230-231: 💤 Low valueMinor: Clarify the phrasing on lines 230–231.
The sentence "The server bundle is never served to browsers, but never serve server-bundle source maps publicly" uses "but" in a way that could be slightly confusing—it reads as a contrast when the intent is to reinforce a security best practice. Consider rephrasing for clarity:
// The server bundle is never served to browsers. As a security best practice, // never serve server-bundle source maps publicly.This is a minor suggestion and does not block the PR.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@react_on_rails/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt` around lines 230 - 231, The comment on lines 230-231 in the serverWebpackConfig file uses confusing phrasing with "but never serve" that makes the intent unclear. Revise the comment to separate the two related ideas into distinct statements: first clarify that the server bundle is not served to browsers, then add a separate statement emphasizing the security best practice of never serving server-bundle source maps publicly. Use a period or new comment line to create this logical separation rather than using "but" as a connector.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@react_on_rails/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt`:
- Around line 230-231: The comment on lines 230-231 in the serverWebpackConfig
file uses confusing phrasing with "but never serve" that makes the intent
unclear. Revise the comment to separate the two related ideas into distinct
statements: first clarify that the server bundle is not served to browsers, then
add a separate statement emphasizing the security best practice of never serving
server-bundle source maps publicly. Use a period or new comment line to create
this logical separation rather than using "but" as a connector.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b5ad0004-7389-44ba-9e0e-b90517914678
📒 Files selected for processing (1)
react_on_rails/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt
Code ReviewSummary: Comment-only addition to the What the PR does well
Minor wording issueThe last two lines read: // The server bundle is never served to browsers, but never serve server-bundle
// source maps publicly.The conjunction "but" implies a contrast that isn't there — both halves express things that shouldn't be served. Suggested fix: // Server bundles never reach browsers, but keep any .map files off your
// public CDN / asset host.Optional: surface the bundle-size trade-off for inline-source-mapThe current comment says "simplest; map travels inside the bundle" but omits the size cost. A brief parenthetical would make the trade-off self-contained without requiring the doc link: // serverWebpackConfig.devtool = 'inline-source-map'; // simplest; map inside the bundle (larger file)VerdictApprove with optional nits. The guidance is accurate, correctly scoped to the Pro branch, and consistent with the referenced docs. Ready to merge once CI is green. |
… + wording Greptile (P2): bare devtool examples would override the dev setting for all environments; show production-aware ternary form so the 'production' intent is encoded. claude nits: fix false 'but' contrast; note inline-source-map file-size cost inline. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Review: Comment-only template addition for Pro production devtool. This PR adds documentation comments to the generated serverWebpackConfig.js template (Pro path only) explaining how to opt in to production source maps for source-mapped SSR stack traces. Comment-only, well-scoped, low-risk. Full review posted as inline comments. |
…k line before else claude review: clarify that only the devtool assignment is replaced (keep the webpack 5.106+ eval note) and that the examples use non-eval devtools; add the missing blank line before the <% else -%> tag for consistency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Code Review - PR 4113 | Verdict: Approve with minor observations The change is technically accurate, well-scoped, and fills a real documentation gap for Pro users. Low risk. What is good:
Minor observations (non-blocking) - see inline comments for details. |
* origin/main: (40 commits) feat(pro): use built-in Rails i18n compiler for React Intl demo (#4128) Fix pr-merge-ledger UTF-8 crash under non-UTF-8 locale (#4123) Add canonical AI-agent prompts source (prompts.yml) (#4124) Local benchmark runner: raise server-boot timeout for slower machines (#4073) (#4125) Docs(generator): note Pro production devtool for source-mapped SSR stacks (#3893) (#4113) docs: add "Consuming an Unreleased Build" guide and fix pnpm git-subdir syntax (#4117) Address deferred AI-review feedback on PR-helper scripts (#4069) (#4105) Wrap generated demo file paths in onboarding page (Part 1 of #4062) (#4107) fix(ci): build bundle-size base from PR merge commit's first parent (#4110) Add internal RSC architecture deep-dive docs (RoR Pro vs Next.js) (#4006) Disable noisy automatic benchmark regression issue filing (#4071) (#4116) Release-train branching + phase-tiered merge gating (beta/RC/final) (#4018) Fix Webpack dependency selection in install generator (#4109) Document health-probe status-code contract and Control Plane probes (#4053) (#4063) Local dedicated-hardware benchmark runner (#4073) (#4088) docs(tooling): surface SVG diagram alt text in generated llms-full files (#4087) docs(agents): codify review-loop convergence + local/CI parity in PR-batch workflow (#4101) Split RenderFunction: drop the legacy renderer arm (#4096) Add OSS hydrate_on scheduling (#4037) Docs: fix stale evaluate-issue gate cross-reference (#3910) (#4104) ...
Why
Part of the closeout of #3893 (SSR debugging & profiling). The core feature — source-mapped Node-renderer stack traces — shipped in #3940, and the profiling/
--inspectdocs in #3961. This PR closes one small residual: the generatedserverWebpackConfig.jstemplate gave no guidance on thedevtoolsetting needed to actually get those source-mapped stack traces in production.The template default is:
i.e. source maps are disabled in production. That's a reasonable default (no
.mapfiles generated/uploaded), but it silently defeats the #3940 feature for Pro users in production: without a production server-bundle source map, the Node renderer has nothing to remap frames against, so production SSR error stacks stay anonymous/minified. Nothing in the generated config tells a Pro user how to opt in.What
Adds a comment (Pro branch of the template only) documenting how to enable production source maps for source-mapped SSR stack traces, mirroring the existing prose guidance in
docs/oss/building-features/node-renderer/debugging.md:devtool: 'source-map'— external.map(smaller bundle; stage the.mapnext to the uploaded bundle), ordevtool: 'inline-source-map'— simplest; map travels inside the bundle.Comment-only. No behavior change — the default stays
falsein production; this just documents the opt-in. Scoped to theuse_pro?branch because the remapping is a Pro Node-renderer capability.Scope / what's intentionally NOT here
--inspectworkflow, Performance Tracks guide #3893 residual — a Rails-side RSpec asserting mapped.tsxframes inPrerenderError— is environment-heavy (needs the test SSR bundle built+staged with source maps, currently UNKNOWN) and is tracked as a separate P3 follow-up: Residual #3893: Rails RSpec asserting source-mapped .tsx frames in PrerenderError #4112 (not forced into this PR).devtooldefault. Flipping it to emit maps for all Pro users would add.mapgeneration/upload and privacy considerations; an opt-in comment is the correct, behavior-preserving scope.Validation
<% if use_pro? -%>block; no ERB interpolation introduced (theinstall_generator_spec.rb.tt-interpolation regression remains satisfied).serverWebpackConfig.jscontent viainclude(...)substring checks (pro_generator_spec.rb,rsc_generator_spec.rb), andpro_server_webpack_contentingenerator_spec_helper.rbis a hand-written input fixture independent of this template — so added comments don't affect them.Merge confidence
Note
Low Risk
Comment-only template change with no runtime or generated-config behavior change.
Overview
Adds comment-only guidance in the Pro
serverWebpackConfig.jsgenerator template so users know production SSR stack remapping needs non-defaultdevtoolsettings.The new block sits after the existing
target: 'node'/node: falselines and explains that the defaultdevtool: falsein production blocks source-mapped frames, points todebugging.md, and shows opt-in examples (source-mapvsinline-source-map) plus a warning not to expose server-bundle maps publicly. No generated webpack behavior changes — production still disables source maps by default.Reviewed by Cursor Bugbot for commit cd2fe40. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit