Skip to content

perf(octane): render hookless control-flow arms without a Block - #1903

Merged
trueadm merged 12 commits into
mainfrom
fix/lite-control-flow-arms
Oct 8, 2026
Merged

trueadm merged 12 commits into
mainfrom
fix/lite-control-flow-arms

Conversation

@trueadm

@trueadm trueadm commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

An @if or @switch arm that calls no hooks now renders without a component Block of its own. This is step 2 of the cold-mount plan. Step 1, #1896 (which slims BlockImpl), has merged, and this branch includes it.

  • Compiler (controlFlowArmIsLite): an arm is lite when it calls no hook, use or context read, has no @try, and makes no call through a bare identifier while it renders. That includes a callee behind a TS cast, !, ?. or a comma, a bare tag, and helper.call/helper.apply. An inline event-handler or ref callback doesn't count, because it runs after render. Any other value of those attributes is walked, so ref={useRef(null)} keeps a Block. A member call is allowed unless it is named like a hook. ifBlock takes a new trailing mask (1 = then, 2 = else). switchBlock takes one too (bit 0 = default, bit i + 1 = case i). Arms that don't qualify emit no extra argument.
  • Runtime: on a markerless client mount, a lite arm renders in a ScopeImpl, with a LiteBlockImpl stand-in as scope.block. It skips BlockImpl, createBlock, createdInRootRender and renderBlock/renderBlockInner. BranchSlot gains lite: Scope | null.
    • The stand-in carries the arm's bound in startMarker/endMarker exactly as an arm Block would. So the boundary-sharing, journaling and live-end code reads state.block ?? state.lite.block and is otherwise unchanged.
    • LiteBlockImpl gains startMarker, set to undefined for lite components, which keeps their sole-root inherit-range decline.
  • When an arm renders lite (liteArmAllowed): a root render must be active and must have created the arm's owning Block. That Block's creation undo then discards the arm with it. Hydration, signal documents and owners, native reads and shared bodies keep Block arms.
  • Teardown:
    • Arms are torn down through the slot (unmountSlot), so effect cleanup order stays in tree order. The arm is not registered in parentScope.children. forEachSubtreeChild visits slot.lite for Suspense and Activity.
    • A committed lite arm swaps out through the existing staged root-render path: the incoming arm renders offscreen, and the outgoing Scope is released at commit (deferRootArmReplacement).
    • If a committed lite arm reaches the legacy path inside a root render, unmountLiteArm defers its release the way deferRootUnmount does. Its nodes leave now, are restored on rollback, and reconnect for the release at commit.
    • releaseLiteArm is idempotent: a rollback can restore a slot that names an already released arm.
    • A lite arm is retired like an arm Block wherever a root render defers its teardown, including disposeReturnSlot. That way queued renders under it stop with it. After a teardown, renderBranchSlot reads disposal from the owning Block, since a stand-in has none of its own.
  • Profile build: a kept lite arm counts as arm.keep, like a kept Block arm. A lite arm is not a Block, so it doesn't count toward block.create or block.unmount; profiling.ts now says so, as it already did for lite components.

Measurements

Paired runs against main in Chromium, using production builds served statically.

Suite / op lite ÷ main 95% CI vs React before → after
recursive-context cold mount (40 fresh pages) 0.970 [0.956, 0.977] 1.22× → about 1.18×
recursive-context partial unmount + remount cycle (warm) 0.900 [0.882, 0.913]
recursive-context update_root (warm, 20 per sample) 0.988 [0.979, 1.009]
recursive-context unmount (warm) 1.000 [0.857, 1.000]
spa-navigation nav_mount 0.829 harness median 1.36× → 1.12×
spa-navigation nav_deep 0.828 harness median 1.19× → 0.99×
spa-navigation nav_deep_6x 0.824 harness median 1.21× → 1.00×
spa-navigation nav_nested 0.951 harness median
spa-navigation nav_teardown 1.013 harness median
  • The full recursive-context run.mjs (order-balanced pairs) gives mount 0.93×.
  • The DOM is byte-identical to main after every recursive-context op: mount, updates, partial unmount/remount, unmount, remount.
  • js-framework has no @if or @switch, so its work counters can't change.

Bundle bytes

Measured locally with run-minimal.mjs against this branch's base, main cbc1e8e651:

Bundle raw gzip
No @if/@switch (root-static-specialized; hooks-state, cli-spa-starter and suspense-transition match) +137 +73
hydrate-frame (control flow) +1,536 +577
  • Teardown reuse: core slot teardown reaches unmountLiteArm only through UNMOUNT_LITE_ARM, which the lite mount installs. A lite arm's commit-deferred teardown shares deferRootTeardown with deferRootUnmount; each passes its own release by reference, so core teardown never names the lite path. This sharing cut control-flow bundles by about 500 B raw (hydrate-frame −517 raw / −145 gzip against the previous head). A root without control flow pays +57 raw for the extra call.
  • Removed gates: the byte budget gates were removed in ci: remove every byte and work-count budget gate #1907, which this branch includes.

Validation

  • pnpm format:files:check on every changed file.
  • pnpm typecheck:files packages/octane/src/runtime.ts packages/octane/tests/hookless-arms.test.ts packages/octane/tests/_fixtures/hookless-arms.tsrx
  • Targeted tests in the octane project:
    • 155 control-flow-related files, 2,321 tests: @if, @switch, keyed lists, Suspense, transitions, Activity, refs, portals, ViewTransition, differential suites.
    • The hydration/ directory: 165 files, 7,816 tests.
    • After merging main (with perf(octane): move feature-only Block state to a lazy record #1896): 38 control-flow, Suspense, transition, Activity, portal-rollback and profiling files across octane, octane-prod and octane-profile, 75 runs and 1,295 tests.
  • profiling-runtime.test.tsrx in octane-profile. CI's first run caught the missing arm.keep probe. The test now swaps back as well, so it still sees a swap tear down a Block arm (the one the update mounted).
  • Full pnpm test, pnpm typecheck and pnpm format:check: left to CI, per the shared-machine load rule.
  • New hookless-arms.test.ts (passes in octane and octane-prod). Each scenario drives a hookless-arm form and a form whose arms call useRef, and compares DOM and effect/ref logs after every step. Scenarios: swaps with siblings and refs, unmount while the arm is still lite, a transition into a suspending arm, keyed rows whose sole root is an arm, Activity hide and show, and a root render that rolls back.
    • Mutation checks: skipping the Scope teardown, releasing a staged arm before commit, dropping the subtree-walk visit, and dropping parent-teardown handling each fail at least one case.
    • Compiler proof (hookless control-flow arm proof): 13 cases. 4 must stay lite: static output, an inline handler, a member ref, a member tag. 9 must keep a Block: hook-produced ref/onClick values, a bare call, cast, !, ?. and comma callees, helper.call, a bare tag. 7 of the 9 failed on the previous proof; helper?.() and helper() were already caught.
    • Reentrant teardown ("stop swapping a nested arm once its teardown unmounts the root"): an arm nested in a hookless arm whose cleanup unmounts the root matches the Block-arm form.
  • perf-review:
## Perf review: fix/lite-control-flow-arms (origin/main..HEAD)

Scan: `node scripts/perf-review-scan.mjs` → 0 candidates.
Hot paths touched: renderBranchSlot (per arm mount, swap and re-render), unmountSlot and forEachSubtreeChild (per teardown or subtree walk), and LiteBlockImpl (per lite component and arm).

| # | Severity | Location | Dimension | Finding | Required evidence | Provided? |
| --- | --- | --- | --- | --- | --- | --- |
| 1 | needs-evidence | runtime.ts `LiteBlockImpl` | shapes | Adds `startMarker`, initialized in the constructor and written for arms only. One map for every stand-in. | One-map check | Constructor discipline; scan clean |
| 2 | needs-evidence | runtime.ts `forEachSubtreeChild`, `unmountSlot` | shapes | Reads `slot.lite` on slot kinds that lack it (a property miss on component slots). | Suspense and Activity walk timings | Covered by tests, not timed |
| 3 | note | runtime.ts `unmountLiteArm` | DOM | Walks the arm's nodes only when it detaches them or defers the release. An earlier draft walked them on every teardown (+52% root unmount); fixed and re-measured at 1.000. | Paired unmount | Yes |

Dismissed: none. Compiler output adds one trailing literal per qualifying ifBlock/switchBlock call.
Not checked: Event Timing.

Risk / follow-ups

  • Arms mounted by updates. An arm that mounts into an already committed slot (an update that swaps an arm in) still gets a Block, because a lite arm needs a created owner. Its descendants' arms are lite.
  • Compiler strictness. The rule is deliberately strict: any bare-identifier call, such as String(x), cx(...) or t(...), keeps an arm on a Block. Loosening it is a follow-up, measured on real apps.
  • Devtools. Devtools that walk Blocks don't see lite arms, the same as lite components today.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

High Risk
Touches core control-flow mount, swap, rollback, and teardown in runtime.ts; behavior must stay identical to Block arms across Suspense, transitions, hydration, and keyed moves.

Overview
Hookless @if and @switch arms can now mount without allocating a control-flow Block. The compiler proves arms are “lite” with controlFlowArmIsLite and passes a lite mask into _$ifBlock / _$switchBlock; qualifying arms render in a lightweight Scope + LiteBlockImpl stand-in inside the owner’s render, skipping createBlock and per-arm render bookkeeping.

Runtime branch slots gain lite, shared teardown/swap paths (renderLiteArm, unmountLiteArm, deferRootArmReplacement / deferRootTeardown), and stricter when lite is allowed (fresh root render that created the owner—no hydration, signals, etc.). Arms that use hooks, @try, bare helper calls, or swap into an already-committed slot still get a Block; committed lite arms use the same staged rollback-safe swap as Block arms.

Tests add paired plain vs useRef scenarios (DOM, effects, refs, transitions, keyed lists, Activity, rollback) plus compiler proof cases for the lite mask. Profiling docs note lite arms are not block.create / block.unmount. Signal serialization tests use a MessageChannel host task in drain() for more stable async timing.

Reviewed by Cursor Bugbot for commit e7fb961. Bugbot is set up for automated code reviews on this repo. Configure here.

trueadm and others added 2 commits October 8, 2026 15:58
The compiler marks an @if/@switch arm lite when it calls no hook, use() or
context read, holds no @Try, and makes no bare-identifier call while it
renders. ifBlock and switchBlock take the mask. On a client mount under a root
render that created the arm's owner, a lite arm renders in a ScopeImpl with a
LiteBlockImpl stand-in that carries its bound the way an arm Block would, so
boundary sharing, journaling and staged swaps read one shape.

Teardown runs through the slot in tree order. A committed lite arm swaps out
through the staged root-render path, and its release waits for the commit.
Hydration, signal ownership, native reads and shared bodies keep Block arms.

Paired: recursive-context cold mount 0.970, partial remount cycle 0.900;
spa-navigation nav_mount 0.829, nav_deep 0.828.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Oct 8, 2026
@trueadm
trueadm marked this pull request as ready for review October 8, 2026 15:00

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: Ref attrs hide render-time hook calls
    • Changed the ref/event attribute handler to walk the value expression (detecting render-time hooks like useRef/useCallback) instead of returning false early, while still skipping direct function expression callback bodies.
  • ✅ Fixed: Lite proof misses wrapped callees
    • Added OptionalCallExpression to the call-type check and applied unwrapTsExpr to the callee before testing for Identifier, and added OptionalMemberExpression to the member-expression hook-name check.
  • ✅ Fixed: Nested arms lose real Block identity
    • Added parentOwner = owningBlock(parentBlock) in renderBranchSlot and used it for all disposed checks, currentRenderMode reads, and preservesCommittedSuspense calls so a LiteBlockImpl stand-in delegates to the nearest real Block.

Create PR

Or push these changes by commenting:

@cursor push a1c56e5e56
Preview (a1c56e5e56)
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
@@ -32908,11 +32908,11 @@
 				n.name === 'createPortal')
 		)
 			return true;
-		if (t === 'CallExpression') {
-			const callee = n.callee;
+		if (t === 'CallExpression' || t === 'OptionalCallExpression') {
+			const callee = unwrapTsExpr(n.callee);
 			if (callee?.type === 'Identifier') return true;
 			if (
-				callee?.type === 'MemberExpression' &&
+				(callee?.type === 'MemberExpression' || callee?.type === 'OptionalMemberExpression') &&
 				!callee.computed &&
 				callee.property?.type === 'Identifier' &&
 				/^use[A-Z]/.test(callee.property.name)
@@ -32921,7 +32921,15 @@
 		}
 		if (t === 'Attribute' || t === 'JSXAttribute') {
 			const name = n.name?.name ?? n.name;
-			if (typeof name === 'string' && (name === 'ref' || isEventAttrName(name))) return false;
+			if (typeof name === 'string' && (name === 'ref' || isEventAttrName(name))) {
+				// The callback body runs after render, but the value expression
+				// executes at render time: ref={useRef(null)} must be caught.
+				const val = n.value;
+				const expr = val?.type === 'JSXExpressionContainer' ? val.expression : val;
+				if (!expr || expr.type === 'ArrowFunctionExpression' || expr.type === 'FunctionExpression')
+					return false;
+				return reject(expr);
+			}
 		}
 		for (const k in n) {
 			if (AST_WALK_SKIP_KEYS.has(k)) continue;

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
@@ -45305,6 +45305,9 @@
 	lite?: boolean,
 ): void {
 	const parentBlock = parentScope.block;
+	// A lite arm's stand-in is not a Block: disposal and render-mode state live
+	// on the nearest real Block above it (owningBlock traversal).
+	const parentOwner = owningBlock(parentBlock);
 	const hydration = hydrating ? activeHydration() : null;
 	if (next !== state.branch) {
 		if (
@@ -45365,7 +45368,7 @@
 			}
 		}
 		const swapDriver = TRANSITION_SWAP_DRIVER;
-		const transitionMode = parentBlock.currentRenderMode === 'transition';
+		const transitionMode = parentOwner.currentRenderMode === 'transition';
 		const committedSuspense =
 			swapDriver !== null &&
 			state.block !== null &&
@@ -45373,7 +45376,7 @@
 			!state.unfinalized &&
 			body !== null &&
 			hydration === null &&
-			preservesCommittedSuspense(parentBlock);
+			preservesCommittedSuspense(parentOwner);
 		const transitionSwap =
 			ROOT_RENDER_TRANSACTION === null || committedSuspense ? swapDriver : null;
 		const suspenseSwap = !transitionMode && committedSuspense;
@@ -45393,7 +45396,7 @@
 			state.block = null;
 			state.unfinalized = false;
 			unmountBlock(pending, false);
-			if (parentBlock.disposed) return;
+			if (parentOwner.disposed) return;
 			while (node !== null && node !== provisionalAfter) {
 				const nextNode = getNextSibling(node);
 				if ((STAGED_DOM?.view(node) ?? node).parentNode === domParent)
@@ -45405,7 +45408,7 @@
 			provisionalAfter = state.lite.block.endMarker;
 			state.unfinalized = false;
 			unmountLiteArm(state, false);
-			if (parentBlock.disposed) return;
+			if (parentOwner.disposed) return;
 		}
 		// A markerless branch may share its host boundary with a nested sole-root
 		// branch. The nested branch updates Block markers when it replaces that
@@ -45631,7 +45634,7 @@
 							STAGED_DOM?.view(oldEnd as ChildNode | null) ?? (oldEnd as ChildNode | null)
 						)?.remove();
 					}
-					if (parentBlock.disposed || state.block !== r.wip.block || r.wip.block.disposed) return;
+					if (parentOwner.disposed || state.block !== r.wip.block || r.wip.block.disposed) return;
 					return;
 				}
 			}
@@ -45646,11 +45649,11 @@
 		const oldBoundaryShared = sharesBlockBoundary(parentBlock, oldBlockStart, oldBlockEnd);
 		if (state.block) {
 			unmountBlock(state.block);
-			if (parentBlock.disposed) return;
+			if (parentOwner.disposed) return;
 			state.block = null;
 		} else if (state.lite !== null) {
 			unmountLiteArm(state, true);
-			if (parentBlock.disposed) return;
+			if (parentOwner.disposed) return;
 		}
 		state.branch = next;
 		if (state.start === null && body !== null && oldBoundaryShared) {

You can send follow-ups to the cloud agent here.

Comment thread packages/octane/src/compiler/compile.js Resolved
Comment thread packages/octane/src/compiler/compile.js Resolved
Comment thread packages/octane/src/runtime.ts Resolved
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 54 value(s) increased
  • 🔴 bundle-reachability: 75 value(s) increased

Compares 9c440f4bd, the merge commit's first parent with f9b9e3cfe on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 3.375 3.275 −0.0% −5.4% … +3.3% ⚪ within noise
octane-tsrx replace 9.500 8.875 −6.6% −13.0% … +2.9% ⚪ within noise
octane-tsrx add 3.450 3.367 +6.0% −7.2% … +7.9% ⚪ within noise
octane-tsrx update 0.157 0.163 +1.4% −2.9% … +9.4% ⚪ within noise
octane-tsrx select 0.006 0.006 +0.6% −1.5% … +4.2% ⚪ within noise
octane-tsrx swap 0.040 0.040 −1.5% −4.4% … +5.2% ⚪ within noise
octane-tsrx remove 0.023 0.024 −4.4% −8.5% … +2.8% ⚪ within noise
octane-tsrx runlots 32.642 33.317 −1.7% −5.4% … +1.9% ⚪ within noise
octane-tsrx select_lots 0.008 0.008 −3.8% −8.7% … +0.2% ⚪ within noise
octane-tsrx clear 75.708 77.550 +6.0% −2.7% … +15.1% ⚪ within noise
octane-jsx run 5.992 6.092 −8.1% −14.3% … +12.7% ⚪ within noise
octane-jsx replace 13.525 14.475 −2.8% −11.5% … +10.1% ⚪ within noise
octane-jsx add 4.558 4.433 −0.0% −6.1% … +6.6% ⚪ within noise
octane-jsx update 0.430 0.415 +4.1% −4.0% … +9.6% ⚪ within noise
octane-jsx select 0.187 0.187 +5.5% −6.9% … +9.7% ⚪ within noise
octane-jsx swap 0.313 0.311 −0.6% −5.4% … +5.6% ⚪ within noise
octane-jsx remove 0.249 0.256 +2.3% −4.6% … +12.1% ⚪ within noise
octane-jsx runlots 43.658 42.033 +4.9% −5.0% … +10.8% ⚪ within noise
octane-jsx select_lots 4.212 4.135 −3.5% −16.5% … +14.6% ⚪ within noise
octane-jsx clear 114.492 110.408 −1.9% −14.2% … +5.9% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx js_raw 113,268 113,407 +139 (+0.1%) 🔴
octane-tsrx js_gzip 37,021 37,102 +81 (+0.2%) 🔴
octane-tsrx js_brotli 32,775 32,881 +106 (+0.3%) 🔴
octane-tsrx app_gzip 2,336 2,337 +1 (+0.0%) 🔴
octane-tsrx app_brotli 2,034 2,033 −1 (−0.0%) 🟢
octane-tsrx fw_raw 106,322 106,461 +139 (+0.1%) 🔴
octane-tsrx fw_gzip 34,685 34,765 +80 (+0.2%) 🔴
octane-tsrx fw_brotli 30,741 30,848 +107 (+0.3%) 🔴
octane-tsrx todo_js_raw 121,657 123,183 +1,526 (+1.3%) 🔴
octane-tsrx todo_js_gzip 39,853 40,390 +537 (+1.3%) 🔴
octane-tsrx todo_js_brotli 35,060 35,585 +525 (+1.5%) 🔴
octane-tsrx todo_app_raw 4,618 4,624 +6 (+0.1%) 🔴
octane-tsrx todo_app_gzip 2,219 2,221 +2 (+0.1%) 🔴
octane-tsrx todo_app_brotli 1,882 1,883 +1 (+0.1%) 🔴
octane-tsrx todo_fw_raw 117,039 118,559 +1,520 (+1.3%) 🔴
octane-tsrx todo_fw_gzip 37,634 38,169 +535 (+1.4%) 🔴
octane-tsrx todo_fw_brotli 33,178 33,702 +524 (+1.6%) 🔴
octane-tsrx chat_js_raw 120,406 121,926 +1,520 (+1.3%) 🔴
octane-tsrx chat_js_gzip 39,658 40,219 +561 (+1.4%) 🔴
octane-tsrx chat_js_brotli 35,001 35,486 +485 (+1.4%) 🔴
octane-tsrx chat_app_gzip 2,714 2,715 +1 (+0.0%) 🔴
octane-tsrx chat_app_brotli 2,388 2,391 +3 (+0.1%) 🔴
octane-tsrx chat_fw_raw 114,641 116,161 +1,520 (+1.3%) 🔴
octane-tsrx chat_fw_gzip 36,944 37,504 +560 (+1.5%) 🔴
octane-tsrx chat_fw_brotli 32,613 33,095 +482 (+1.5%) 🔴
octane-tsrx weather_js_raw 157,011 158,537 +1,526 (+1.0%) 🔴
octane-tsrx weather_js_gzip 51,057 51,582 +525 (+1.0%) 🔴
octane-tsrx weather_js_brotli 44,587 45,071 +484 (+1.1%) 🔴
octane-tsrx weather_app_raw 22,154 22,160 +6 (+0.0%) 🔴
octane-tsrx weather_app_gzip 7,872 7,873 +1 (+0.0%) 🔴
octane-tsrx weather_app_brotli 6,663 6,679 +16 (+0.2%) 🔴
octane-tsrx weather_fw_raw 134,857 136,377 +1,520 (+1.1%) 🔴
octane-tsrx weather_fw_gzip 43,185 43,709 +524 (+1.2%) 🔴
octane-tsrx weather_fw_brotli 37,924 38,392 +468 (+1.2%) 🔴
octane-tsrx bindings_js_raw 690,612 692,142 +1,530 (+0.2%) 🔴
octane-tsrx bindings_js_gzip 225,751 226,274 +523 (+0.2%) 🔴
octane-tsrx bindings_js_brotli 191,847 192,469 +622 (+0.3%) 🔴
octane-tsrx bindings_app_gzip 115,666 115,667 +1 (+0.0%) 🔴
octane-tsrx bindings_app_brotli 96,169 96,223 +54 (+0.1%) 🔴
octane-tsrx bindings_fw_raw 342,974 344,504 +1,530 (+0.4%) 🔴
octane-tsrx bindings_fw_gzip 110,085 110,607 +522 (+0.5%) 🔴
octane-tsrx bindings_fw_brotli 95,678 96,246 +568 (+0.6%) 🔴
octane-tsrx full_fw_raw 570,837 572,421 +1,584 (+0.3%) 🔴
octane-tsrx full_fw_gzip 172,263 172,842 +579 (+0.3%) 🔴
octane-tsrx full_fw_brotli 144,782 145,331 +549 (+0.4%) 🔴
octane-jsx js_raw 187,845 188,000 +155 (+0.1%) 🔴
octane-jsx js_gzip 59,661 59,771 +110 (+0.2%) 🔴
octane-jsx js_brotli 51,917 51,989 +72 (+0.1%) 🔴
octane-jsx app_gzip 2,859 2,858 −1 (−0.0%) 🟢
octane-jsx app_brotli 2,407 2,410 +3 (+0.1%) 🔴
octane-jsx fw_raw 179,580 179,735 +155 (+0.1%) 🔴
octane-jsx fw_gzip 56,802 56,913 +111 (+0.2%) 🔴
octane-jsx fw_brotli 49,510 49,579 +69 (+0.1%) 🔴
octane-jsx full_fw_raw 570,837 572,421 +1,584 (+0.3%) 🔴
octane-jsx full_fw_gzip 172,263 172,842 +579 (+0.3%) 🔴
octane-jsx full_fw_brotli 144,782 145,331 +549 (+0.4%) 🔴

4 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
cli-spa-starter raw 102,316 102,457 +141 (+0.1%) 🔴
cli-spa-starter gzip 34,145 34,234 +89 (+0.3%) 🔴
cli-spa-starter brotli 30,063 30,081 +18 (+0.1%) 🔴
root-static-specialized raw 72,950 73,089 +139 (+0.2%) 🔴
root-static-specialized gzip 23,998 24,085 +87 (+0.4%) 🔴
root-static-specialized brotli 21,453 21,532 +79 (+0.4%) 🔴
root-chained-jsx raw 74,827 74,966 +139 (+0.2%) 🔴
root-chained-jsx gzip 24,488 24,569 +81 (+0.3%) 🔴
root-chained-jsx brotli 21,900 22,020 +120 (+0.5%) 🔴
root-static raw 165,663 165,818 +155 (+0.1%) 🔴
root-static gzip 52,417 52,520 +103 (+0.2%) 🔴
root-static brotli 45,657 45,756 +99 (+0.2%) 🔴
root-static-local raw 72,949 73,088 +139 (+0.2%) 🔴
root-static-local gzip 23,984 24,071 +87 (+0.4%) 🔴
root-static-local brotli 21,458 21,538 +80 (+0.4%) 🔴
root-callback-local raw 74,853 74,992 +139 (+0.2%) 🔴
root-callback-local gzip 24,498 24,564 +66 (+0.3%) 🔴
root-callback-local brotli 21,970 22,032 +62 (+0.3%) 🔴
hooks-state raw 84,671 84,810 +139 (+0.2%) 🔴
hooks-state gzip 27,926 28,011 +85 (+0.3%) 🔴
hooks-state brotli 24,903 25,014 +111 (+0.4%) 🔴
prop-attributes raw 84,924 85,063 +139 (+0.2%) 🔴
prop-attributes gzip 27,939 28,022 +83 (+0.3%) 🔴
prop-attributes brotli 24,915 25,056 +141 (+0.6%) 🔴
context raw 96,856 96,995 +139 (+0.1%) 🔴
context gzip 31,625 31,720 +95 (+0.3%) 🔴
context brotli 28,135 28,190 +55 (+0.2%) 🔴
hydrate-root raw 138,323 138,462 +139 (+0.1%) 🔴
hydrate-root gzip 44,371 44,436 +65 (+0.1%) 🔴
hydrate-root brotli 38,877 38,899 +22 (+0.1%) 🔴
deferred-hydration raw 221,680 221,819 +139 (+0.1%) 🔴
deferred-hydration gzip 69,935 70,027 +92 (+0.1%) 🔴
deferred-hydration brotli 60,307 60,399 +92 (+0.2%) 🔴
hydrate-frame raw 366,260 367,796 +1,536 (+0.4%) 🔴
hydrate-frame gzip 113,719 114,295 +576 (+0.5%) 🔴
hydrate-frame brotli 97,245 97,665 +420 (+0.4%) 🔴
suspense-transition raw 143,502 143,641 +139 (+0.1%) 🔴
suspense-transition gzip 45,507 45,577 +70 (+0.2%) 🔴
suspense-transition brotli 39,940 40,006 +66 (+0.2%) 🔴
component-owned-effects raw 77,310 77,449 +139 (+0.2%) 🔴
component-owned-effects gzip 25,317 25,394 +77 (+0.3%) 🔴
component-owned-effects brotli 22,629 22,748 +119 (+0.5%) 🔴
binding-hooks raw 83,169 83,308 +139 (+0.2%) 🔴
binding-hooks gzip 27,586 27,646 +60 (+0.2%) 🔴
binding-hooks brotli 24,600 24,712 +112 (+0.5%) 🔴
binding-base-ui-vite raw 201,517 201,672 +155 (+0.1%) 🔴
binding-base-ui-vite gzip 63,514 63,606 +92 (+0.1%) 🔴
binding-base-ui-vite brotli 55,189 55,320 +131 (+0.2%) 🔴
binding-base-ui-esbuild raw 217,053 217,208 +155 (+0.1%) 🔴
binding-base-ui-esbuild gzip 70,453 70,542 +89 (+0.1%) 🔴
binding-base-ui-esbuild brotli 61,212 61,236 +24 (+0.0%) 🔴
binding-radix-vite raw 203,589 203,744 +155 (+0.1%) 🔴
binding-radix-vite gzip 64,104 64,224 +120 (+0.2%) 🔴
binding-radix-vite brotli 55,830 55,873 +43 (+0.1%) 🔴
binding-radix-esbuild raw 218,914 219,069 +155 (+0.1%) 🔴
binding-radix-esbuild gzip 71,048 71,156 +108 (+0.2%) 🔴
binding-radix-esbuild brotli 61,721 61,884 +163 (+0.3%) 🔴
binding-mantine-hooks-vite raw 86,765 86,904 +139 (+0.2%) 🔴
binding-mantine-hooks-vite gzip 28,562 28,626 +64 (+0.2%) 🔴
binding-mantine-hooks-vite brotli 25,516 25,580 +64 (+0.3%) 🔴
binding-mantine-hooks-esbuild raw 91,148 91,287 +139 (+0.2%) 🔴
binding-mantine-hooks-esbuild gzip 30,728 30,807 +79 (+0.3%) 🔴
binding-mantine-hooks-esbuild brotli 27,360 27,446 +86 (+0.3%) 🔴
binding-apollo-client-vite raw 344,009 344,164 +155 (+0.0%) 🔴
binding-apollo-client-vite gzip 105,815 105,927 +112 (+0.1%) 🔴
binding-apollo-client-vite brotli 92,295 92,521 +226 (+0.2%) 🔴
binding-apollo-client-esbuild raw 367,240 367,395 +155 (+0.0%) 🔴
binding-apollo-client-esbuild gzip 116,790 116,904 +114 (+0.1%) 🔴
binding-apollo-client-esbuild brotli 101,930 102,073 +143 (+0.1%) 🔴
binding-usehooks-ts-vite raw 87,535 87,674 +139 (+0.2%) 🔴
binding-usehooks-ts-vite gzip 28,789 28,875 +86 (+0.3%) 🔴
binding-usehooks-ts-vite brotli 25,727 25,799 +72 (+0.3%) 🔴
binding-usehooks-ts-esbuild raw 91,922 92,061 +139 (+0.2%) 🔴
binding-usehooks-ts-esbuild gzip 30,978 31,057 +79 (+0.3%) 🔴
binding-usehooks-ts-esbuild brotli 27,658 27,690 +32 (+0.1%) 🔴

36 other measured values are unchanged.

trueadm and others added 4 commits October 8, 2026 16:31
The same-arm path for a lite arm skipped the arm.keep probe. The profile
docs and test now say a hookless arm mounted with its owner is not a
Block, so a swap tears one down only once an update has mounted a Block
arm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-arms

# Conflicts:
#	packages/octane/src/runtime.ts
… off lite arms

The lite-arm proof skipped every ref and on* attribute value, so
ref={useRef(null)} or onClick={useCallback(...)} marked an arm hookless.
It now skips only an inline callback. A callee behind a TS cast, !, ?.
or a comma, a bare tag, and helper.call/apply also keep an arm on a Block.

Core slot teardown reaches unmountLiteArm through a hook that the lite
mount installs, so a root without control flow carries none of the lite
teardown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Disposed check misses lite parents
    • Computed owningBlock(parentBlock) once per swap in renderBranchSlot and replaced all 5 parentBlock.disposed checks with disposeTarget.disposed, so the guard correctly reads the real Block's disposed flag when the parent is a LiteBlockImpl stand-in.
  • ✅ Fixed: Return slot skips lite retirement
    • Added state.lite?.block to the retiredBlock chain in disposeReturnSlot so a return-owned lite arm's stand-in is retired via retireRootBlock before the deferred unmountSlot cleanup, matching the swap path's deferRootArmReplacement behavior.

Create PR

Or push these changes by commenting:

@cursor push 6df886d59a
Preview (6df886d59a)
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
@@ -12829,7 +12829,7 @@
 					: (STAGED_DOM?.view(parent) ?? parent).lastChild,
 			borrowed ? end : ((STAGED_DOM?.view(last) ?? last)?.nextSibling ?? null),
 		);
-		const retiredBlock = state.block ?? state.portal?.block;
+		const retiredBlock = state.block ?? state.lite?.block ?? state.portal?.block;
 		if (retiredBlock != null) retireRootBlock(retiredBlock);
 		if (state.forSlot != null) {
 			for (let item = state.forSlot.head; item !== null; item = item.nextSibling) {
@@ -45524,6 +45524,7 @@
 			}
 		}
 		const swapDriver = TRANSITION_SWAP_DRIVER;
+		const disposeTarget = owningBlock(parentBlock);
 		const transitionMode = parentBlock.currentRenderMode === 'transition';
 		const committedSuspense =
 			swapDriver !== null &&
@@ -45552,7 +45553,7 @@
 			state.block = null;
 			state.unfinalized = false;
 			unmountBlock(pending, false);
-			if (parentBlock.disposed) return;
+			if (disposeTarget.disposed) return;
 			while (node !== null && node !== provisionalAfter) {
 				const nextNode = getNextSibling(node);
 				if ((STAGED_DOM?.view(node) ?? node).parentNode === domParent)
@@ -45564,7 +45565,7 @@
 			provisionalAfter = state.lite.block.endMarker;
 			state.unfinalized = false;
 			unmountLiteArm(state, false);
-			if (parentBlock.disposed) return;
+			if (disposeTarget.disposed) return;
 		}
 		// A markerless branch may share its host boundary with a nested sole-root
 		// branch. The nested branch updates Block markers when it replaces that
@@ -45790,7 +45791,7 @@
 							STAGED_DOM?.view(oldEnd as ChildNode | null) ?? (oldEnd as ChildNode | null)
 						)?.remove();
 					}
-					if (parentBlock.disposed || state.block !== r.wip.block || r.wip.block.disposed) return;
+					if (disposeTarget.disposed || state.block !== r.wip.block || r.wip.block.disposed) return;
 					return;
 				}
 			}
@@ -45805,11 +45806,11 @@
 		const oldBoundaryShared = sharesBlockBoundary(parentBlock, oldBlockStart, oldBlockEnd);
 		if (state.block) {
 			unmountBlock(state.block);
-			if (parentBlock.disposed) return;
+			if (disposeTarget.disposed) return;
 			state.block = null;
 		} else if (state.lite !== null) {
 			unmountLiteArm(state, true);
-			if (parentBlock.disposed) return;
+			if (disposeTarget.disposed) return;
 		}
 		state.branch = next;
 		if (state.start === null && body !== null && oldBoundaryShared) {

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit dc4812a. Configure here.

Comment thread packages/octane/src/runtime.ts Resolved
Comment thread packages/octane/src/runtime.ts Resolved
…posal

disposeReturnSlot already read a lite arm's bound for the deferred range;
it now retires the arm's stand-in as well, as deferRootArmReplacement
does, so queued renders under it stop with the slot. The post-teardown
checks in renderBranchSlot read disposal from the owning Block, since a
lite stand-in has none of its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website ff9487b Commit Preview URL

Branch Preview URL
Oct 08 2026, 07:28 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp ff9487b Commit Preview URL

Branch Preview URL
Oct 08 2026, 07:30 PM

trueadm and others added 4 commits October 8, 2026 20:08
unmountLiteArm copied deferRootUnmount's node collection, rollback
restore and commit-time reconnect. Both now call deferRootTeardown with
their own release (unmountBlock or releaseLiteArm, passed by reference
so core teardown never names the lite path), and a lite arm's immediate
detach uses removeRange after its cleanups, as unmountBlock does.

Control-flow bundles shrink by about 500 B raw (hydrate-frame -517 raw,
-145 gzip); a root without control flow pays +57 raw for the extra call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since #1875 a ready producer whose shared 5 ms host budget is spent waits
for a host task (yieldForHostBudget). drain() only awaited microtasks, so
on a loaded CI shard the stream-query adoption tests saw result$.get()
throw its pending promise. drain() now lets a host task run after each
microtask checkpoint. With the budget forced to 1e-9 ms (one unit per
window), the old drain fails both stream cases and the new one passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm merged commit 6e6aa98 into main Oct 8, 2026
30 checks passed
@trueadm
trueadm deleted the fix/lite-control-flow-arms branch October 8, 2026 20:27
@github-actions github-actions Bot mentioned this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant