PPR: marker-in-content regression test and version-skew error message (#4890) - #4894
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Greptile SummaryThe PR strengthens PPR protocol regression coverage and makes version-skew failures easier to diagnose.
Confidence Score: 4/5The PR appears safe to merge, with only a non-blocking gap in the specificity of the version-message assertion. The production diagnostic uses available, correctly loaded constants and the marker regression exercises the real metadata protocol; only the Ruby test can pass if the actual version value is omitted. Files Needing Attention: react_on_rails_pro/spec/dummy/spec/helpers/react_on_rails_pro_helper_spec.rb Important Files Changed
Reviews (1): Last reviewed commit: "PPR: marker-in-content regression test a..." | Re-trigger Greptile |
size-limit report 📦
|
…#4890) Add a regression test proving the metadata-based protocol is immune to the classic in-band signaling flaw: a component whose rendered HTML contains the literal old PPR_POSTPONED_STATE delimiter text (injected via dangerouslySetInnerHTML so the exact bytes land in the output) round-trips correctly through prerender and resume. Improve the version-skew error message in ppr_check_prerender_protocol! to name both sides' expectations: the expected chunk metadata key (pprPrerenderComplete) and the Rails gem version, so mismatched deployments (old renderer + new Rails) are diagnosable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Incorporate Greptile's suggestion to assert the exact gem version in the test regex so the diagnostic version output is regression-protected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bab6a86 to
e0330bc
Compare
Review SummaryReviewed the diff (JS regression test + Ruby error-message improvement + spec update). This is a small, well-scoped PR and I didn't find any bugs, security issues, or performance concerns. What I verified:
Minor, non-blocking nitpick:
No blocking issues found. LGTM. |
What
Closes #4890 — the remaining acceptance criteria after the core PostponedState-on-metadata work was absorbed by the pipeline re-land (#4888).
1. Marker-in-content regression test (JS)
Adds a test proving the metadata-based protocol is immune to the classic in-band signaling flaw: a component whose rendered HTML contains the literal old
PPR_POSTPONED_STATEdelimiter text (injected viadangerouslySetInnerHTMLso the exact bytes land in the output) round-trips correctly through prerender and resume.This is the test that would fail under the old #4659 prototype's delimiter-scanning approach — any rendered content containing the marker text would cause the split to land in the wrong place.
2. Version-skew error message (Ruby)
Improves the error message in
ppr_check_prerender_protocol!to name both sides' expectations:pprPrerenderComplete)react_on_rails_pro vX.Y.Z)This makes version-skew scenarios (old renderer ↔ new Rails) diagnosable.
Not included (by design)
Parser stripping of PPR keys — discussed and decided to skip. The current design correctly keeps the parser generic (
parseLengthPrefixedStream.tsandlength_prefixed_parser.rbstrip onlypayloadType). PPR keys pass through as opaque metadata for the application layer, consistent withhasErrors,consoleReplayScript, etc. Stripping them would couple the generic parser to PPR-specific constants with no architectural benefit.Verification
pnpm --filter react-on-rails-pro exec jest tests/pprServerRenderedReactComponent.test.jsx)bundle exec rspec -e 'lacks the PPR protocol metadata')🤖 Generated with Claude Code