Repository navigation
feat: close the React Float behavioral gaps (#711) - #720
Merged
Merged
Conversation
Hoist exclusions (itemProp metadata stays with its itemScope host; noscript children stay in fallback content) on client and server; font preloads force anonymous CORS; preload-seeded options transfer onto the initialized resource with server-side preload coalescing (hint emission moved to a keyed map on HeadBuffer, snapshot/rewind covered); preconnect identity includes the CORS mode; responsive image preloads omit the fallback href; unknown hint options drop and non-string hrefs dev-warn and no-op across all six entry points; one executable identity per module src across preinitModule and Float scripts on server and client. Closes the Float behavioral gaps section of #711. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: itemProp still hoists Float resources
- Added itemProp/itemprop early-return to the link/script attribute walk in headResourceKind, matching the existing style resource exclusion so microdata-owned stylesheets and async scripts no longer classify as Float resources.
- ✅ Fixed: Preconnect CORS key collision
- Removed the nullish coalescing to '' so String(undefined) produces 'undefined' while String('') produces '', giving distinct deduplication keys for omitted vs empty-string crossOrigin.
Or push these changes by commenting:
@cursor push e4f7bb3ba4
Preview (e4f7bb3ba4)
diff --git a/packages/octane/src/compiler/compile.js b/packages/octane/src/compiler/compile.js
--- a/packages/octane/src/compiler/compile.js
+++ b/packages/octane/src/compiler/compile.js
@@ -18371,8 +18371,10 @@
if (attr.type !== 'Attribute' && attr.type !== 'JSXAttribute') continue;
const name = jsxAttrRawName(attr);
// Handlers keep the element per-site (matching React: a load/error
- // listener needs an owned instance); markup injection disqualifies too.
+ // listener needs an owned instance); markup injection and microdata
+ // ownership (itemProp) disqualify too.
if (name === 'onLoad' || name === 'onError' || name === 'dangerouslySetInnerHTML') return null;
+ if (name === 'itemProp' || name === 'itemprop') return null;
if (name === 'precedence') hasPrecedence = true;
else if (name === 'href') hasHref = true;
else if (name === 'async') {
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
@@ -8168,7 +8168,7 @@
export function preconnect(href: string, options?: { crossOrigin?: string }): void {
const value = coerceHintHref(href);
if (value === null) return;
- const key = 'preconnect:' + String((options as any)?.crossOrigin ?? '') + ':' + value;
+ const key = 'preconnect:' + String((options as any)?.crossOrigin) + ':' + value;
const safeHref = sanitizeURL(value);
emitHeadHint(
key,
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -27808,16 +27808,13 @@
const rawHref = guardHintHref('preconnect', href);
if (rawHref === null) return;
const safeHref = sanitizeURL(rawHref);
- insertHeadHint(
- 'preconnect:' + String((options as any)?.crossOrigin ?? '') + ':' + rawHref,
- () => {
- const l = document.createElement('link');
- l.rel = 'preconnect';
- l.href = safeHref;
- applyHintAttrs(l, options);
- return l;
- },
- );
+ insertHeadHint('preconnect:' + String((options as any)?.crossOrigin) + ':' + rawHref, () => {
+ const l = document.createElement('link');
+ l.rel = 'preconnect';
+ l.href = safeHref;
+ applyHintAttrs(l, options);
+ return l;
+ });
}
/** React DOM `prefetchDNS(href)` — `<link rel="dns-prefetch">`. */You can send follow-ups to the cloud agent here.
…nguishes omitted CORS headResourceKind's link/script loop now rejects itemProp like the hoistable and style-resource paths (microdata wins over the resource classification), and the preconnect identity separates an omitted crossOrigin (no CORS) from crossOrigin: '' (anonymous) — distinct browser connection modes. Addresses both Bugbot findings on #720. Co-Authored-By: Claude Fable 5 <[email protected]>
trueadm
marked this pull request as ready for review
August 12, 2026 08:38
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: SSR preload skips module cross-guard
- Added missing cross-guards so SSR preload(as:'script') also checks 'module:' keys and preloadModule also checks 'script:' keys, matching the client's unified executable identity suppression.
Or push these changes by commenting:
@cursor push 92d6a5bd80
Preview (92d6a5bd80)
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
@@ -8094,7 +8094,8 @@
// coalesced away when the preinit lands (see the hintHtml delete there).
if (HEAD !== null) {
if (as === 'style' && HEAD.hints.has('sheet:' + value)) return;
- if (as === 'script' && HEAD.hints.has('script:' + value)) return;
+ if (as === 'script' && (HEAD.hints.has('script:' + value) || HEAD.hints.has('module:' + value)))
+ return;
if (as === 'style' || as === 'script') {
let subset: Record<string, unknown> | null = null;
for (const k of ['crossOrigin', 'integrity', 'nonce', 'fetchPriority', 'referrerPolicy']) {
@@ -8306,8 +8307,9 @@
export function preloadModule(href: string, options?: Record<string, unknown>): void {
const value = coerceHintHref(href);
if (value === null) return;
- // A module that preinitModule already executed in this pass needs no preload.
- if (HEAD !== null && HEAD.hints.has('module:' + value)) return;
+ // A module that preinitModule or a Float script already executed in this pass needs no preload.
+ if (HEAD !== null && (HEAD.hints.has('module:' + value) || HEAD.hints.has('script:' + value)))
+ return;
const key = 'modulepreload:' + value;
const safeHref = sanitizeURL(value);
emitHeadHint(You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit cae7135. Configure here.
preload(as:'script') and preloadModule now check BOTH executable namespaces on the server, matching the client's unified identity set — no redundant classic preload after preinitModule, no redundant modulepreload after a classic Float script. Addresses the third Bugbot finding on #720. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Aug 12, 2026
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 "Float behavioral gaps" section of #711 (the seven items from the verified 19.2.7 comparison in the comment feedback).
itemProp-bearing<meta>/<link>stay with theiritemScopehost, and metadata/Float resources that are direct children of<noscript>stay in the fallback content, symmetrically on client and server (hydration adopts the identical shape). One documented bound: the<noscript>exclusion is one nesting level deep — metadata wrapped in a further host inside<noscript>still hoists (noted indifferences-from-react.md; deeper threading needs the noscript context to survive element recursion, a follow-up if real code hits it).crossorigin=""regardless of the caller's value, client + SSR.HeadBuffer, participating in both suspense-replay snapshot/rewind sites).preinitModuleand<script async type="module" src>: the client seed scan now recognizes both marker forms, both insert paths register/consult one set, and the SSR pass cross-guards the two key namespaces. Both cross pairings (SSR preinitModule × client Float discovery; SSR Float × client preinitModule) adopt instead of duplicating.(url, crossOrigin)keys, client + SSR.hrefwhenimageSrcSetis present, client + SSR.Ledger + docs
Four cases flipped to
coveredwith executed evidence (…18285citemProp,…3bd259noscript,…dc93d1font CORS,…b15c17connection-prop seeding); coverage report regenerated;differences-from-react.mdupdated (exclusions, unified hint semantics, and the now-obsolete "unknown keys pass through" sentence corrected). Changeset included.Validation
pnpm format:check,pnpm typecheckpnpm test(full suite) andnode scripts/react-parity/check.mjs(full — executes the four new evidence records)targeted:
hoist-exclusions(12),resource-hints(42),float-resources(28), plus head-hydrate/nested-head neighbors — all green in dev and prod compile projects.Every family was red-first: the exclusion suite failed with metadata hoisted to head; the hint cases failed 12/12 (font CORS, transfer, preconnect keys, image href, validation); the module-identity cases failed with duplicate scripts in both pairings. Two pre-existing contracts migrated deliberately: the legacy font-preload assertion now pins the React-correct
crossorigin="", anduntrusted-url's coercion probes flipped meaning — non-string hrefs never coerce now (dev-warn + no-op,calls() === 0), which retires the mutating-toStringTOCTOU channel outright, and the unknownsrcoption no longer serializes at all (the sanitize-through-option concern is moot when the key drops). The full suite caught thatpreconnect/prefetchDNSstill coerced on the client — all six hint entry points now share the same strict guard.Review-fix commit b76fb14 (both Bugbot findings, red-first): itemProp now disqualifies the Float RESOURCE forms too (the link/script classifier loop had missed the check the style/hoistable paths had), and the preconnect key distinguishes an omitted crossOrigin from
''— four distinct connection-mode identities, pinned by test. Full suite re-run: 18,669/18,669 clean.Risk / follow-ups
<noscript>depth bound above.Provenance
agent-authored)Note
Medium Risk
Touches SSR head buffering (including suspense snapshot/rewind), hydration shape for metadata, and resource-hint identity/deduping. Mistakes here can cause hydration mismatches or duplicate scripts, though the changes are covered by new conformance tests.
Overview
Closes remaining React Float behavioral gaps so document-metadata hoisting and resource hints match React on both client and server.
Hoist exclusions:
itemProp-bearing<meta>/<link>(and Float resource forms) stay with theiritemScopehost, and metadata/resources that are direct children of<noscript>stay in fallback content. CompilernormalizeChildren/ hoist classifiers enforce this so hydration adopts the same shape.Resource-hint semantics: font preloads always emit anonymous CORS; preload connection/integrity options transfer onto the matching
preinit(server coalesces the redundant preload via a keyedhintHtmlmap);preconnectidentity includes CORS mode; responsive image preloads omit the fallbackhref; unknown option keys drop; non-string hrefs warn and no-op.Module identity: one executable per src across
preinitModuleand<script async type="module" src>in SSR and on the hydrating client, so cross pairings no longer duplicate scripts.Four ledger cases move to
covered; docs and tests updated accordingly.Reviewed by Cursor Bugbot for commit 1e25471. Bugbot is set up for automated code reviews on this repo. Configure here.