Repository navigation
perf(octane): keep the transition and hidden-Activity graphs out of Suspense-only bundles - #1855
Merged
Merged
Conversation
…uspense-only bundles A @Try boundary with a @pending arm installed the whole transition swap driver, so every Suspense application retained transition attempts, root holds, held-update replay and urgent transition renders, and the Suspense visibility driver retained <Activity>'s hidden re-render and re-hide. - Split the driver: tryBlock installs only the off-screen swap (render, dispose, splice). startTransition, the one entry to transition-priority work, also installs TRANSITION_ROOT_DRIVER. A missing root driver reports what an installed one reports before any transition: no attempt, no root hold, no held update. - activityBlock installs the Activity members of the visibility driver before it first hides an Activity; a Suspense boundary reaches them only through a hidden Activity it found. - Drop the swap driver's never-called commit member. Adds the hydrate-frame bundle-reachability scenario: a production server build renders the markup, and the measured client bundle hydrates a frame with native signal reads, a keyed @for, a @Try boundary, forwarded styles, a portal and an octane/behavior island. hydrate-frame 374,640 -> 364,850 raw, 115,527 -> 112,823 gzip; deferred-hydration 230,935 -> 220,956 raw, 72,354 -> 69,578 gzip. Budgets lowered with --write-budgets; none raised. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 7, 2026 19:21
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 4836ec0 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 07:25 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 4836ec0 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 07:26 PM |
5 of 6 tasks
Contributor
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
14 other measured values are unchanged. Public-import reachability bundles (bytes)
73 other measured values are unchanged. |
This was referenced Oct 7, 2026
trueadm
added a commit
that referenced
this pull request
Oct 7, 2026
…nal scope hydrate-frame (added on main by #1855) hydrates signal reads, so it ships the signal engine. Against 188d60b's sources it is 2,030 B raw, 488 B gzip and 437 B brotli smaller with this branch's engine, and no other minimal scenario moves. The new budget is main's budget minus that delta, because this machine measures main's own hydrate-frame 4 B over its budget. Co-Authored-By: Claude Opus 5.5 <[email protected]>
6 of 8 tasks
trueadm
added a commit
that referenced
this pull request
Oct 7, 2026
Conflicts: app-budgets.json and minimal-budgets.json, where #1854 and #1855 lowered the rows this branch had tightened. Take main's values, then write this branch's measurements (`--write-budgets`) on the merged tree, which only lowers: bindings app gzip and total raw, one app brotli, and three minimal gzip rows. hydrate-frame stays at main's 364,882 raw. It measures 364,886 here and on main alike, and main's own CI fails the same check, so the raise belongs in a budget-only change on main, not in this PR. #1852 stops the Vite plugin parsing modules it only passes through, such as the SSR chunks Nitro re-bundles. The @tsrx/core patch still bounds every module the plugin does compile, so its guard now transforms a 540 kB project module that uses a hook instead of a Nitro chunk: about 2 s patched, 20 s unpatched, against a 6 s bound. The patch note says so. Reformat main's new hydrate-frame fixture; its output is unchanged once position-derived ids are masked. main's changed test files pass on this branch (bundler-compiler, compiler-vite-options, behavior-root, binding-handoff, style-transaction-rollback). Co-Authored-By: Claude Opus 5.5 <[email protected]>
7 of 8 tasks
domgan-oai
pushed a commit
that referenced
this pull request
Oct 7, 2026
…#1851) * perf(signals): install the public Scope surface only from createScope Owner scopes that the runtime creates for compiled signal declarations never reach application code, yet every signal application shipped the whole public Scope implementation: serialization, inspection, trace recording and the imperative derived$/get/set/isPending/batch/action methods. ScopeImpl keeps one class shape. createScope installs the public-only methods on its prototype the first time it runs, and only a debug scope installs trace recording. The server's native-read driver installs the read serializer, so clients never ship it. beginAdoption stays a method: hydration resolves it through the owner, and importing the engine from the hydration path would pull the engine into applications without signals. An internal OwnerScope type omits the installed members, so internal code that reaches for one fails to typecheck. Signal applications are 871 to 1,118 B smaller gzipped; applications without signals are byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(signals): keep native-read serialization off the server's import path The server's native-read driver imported the engine to install the read serializer. That loaded the engine, and its top-level batch-hook registration, on every server render, including applications without signals, and Node's strip-only TypeScript loader rejects the engine's parameter property (register-hook direct server scripts failed). serializeRead is a ScopeImpl method again, reached through the owner as on main, so the server path and graph.ts match main. The server-render budget returns to main's value. Signal applications are now 489 to 652 B smaller gzipped; applications without signals stay byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(hydration): read local scope state without the public inspect() native-deferred-local-hook-diagnostics reached through a useSignal$ handle's internal owner and called inspect(). Runtime-created scopes no longer carry the public Scope surface unless the program calls createScope, and these cases never do. Read the adoption leases and node count that inspect() reported from the scope directly. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(signals): hand out whole Scopes from the public owner routes Runtime-created owner scopes reach application code: derived$ and query$ run authored callbacks under them, so the public currentSignalOwner() returns one, and a host SignalOwnerEnvironment carries them. Both are typed SignalOwner, which narrows to Scope, but without an earlier createScope the scope lacked inspect(), get() and the other installed methods. currentSignalOwner and installSignalOwnerEnvironment exported from octane/signals now install the public Scope methods before an owner can escape; the runtime keeps owner-context's engine-free versions. octane/server's carrier must stay engine-free, so SignalOwnerEnvironment now carries owners as SignalOwnerIdentity values: a carrier stores and returns them but cannot narrow them to Scope. Carriers that store SignalOwner values compile unchanged. bundle-boundaries builds each route in its own program without createScope (the review's currentSignalOwner probe and a carrier that calls the owner it carries); both fail with "inspect is not a function" without this change. A type test pins the identity-typed carrier. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(bundle-size): lower the hydrate-frame budget for the lighter signal scope hydrate-frame (added on main by #1855) hydrates signal reads, so it ships the signal engine. Against 188d60b's sources it is 2,030 B raw, 488 B gzip and 437 B brotli smaller with this branch's engine, and no other minimal scenario moves. The new budget is main's budget minus that delta, because this machine measures main's own hydrate-frame 4 B over its budget. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(bundle-size): re-measure hydrate-frame with #1857 and #1862 merged With #1857 (in-place Block signal owners) and #1862 (unchanged adoption reads) on main, this branch's hydrate-frame measures 364,278 raw, 112,866 gzip and 96,483 brotli. The budget is that measurement plus headroom: 364,310 / 112,898 / 96,616. That is below main's 366,064 / 113,343 / 97,053, so it lowers rather than raises. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 13, 2026
trueadm
added a commit
that referenced
this pull request
Oct 13, 2026
…chability (#2032) * test(bench): measure a rolldown + oxc split-chunk shell in bundle-reachability A production rolldown + oxc app ships Octane as ESM chunks: `codeSplitting` groups put the signal engine and the rest of the octane package in chunks of their own, and the renderer loads on a dynamic-import chain. No reachability fixture built that way, so nothing showed whether the optional-driver eliminations from #1855 and #1942 survive chunk boundaries, or what each chunk costs. The split-shell fixture hydrates a server-rendered shell after activating a renderer-free behavior island, with native reads of imported signals, a visible() Hydrate boundary, a lazy route behind useTransition, @Try over use(), a portal and a keyed list. It reports the whole application and each group's chunk, rejects Octane modules in application chunks, and checks through the source map that the runtime chunk drops the unused ViewTransition and Activity drivers. The chunks run in jsdom linked into one script. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(bench): resolve the linked split-shell entry without platform paths linkChunks found the entry chunk through path.relative, which joins with backslashes on Windows while chunk file names stay POSIX. Pass the virtual entry id as the link build's input instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(bench): list only each split-shell chunk's modules in its row The runtime and signals rows measure one chunk each but recorded the whole application's module list. Each chunk row now carries its own modules; the behavior snapshot stays on every row because all rows come from the one verified build. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.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
hydrate-framebundle-reachability scenario shaped like a production signals + hydration app: a server-rendered frame hydrated with native signal reads, a keyed@for, a@try/@pending/@catchboundary, forwarded style objects, a portal opened after hydration, and anoctane/behaviorisland. It reproduces the audited runtime chunk closely (main: 374,640 B raw / 115,527 B gzip; the audited chunk was 391 KB / 121 KB).@trywith a@pendingarm installed the whole transition driver (attempts, root holds, held-update replay, urgent transition renders). It now installs only the off-screen swap it uses for urgent branch replacement.startTransitioninstalls the transition members, as it already must before any transition-priority work exists.<Activity>'s re-hide and hidden re-render.activityBlocknow installs them when it first hides an Activity, the only way a Suspense boundary can find a hidden one.commitmember, which nothing called.hydrate-frame: −9,790 B raw / −2,704 B gzip (−2.6% / −2.3%). A Suspense app without transitions (deferred-hydration): −9,979 B raw / −2,776 B gzip. No behavior change.Breakdown: what the client runtime ships for this app shape (main)
Measured on
hydrate-frameat main 7e6bda5 with the bundle-size harness's Vite/Oxc production build plus source maps. Coverage is V8 precise block coverage in jsdom from script evaluation through hydration, the first signal write, opening the portal and an island click. 374,696 B raw / 115,577 B gzip, 29.7% of bytes executed.By module
runtime.tssignals/graph.tsbehavior-root.tssignals/engine.tssignals/computations.tssignals/native-read-client.tssignals/facade.tsdom-tables.jsfixture: hydrate-frame-app.tsrxsignals/native-read-seeds.tsdata-encoding.tsalien-signals/esm/system.mjssignals/early-values.tshook-slot-cache.tssignals/read-protocol.tssignals/native-read-collector.tsfixture: hydrate-frame.tssignals/redeclaration.tsstyle-values.jssignals/candidate-producers.tsstream-protocol.tsevent-names.jsBy capability
octane/signals)promoteDeclarationView1,534,createNativeReadDriver1,518,getInitialDocumentCapture1,313hydrateRootWithOutputHandler2,391,coalesceHydratedRanges1,901,HydrationCapability.adopt1,030renderBranchSlot4,003,componentSlotImpl3,984,makeRoot2,508@try/ Activity / off-screenmountTry2,512,switchToCatchInner1,841,attemptHiddenRevealInner1,791childSlot8,329,renderPreparedChildList3,398,deoptItemBody2,659clearChildContent1,598,childTextHole1,229,bindingText638endTransitionAttempt964,rollbackTransitionJournal912,holdRootTransition793drainQueue1,136,detachSubtreeRefs1,032,batchClearItems828setAttribute1,377,restoreForSlot1,295,maybeEnqueueRestore1,068@forreconcileKeyed3,919,forBlock1,485,deferRootOwnedListClear1,049octane/behavior)registerExternalRange1,246,registerBehavior799,handleDelegatedEvent578bindSignalChild908,bindDirectSignal852,createDirectSignalBinding555parseSeedJson844,isBindingOpenComment651,HydrationCapability.seedOrCreate457dispatchDelegatedCapture555,buildDelegatedPath368,delegateCaptureEvents296ATTRIBUTE_ALIASES2,977 andSVG_ONLY_TAGS743 execute at loadmoveFocusedNodeBefore951,captureFocusSelection916,restoreFocusSelection727resolvePortalEventOwner561,renderPortalState555decodeHydrationRejectionPayload748,fallBackServerCatch401,describeHydrationNode320readStateHook833,readContextFrom543formatProdErrorMessage237Areas group
runtime.tsdeclarations by name, so the split is approximate; module totals above are exact.Findings
Coverage counts code that ran before the page was interactive, not code the app can never need: Suspense fallbacks, keyed moves and mismatch recovery must stay synchronous when they do run, so they cannot move behind a dynamic import without changing behavior. The lever is reachability: code that ships only because an unrelated feature retains it.
Moved behind their owning capability in this PR
@try+@pendingthrough the shared swap driver. Now installed bystartTransitiononly. Transitions + journal onhydrate-frame: 19,577 → 12,370 minified bytes.activityBlockwhen it first hides an Activity. Suspense/Activity area: 33,397 → 31,321.commitmember had no caller.Found, not in this PR
specialize-error-calls.mjs) inlines a private__octaneNoArgErrorhelper, with the full "Minified Octane error" text, into each of 29 zero-argument modules.hydrate-framebuilt against the publisheddist/carries 9 copies (+1,562 B raw / +196 B gzip over source), and a code-split app carries one per chunk. perf(octane): share one production formatter across published zero-argument errors #1856 makes the specializer import one shared formatter instead: 22 copies in 10 chunks become 2 copies in one chunk for a split build of this app.{createPortal(...)}compiles to a directportal()call, except in a module with a signals import, where it becomesbindSignalChildand retainschildSlotwith the descriptor/de-opt renderer. Apps with{children}holes retainchildSlotanyway, so this matters only for apps whose sole generic hole is a portal.HydrationCapability(23.9 KB, 77% cold). Its methods cannot tree-shake individually, but only about 1.6 KB of them have no live caller in this shape, so splitting the class is not worth it here.describeHydrationNodethunks it passes tomismatch(), which only development reads. About 0.4 KB.octane/behavior(12.8 KB, 52% cold).registerExternalRangeand the other root methods ship wheneverattachBehaviorRootis used, and its errors are plain English strings in production rather than catalog codes.stream-protocol.ts(1.1 KB, 4% executed) and the seed parser ship with every hydrating root, but this shape does not stream.Bundle-size gate
Both runners, on this head, with
--write-budgets(every scenario and app; values only lowered, plus the newhydrate-framekey).node benchmarks/bundle-size/budget-raises.mjs --base origin/mainreports no raised budget.node benchmarks/bundle-size/run-minimal.mjs --write-budgets(exit 0; main measured from the same harness on 7e6bda5):hydrate-frame(new)deferred-hydrationsuspense-transition(usesstartTransition)hydrate-roothooks-stateroot-staticbinding-base-ui,binding-radixandbinding-apollo-client(Vite and esbuild) budgets drop 22–26 B raw.node benchmarks/bundle-size/run.mjs --write-budgets octane-tsrx octane-jsx(exit 0), framework bytes:todo, chat and weather use neither Suspense nor transitions. They gain one more never-assigned driver slot (9–10 B raw), within the 32 B ratchet, so their budgets are unchanged.
Validation
node benchmarks/bundle-size/run-minimal.mjs --write-budgetsandnode benchmarks/bundle-size/run.mjs --write-budgets octane-tsrx octane-jsx: both exit 0. Every reachability fixture,hydrate-frameincluded, runs its production bytes in jsdom against its oracle../node_modules/.bin/vitest run --project octaneon the 25 transition, Suspense, Activity, action and@tryfiles: 438 passed.activity.test.tsandactivity-suspense-retry.test.tsfail 9 tests (once forrehide, once forretryActivity). Without the root driver installed,transitions.test.tsandtransition-held-audit.test.tsfail 26 tests.pnpm typecheck:files packages/octane/src/runtime.ts,pnpm format:files:checkon changed files,pnpm sync(clean).pnpm test,pnpm typecheckandpnpm format:checkwere not run locally; CI runs them.Risk / follow-ups
runTransition" now also guards Suspense-only apps. The existing comment already made it load-bearing for apps with neither feature. EverypendingMode = 'transition'writer was checked, includinguseDeferredValue, which goes throughstartTransition.runtime.ts. Any overlap is a few call-site lines.hydrate-framehydrates server markup from a production server build of the same modules, so a marker-protocol change updates both sides together. A hydration mismatch fails itsadoptedoracle.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes when core transition and Activity code is linked into production bundles and touches many runtime commit/render paths, though behavior is intended to be unchanged and is guarded by reachability oracles and targeted tests.
Overview
Splits optional runtime drivers so Suspense-only apps no longer ship transition root logic (attempts, holds, held-update replay) or hidden-
<Activity>re-hide/re-render. A@tryboundary with@pendingnow installs only the off-screen swap used for urgent branch replacement;startTransitioninstalls the transition root driver;<Activity>installs Activity visibility hooks on first hide. The unused swap-drivercommitpath is removed. Runtime call sites move from a singleTRANSITION_SWAP_DRIVERtoTRANSITION_SWAP_DRIVER(swap) vsTRANSITION_ROOT_DRIVER(transitions).Adds a
hydrate-framebundle-reachability scenario (serverrenderToString+ client hydrate) covering signals, keyed@for, settled@try, styles, portal, andoctane/behavior, with adoption oracles and byte budgets. Harness support builds optional*.server.tsmarkup for hydrating scenarios. Committed budgets drop for Suspense-heavy fixtures (e.g. ~9.7 KB raw / ~2.7 KB gzip on deferred-hydration and the new frame shape) with no intended behavior change.Reviewed by Cursor Bugbot for commit 4836ec0. Bugbot is set up for automated code reviews on this repo. Configure here.