Repository navigation
Conversation
The @for arm markers, presentation-binding comment prefixes, deferred-boundary attribute names, useId spelling, element-scoped ViewTransition stylesheet, and the cross-realm Symbol.for tags were each re-typed in two to five modules. A change on one side of a hydration boundary could diverge from the other with no test noticing. Give each one an owning module: hydration-markers.js for the payloads, attributes and useId (it stays off the dom-tables.js graph so the pre-root capture bundle can share them), dom-binding-protocol.js for the binding marker producer next to its parser, css.js for the ViewTransition stylesheet, and a new runtime-tags.js for the registry keys. octane/constants re-exports the same names and values. Payloads stay plain literals: a bundler does not constant-fold a cross-module template literal, and a derived spelling measured roughly twice the bundle cost on the pre-root capture entry. Adopting a presentation view whose range carries no view id is now rejected outright instead of compared against "[b;undefined;root".
WebEferen
marked this pull request as ready for review
September 19, 2026 00:26
WebEferen
marked this pull request as draft
September 19, 2026 00:32
WebEferen
marked this pull request as ready for review
September 19, 2026 00:51
8 tasks done
Contributor
Author
|
Closing because #1169 carried the work I've done here. |
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
Every hydration wire literal now has exactly one owning module. Six families of
them were re-typed across two to five files each, so a change on one side of a
hydration boundary could diverge from the other and no test would notice: the
failure only shows up as a mismatch in a real app.
[][f[f0[f1hydration-markers.tsconstants.ts+stream-protocol.tsdata-octane-hydrate-{id,when,id-count,seed}+ selectorhydration-markers.tsconstants.ts+ 3 ×hydration/*+runtime.tsuseIdspelling (:prefixin-base36:)hydration-markers.tsruntime.ts+runtime.server.ts[b;…;root,[f0;b;,[f1;b;dom-binding-protocol.tsruntime.ts+runtime.server.tscss.tsruntime.ts+runtime.server.tsSymbol.forregistry keysruntime-tags.ts(new)hydration-markers.tsis the home for the first three because the pre-rootcapture bundle and
stream-protocol.tsdeliberately avoidconstants.ts(itimports
dom-tables.js). That constraint is why the literals were duplicated inthe first place; moving the declarations down to the table-free leaf and
re-exporting them from
constants.tssatisfies it without a second spelling.octane/constantsexports the same names and values as before.Marker payloads stay plain literals rather than deriving the longer ones from
the shorter. A bundler does not constant-fold a cross-module template literal,
so a derived spelling reaches every output as a runtime concat and measured
roughly twice the bundle cost. Downstream prefixes still derive from them.
Validation
pnpm format:checkpnpm typecheckpnpm testpackages/octane/tests/wire-protocol-single-owner.test.ts(new)Local
pnpm test: 2 failed / 67079 passed. Both are the webkit cases inpackages/vite-plugin-octane/tests/production.test.ts, which fail identicallyon
origin/mainon the same machine;origin/mainadditionally fails one casein
packages/vaul/tests/browser/vaul.browser.test.ts, so this branch is astrict subset of the base failures here. The suite needs
NODE_OPTIONS=--max-old-space-size=8192on that machine; at the default heap itdies with a V8 OOM and reports unrelated flakes on the way down. CI is the
authoritative signal.
Bundle cost,
benchmarks/bundle-size/run-minimal.mjson two worktrees of thesame machine (
origin/main@ 9307ab2 vs this branch):Two of that benchmark's assertions already fail identically on pristine
origin/mainhere (capture-onlymeasures 10229 against a 3776 budget, andcli-spa-starterreportsstyled: false), so I made them non-fatalsymmetrically in both worktrees to collect every scenario. That harness edit is
not part of this diff.
Risk / follow-ups
Bugbot flagged this Medium Risk for the silent-hydration-mismatch class, which
is the right class to worry about. Here is what it actually reduces to.
Every value is pinned, not merely relocated. No literal changed spelling in
this diff, and the new suite asserts each one against its written-out form:
'[',']','[f','[f0','[f1','[b;',bindingRootMarker('v7') === '[b;v7;root',formatUseId('r3-', 35) === ':r3-in-z:', the fourdata-octane-hydrate-*names and the selector, both halves of the ViewTransitionstylesheet, and
tag === Symbol.for(key)for all ten registry keys. A typo madewhile moving a declaration fails the suite instead of reaching a hydration
boundary. I confirmed that by breaking one value per family on purpose and
watching the suite go red.
The one measured cost is bundle size: +132 raw / +47 gzip bytes (+1.29%) on
the pre-root capture entry, +0.07% or less on every other scenario, and exactly
zero on
server-hooks,binding-vanillaandbinding-aria-vite, which is theevidence that the new tag leaf still tree-shakes. Full table above. I measured
three shapes of the change and shipped the cheapest one that still keeps a
single owner per literal.
The behavior change is unreachable from this repo. The only in-repo producer
of a
kind: 'view'handoff range iscurrentRanges()indom-binding-program.ts, which setsview: definition.view.idfromCompiledBindingProgram.id, typedreadonly id: string. Sorange.viewisalways a string for a view range, and the new
range.view === undefinedarmcannot be taken. The type cannot express that because
BindingHandoffRangeis aflat interface rather than a discriminated union, and external adapters
implement it, so narrowing it is a contract change and deliberately not done
here. For a malformed external lease the previous code compared against
"[b;undefined;root", which only a view stamped with the literal idundefinedcould match, so the two agree everywhere except a doublypathological case, where rejecting (and re-rendering) is the safe direction.
/* @__PURE__ */onSymbol.foris existing practice, not something this PRintroduces.
mainalready uses it in six places, including the cross-adapterkeys
octane.binding-handoffandoctane.control-handoff. Dropping anunregistered key is unobservable because
Symbol.forcreates on read: a bundlethat needs a tag calls for it itself rather than relying on another module
having registered it first.
Not covered, and not exposure this diff creates
Both of these are duplication that already exists on
main. This diff neitherimproves nor worsens them; they are listed so the remaining surface is explicit.
src/compiler/*ships as verbatim JavaScript and can only import plain-JSleaves (it already imports
dom-tables.js,event-names.js,sanitize-url.js). Socompile.jsstill mints its own[b;markers, and__oct_loc,octane-frag,__octanePermanentStaticand__octaneNativeChangeDiagnosticstay duplicated against the runtime. Sharingthem needs the leaf converted to
.jsplus.d.ts; the new suite scopesitself to
packages/octane/srcoutsidecompiler/and says so.Octane-RPC-Outcomeis written inpackages/app-core/src/server/rpc.jsandread in three
packages/octane/srcmodules.app-coredeclaresoctaneas apeer dependency and that file imports nothing from
octanetoday, sosingle-sourcing the header would mean adding a wire constant to octane's
public export surface and introducing the first octane import into that
module. That is an API decision rather than a mechanical move, which is why it
is out of scope here rather than a boundary this diff leaves broken.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes span client/SSR hydration markers, deferred-boundary attributes, and shared Symbol tags—any typo would surface as silent hydration mismatches, though values are unchanged and a new scan test guards duplicate spellings.
Overview
Consolidates hydration and cross-runtime wire literals so SSR, the client runtime, pre-root capture, and React/universal layers import the same definitions instead of re-typing strings and
Symbol.forkeys in multiple files.New or expanded owners:
hydration-markers.ts(block/@forcomment payloads, deferred<Hydrate>attribute names and selector, sharedformatUseId),dom-binding-protocol.ts(binding comment prefixes,bindingRootMarker,isForBindingOpenComment),css.ts(element-scoped<ViewTransition>style id/CSS), andruntime-tags.ts(Octane/React registry tags).constants.tsstill exposes the public API via re-exports; capture/stream code imports the table-free leaves directly.Call sites in
runtime.ts,runtime.server.ts,stream-protocol.ts, hydration capture, and React/universal code switch to those imports.wire-protocol-single-owner.test.tsscanspackages/octane/srcand fails if any wire literal is spelled twice in source.Behavior: adopting a presentation view when the hydration range has no view id now fails immediately (
range.view === undefined) instead of building a comparison against"[b;undefined;root".Reviewed by Cursor Bugbot for commit f043e9c. Bugbot is set up for automated code reviews on this repo. Configure here.