Repository navigation
fix: close the last Float engine gaps — fallback-hoistable suppression and head priority order - #742
Merged
Merged
Conversation
…n and head priority order Fallback hoistables are now suppressed transitively on the server: a title/meta/link authored inside a pending boundary's fallback never reaches the streamed head, including from a completed boundary nested inside that fallback — the fallback is discarded at reveal, but a streamed head line is permanent. Float resources and hints from fallbacks stay registered (page-global; React allows fallback preloads). Priority hoistables now lead the server head fold: meta charSet first (parsers only honor a charset within the first 1024 bytes), then meta name="viewport", then everything else in discovery order — Fizz parity. The new HeadBuffer buckets join both suspense-replay snapshot/rewind sites. Also flips the final actionable evidence cases: identifierPrefix root option, the three external-store compatibility cases, and the two engine-gap cases above. ReactDOMFloat-test.js planned drops to 3 (warning families only); whole-ledger planned 1,928 -> 1,922. Co-Authored-By: Claude Fable 5 <[email protected]>
23 of 27 tasks
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Fallback hoist depth skips ambient snapshot
- Added FALLBACK_HOIST_DEPTH to the Ambient interface, saveAmbient(), and restoreAmbient() so nested renders correctly preserve and restore the outer fallback depth counter.
Or push these changes by commenting:
@cursor push 5c50f35a4e
Preview (5c50f35a4e)
diff --git a/packages/octane/src/runtime.server.ts b/packages/octane/src/runtime.server.ts
--- a/packages/octane/src/runtime.server.ts
+++ b/packages/octane/src/runtime.server.ts
@@ -5499,6 +5499,7 @@
asyncScope: string;
ssrElement: SsrElementContext | null;
nestingWarnings: Set<string> | null | undefined;
+ fallbackHoistDepth: number;
vtTrySeq: number;
vtHasCandidates: boolean;
vtStack: Array<{ candidate: VtSsrCandidate; consumed: boolean }>;
@@ -5526,6 +5527,7 @@
asyncScope: ASYNC_SCOPE,
ssrElement: CURRENT_SSR_ELEMENT,
nestingWarnings: SSR_NESTING_WARNINGS,
+ fallbackHoistDepth: FALLBACK_HOIST_DEPTH,
vtTrySeq: VT_SSR_TRY_SEQ,
vtHasCandidates: VT_SSR_HAS_CANDIDATES,
vtStack: VT_SSR_STACK.map((candidate) => ({ candidate, consumed: candidate.consumed })),
@@ -5554,6 +5556,7 @@
ASYNC_SCOPE = a.asyncScope;
CURRENT_SSR_ELEMENT = a.ssrElement;
SSR_NESTING_WARNINGS = a.nestingWarnings;
+ FALLBACK_HOIST_DEPTH = a.fallbackHoistDepth;
VT_SSR_TRY_SEQ = a.vtTrySeq;
VT_SSR_HAS_CANDIDATES = a.vtHasCandidates;
VT_SSR_STACK.length = 0;You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 4afa283. Configure here.
FALLBACK_HOIST_DEPTH is balanced by withPendingArm's finally within every synchronous pass, so no interleave point can observe a non-zero value today — but Ambient's contract is that EVERYTHING a pass touches is saved and restored, and an unsaved global is a landmine for any future pass that yields mid-arm. (Bugbot review finding.) Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Closes the last two engine gaps from #711's React 19 parity audit and retires the final planned evidence items, leaving only the diagnostics (warning-message) backlog:
…c4141d81): a<title>/<meta>/<link>authored inside a pending boundary's fallback never reaches the streamed head — including from a completed boundary nested inside that fallback. The fallback is discarded at reveal, but a streamed head line is permanent, so a fallback hoist would outlive its content.…ed14e46d):<meta charSet>now serializes at the front of the head (parsers only honor a charset within the first 1024 bytes), then<meta name="viewport">, then everything else in discovery order — matching Fizz.identifierPrefixroot option (linked to the existinguseid-determinismconformance suite) and the three external-store compatibility cases (viauseSyncExternalStoresemantics: one new client-mount 3-arg-form test, plus links to the existing shared/redux conformance suites).Ledger after this PR:
ReactDOMFloat-test.jsplanned drops 5 → 3 (only the three warning-message families remain, tracked in the diagnostics backlog); whole-ledger planned 1,928 → 1,922.Why
Both engine fixes are
runtime.server.ts-only:ssrTry's pending-arm wrapper and checked inssrHeadEl. Nested content arms deliberately never reset it — that's the transitive semantics. Balanced byfinally; re-zeroed with each render's head buffer for crash hygiene. Fallback markup (including a nested completed boundary's content) still renders; only head hoists are dropped, exactly like React. Float resources and hints from fallbacks stay registered (resources are page-global; React allows fallback preloads).HeadBuffergainscharset/viewportpriority buckets routed at registration (runtime values, so dynamicname/charSetroute correctly) and folded ahead of everything else. The buckets joined both suspense-replay snapshot/rewind sites (component replay + the done-boundary fallback render). Ownership markers travel with each element, so hydration adoption is position-independent — the full hydration suite is green.Red-first evidence
nested-primary-metapresent in the streamed shell head (the exact upstream-cited observable).html + charset + viewport(only that test failed; restored, all green).Review round 1 (Bugbot, fixed in 0fa7962)
Valid invariant finding:
FALLBACK_HOIST_DEPTHwasn't carried throughsaveAmbient/restoreAmbient, whose contract is that everything a pass touches is snapshotted so interleaved renders can't clobber each other. The counter is balanced bywithPendingArm'sfinallywithin every synchronous pass, and passes only interleave at await points — so a non-zero value is not observable at any interleave point today and no behavioral repro exists (which is why this ships without a new test rather than with one that cannot fail). The field now rides the ambient snapshot likeHEADitself, closing the landmine for any future pass that yields mid-arm. Re-validated:ssr-suspense-isolation+ SSR/streaming/head suites 350/350, targeted typecheck and format clean.Validation
pnpm format:files(changed files),pnpm typecheckpnpm test— 20,938 passed; 2 failing files, both triaged as not-from-this-diff:doom-browseris nondeterministic under any load (2/7 then 7/7 across two back-to-back isolation runs of the same code) andswr/rootpasses 10/10 in isolation (contention flake)node scripts/react-parity/check.mjs --validate-only— metadata current (ledger + coverage byte-checked)check.mjscould not complete locally: its parity-wide Vitest lane aborts on a Vite "Port … is in use" line polluting the JSON reporter stream — other concurrent agent sessions on this machine hold test ports (verified vialsof/pgrep: live vitest workers from unrelated worktrees). Every NEW evidence test was executed directly instead (all green, dev+prod); CI's parity shards run on isolated runners and are the authoritative gate herefloat-evidence-2(38, dev+prod),float-evidence-3(28, dev+prod), neighbor sweep (hydration/,streaming-ssr,float-resources,resource-hints,ssr-stream-state-regressions,external-store-shared,useid-determinism) 1,010/1,010Risk / follow-ups
charSetattribute name camelCase where React lowercases — HTML attribute names are ASCII case-insensitive so this is spec-equivalent; flagged here rather than silently pinned. Trivial to normalize later if byte-parity with React's head output ever matters.Provenance
agent-authored)Note
Medium Risk
Touches core SSR streaming head assembly and Suspense fallback rendering; mistakes could leak wrong metadata into
<head>or change early-byte layout for parsers, though changes are scoped toruntime.server.tswith targeted conformance coverage.Overview
Closes the last Float engine gaps called out in the React 19 parity audit by changing server head hoisting in
runtime.server.ts.Transitive fallback suppression: While rendering a
@trypending arm,FALLBACK_HOIST_DEPTHincrements andssrHeadElreturns without registering<title>/<meta>/<link>. Nested boundaries that finish inside that fallback still count as fallback territory, so their metadata never lands in the streamed head even though body markup can still show.Priority head ordering:
HeadBufferaddscharsetandviewportbuckets;<meta charSet>and<meta name="viewport">fold before other hoistables (charsetthenviewport, then discovery order). Snapshot/rewind paths track those buffers so suspense replays stay consistent.Evidence and docs: New/extended conformance covers nested-fallback meta suppression and charset/viewport ordering (
float-evidence-2/float-evidence-3), plus a client-mountuseSyncExternalStorecase. The React conformance ledger flips several cases from planned to covered (Float tests,identifierPrefix, external-store shims);differences-from-react.mdand the changeset describe the behaviors.Reviewed by Cursor Bugbot for commit 4afa283. Bugbot is set up for automated code reviews on this repo. Configure here.