[Pro] Add buffered RSC rendering helpers for static pages - #4268
Conversation
WalkthroughAdds RSC-aware cache key composition, a buffered streaming helper that returns complete HTML, a cached buffered variant, matching specs, and documentation updates describing the new behavior and related cache caveats. ChangesBuffered RSC Rendering
Estimated code review effort: 3 (Moderate) | ~30 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
df2363c to
6faadf1
Compare
Code ReviewThis PR adds Two correctness bugs found, both in Bug 1 — Cache hits serve double-escaped HTML (high severity)
First request (cache miss) renders correctly; every subsequent request (cache hit) shows escaped HTML source code. Fix: fetch_react_component(component_name, cache_options) do
...
buffered_stream_react_component(component_name, options)
end.html_safeSee inline comment for the exact line. Bug 2 —
|
Code ReviewThis PR adds Verified correct:
One cleanup finding (inline): |
Address-review summaryScan scope: full current unresolved review threads after the first review round. Mattered
Skipped
Next default scan starts after this comment. Say |
Review: [Pro] Add buffered RSC rendering helpers for static pagesThis PR adds Three issues found, ranked by severity: 1. Test at line 1100 makes the cache-population assertion a tautology (test quality)The manual The second test (lines 1114–1149) already covers auto-caching correctly (no manual write, direct read assertion). The fix for the first test is to move the 2.
|
Address-review summaryScan scope: review feedback after the previous summary on the current #4268 head. Mattered
Skipped
Deferred-work tracking: PR summary comment only for the pre-existing cached_stream_react_component cache-key asymmetry; no new issue created. Next default scan starts after this comment. Say |
…ered-rsc-rendering * origin/main: Docs: record RSC Rspack client refs investigation (#4269)
Review: [Pro] Add buffered RSC rendering helpers for static pagesThis PR adds two well-motivated helpers — 1. Cache key collision when RSC is disabled (bug — can cause
|
Review: [Pro] Add buffered RSC rendering helpers for static pagesThis PR introduces Finding 1 — Cache type collision:
|
|
Address-review follow-up for the 2026-06-28 Claude threads on PR #4268. Fixed in
Resolved threads:
Local validation on
No skipped review items from this pass. |
…ered-rsc-rendering * origin/main: [Pro] Test rejected RSC replacement retry notifications (#4250)
ReviewReviewed the buffered RSC rendering helpers ( Summary: The design is sound. One minor finding (inline comment posted): No correctness, security, or performance issues found beyond that nit. Docs/CHANGELOG/llms-full mirrors are consistent, and Pro license headers are untouched. |
Review SummaryThis PR adds I ran 8 finder passes (line-by-line, removed-behavior, cross-file, reuse/simplification/efficiency, altitude, conventions) followed by targeted verification agents on the two highest-signal candidates. Most candidates (buffer accumulation style, cache-key lambda wrapping, One finding survived verification (posted as an inline comment on
Everything else (helper mutation-safety via |
Address-review summaryScan scope: review activity after 2026-07-01T07:45:08Z on PR #4268. Mattered
Skipped
Deferred-work tracking: none; all new current-head review findings were fixed in this PR. Next default scan starts after this comment. Say |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
react_on_rails_pro/lib/react_on_rails_pro/cache.rb (1)
222-229: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winMissing-bundle fallback isn't memoized, so exceptions can repeat on every render.
ReactOnRailsPro::Utils.rsc_bundle_hashonly caches@rsc_bundle_hashon success; when the RSC bundle file is absent, every call torsc_bundle_cache_keyre-triggersDigest::MD5.fileand re-raises/rescuesErrno::ENOENT. Ifenable_rsc_supportis on but the bundle is persistently missing (e.g. misconfigured deploy), every prerendered cache-key computation pays this exception overhead on the request hot path.Consider memoizing the sentinel result locally so the file-system probe/exception only happens once per process.
♻️ Proposed fix to memoize the missing-bundle fallback
def rsc_bundle_cache_key - ReactOnRailsPro::Utils.rsc_bundle_hash - rescue Errno::ENOENT - RSC_BUNDLE_MISSING_CACHE_KEY + return `@rsc_bundle_cache_key` if defined?(`@rsc_bundle_cache_key`) + + `@rsc_bundle_cache_key` = begin + ReactOnRailsPro::Utils.rsc_bundle_hash + rescue Errno::ENOENT + RSC_BUNDLE_MISSING_CACHE_KEY + end end🤖 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_pro/lib/react_on_rails_pro/cache.rb` around lines 222 - 229, The missing-bundle fallback in rsc_bundle_cache_key is not cached, so every call can re-run ReactOnRailsPro::Utils.rsc_bundle_hash and repeat the Errno::ENOENT rescue path. Memoize the sentinel result inside rsc_bundle_cache_key (or in ReactOnRailsPro::Utils.rsc_bundle_hash) so the missing-bundle case is computed once and reused, keeping the hot path from repeatedly hitting the filesystem/exception flow.
🤖 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_pro/lib/react_on_rails_pro/cache.rb`:
- Around line 222-229: The missing-bundle fallback in rsc_bundle_cache_key is
not cached, so every call can re-run ReactOnRailsPro::Utils.rsc_bundle_hash and
repeat the Errno::ENOENT rescue path. Memoize the sentinel result inside
rsc_bundle_cache_key (or in ReactOnRailsPro::Utils.rsc_bundle_hash) so the
missing-bundle case is computed once and reused, keeping the hot path from
repeatedly hitting the filesystem/exception flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d98a9dde-670c-402e-b41c-a5d86175602b
📒 Files selected for processing (9)
CHANGELOG.mddocs/oss/building-features/caching.mddocs/pro/fragment-caching.mdllms-full-pro.txtllms-full.txtreact_on_rails_pro/app/helpers/react_on_rails_pro_helper.rbreact_on_rails_pro/lib/react_on_rails_pro/cache.rbreact_on_rails_pro/spec/dummy/spec/helpers/react_on_rails_pro_helper_spec.rbreact_on_rails_pro/spec/react_on_rails_pro/cache_spec.rb
✅ Files skipped from review due to trivial changes (4)
- CHANGELOG.md
- docs/oss/building-features/caching.md
- llms-full.txt
- llms-full-pro.txt
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/pro/fragment-caching.md
- react_on_rails_pro/spec/dummy/spec/helpers/react_on_rails_pro_helper_spec.rb
- react_on_rails_pro/app/helpers/react_on_rails_pro_helper.rb
Review SummaryReviewed this PR at medium effort (line-by-line diff scan, removed-behavior audit, cross-file caller tracing, plus reuse/simplification/efficiency/altitude/conventions passes), including two targeted sub-agent investigations into the async/streaming machinery ( What the PR does: Adds Verified as correct / not bugs (worth noting since they looked suspicious at first):
Finding posted inline: No correctness, security, or data-integrity bugs found. Test coverage for the new helpers and cache-key behavior is thorough. |
Pro Node Renderer Benchmark Summary
▲/▼ non-zero change vs baseline · 0.0% exact/near-zero match · 🔴 significant regression · 🟢 significant improvement (tracked measures) · (n) = baseline |
Address-review summaryScan scope: review activity after 2026-07-01T08:07:06Z on PR #4268. Mattered
Skipped
Deferred-work tracking: none. Next default scan starts after this comment. Say |
Pro (shard 2/2) Benchmark Summary
▲/▼ non-zero change vs baseline · 0.0% exact/near-zero match · 🔴 significant regression · 🟢 significant improvement (tracked measures) · (n) = baseline |
Core Benchmark Summary
▲/▼ non-zero change vs baseline · 0.0% exact/near-zero match · 🔴 significant regression · 🟢 significant improvement (tracked measures) · (n) = baseline |
Pro (shard 1/2) Benchmark Summary
▲/▼ non-zero change vs baseline · 0.0% exact/near-zero match · 🔴 significant regression · 🟢 significant improvement (tracked measures) · (n) = baseline |
…st-surface-4274 * origin/main: [Pro] Add buffered RSC rendering helpers for static pages (#4268)
Summary
Codex Decision Log
Validation
Local broad-gate note
Review status
Labels: ready-for-hosted-ci, full-ci, benchmark - this touches Pro helper/runtime caching behavior and server rendering paths.
Fixes #4263