Skip to content

fix(octane): commit custom host props before connecting the slot - #2085

Closed
domgan-oai wants to merge 11 commits into
octanejs:nextfrom
openai-oss-forks:codex/next-custom-host-commit
Closed

domgan-oai wants to merge 11 commits into
octanejs:nextfrom
openai-oss-forks:codex/next-custom-host-commit

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A fresh custom element created by a host descriptor could connect after its initial setter synchronously unmounted the root, or connect before its initial attributes were visible. Prepare the initial props during render and apply them at commit immediately before the exact fragment or compiled single-host row connects, after outgoing deletion cleanup. Replacing or disposing the root cancels the rest of that commit. A caught render can leave an abandoned host's queued order behind, so commit clears the matching order and skips it if its owner was disposed.

The compiler enables this handling for literal custom tags and tags that can be dynamic. Proven native tags, immutable local function components and Octane boundaries do not enable it; public element factories remain conservative. Each fresh fragment or row owns its own receipt, so ordinary list rows make no additional callback calls. The root-generation check remains general because ordinary cleanup callbacks can also replace a root.

Validation

  • Regression coverage includes focus/selection restoration, initial attributes visible in connectedCallback, reentrant unmount/root replacement, async abort/retry with retained native input identity and draft, and a caught render that discards one custom host while another commits. The latter failed in both development and production before the disposed-owner check; 212 targeted tests passed after it.
  • The production Oxc reachability gate executes a compiled-only root and a native JSX root with the receipt writer removed, plus a custom JSX positive control that retains it and reads its initial attribute on connection. The separate esbuild whole-app measurements are below.
  • Runtime module layout and synthesized-runtime checks pass. Scoped typecheck, formatting, and performance review pass. 146 focused runtime, hydration, focus and compiler tests passed; 8 mixed-renderer HMR cases passed in development and production. The separate universal-renderer test typecheck has 62 normalized diagnostics on both the reviewed head and the preceding revision; shipped source and the compiler test pass scoped typecheck.
  • Matched local Chromium comparison on 82d615210 (30 alternating pairs, fixed base and production builds): all 64 work metrics were identical. TSRX selection sampled +2.3% (95% CI +1.2% to +4.0%); the other 19 timing intervals included parity. The final discarded-owner check adds a descriptor-commit branch, so this pre-fix comparison does not establish final-head timing.
  • The website router-identity test now waits for its post-hydration client effect instead of global network idle plus a fixed delay. Both preceding failed CI snapshots already contained that effect output; the router-event and DOM-identity assertions are unchanged. The focused Chromium test passed. Standalone scoped typechecking reports the same four pre-existing diagnostics as the prior revision.
  • Current-head hosted benchmark passed: all 64 work counters were unchanged and none of the 20 timings crossed the report's ±3% verdict threshold. Two JSX intervals excluded parity but overlapped that threshold: update +8.8% (95% CI +1.6% to +19.2%) and remove +6.5% (+1.8% to +11.0%). These samples do not establish unchanged performance.
  • Current-head CI passed; all 30 PR checks succeeded, including website integration, real Chromium, all test and React parity shards, bundle, lint, types, packages, and provenance.

Whole production JavaScript, gzip level 9; every emitted JS asset is counted. Each three-way comparison uses frozen source snapshots and the same fixture/dependency/toolchain within that row, with source-map provenance checked. Baseline is fixed next ee7d52073, previous is 82d615210, and current production source is 38fce06e4 (unchanged in 9739a18a0; its only later change is the website test).

Bundle Baseline gzip Previous delta Current delta
JS Framework TSRX / Oxc 30,963 B +97 B +97 B
JS Framework JSX / Oxc 54,704 B +172 B +178 B
JS Framework TSRX / esbuild 36,020 B +90 B +90 B
JS Framework JSX / esbuild 64,000 B +188 B +195 B
Threadline / Oxc 52,807 B +91 B +91 B
Threadline / esbuild 59,760 B +86 B +86 B
Pagecraft / Oxc 171,111 B +309 B +313 B
Pagecraft / esbuild 186,328 B +339 B +347 B

The hosted benchmark separately compared the current PR merge against next 5370a3161: JS Framework Oxc TSRX +96 B and JSX +160 B; Threadline Oxc +93 B / esbuild +87 B; Pagecraft Oxc +323 B / esbuild +323 B. Bindings grew +391 B, Wayfinder +162 B, Todo +95 B, Chat +90 B, and Weather +94 B. Its baseline and toolchain differ from the controlled local table.

The requested ~100 B ceiling is still exceeded by JSX and Pagecraft. Pagecraft's Lexical integration calls public createElement(props.ErrorBoundary, ...), whose runtime value can be a host, so it conservatively retains the writer. General cancellation and connection-point checks remain shared correctness costs. The reachability gate proves Oxc exclusion for its measured fixtures, not esbuild exclusion or zero cost for every application.

Origin: Codex task · host com-79386


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


Note

High Risk
Changes core commit/deopt timing for custom elements and root-generation cancellation during DOM insertion—easy to regress hydration, lists, and reentrant unmount behavior.

Overview
Fixes custom-element host descriptors so initial attributes and props are applied at commit time immediately before the host is inserted, instead of while the node is still off-document. That way connectedCallback sees the right initial state, and a setter that synchronously unmounts or replaces the root does not leave a stale host connected afterward.

Adds an opt-in enableDescriptorCustomHosts path (descriptorCustomHosts / prepareFrontierHost with $$initialHosts receipts on slot frontiers, list runs, and placeRoots). Commit now bails out when the committing root’s generation changes or a disposed owner abandons a queued order. The compiler turns the capability on for dynamic or custom tags (and spreads); proven native tags and immutable components can omit it from bundles.

Tests and benchmarks add anchorless-host custom-element scenarios, compiler capability coverage, and minimal JSX fixtures that prove the queueFrontierHost writer is dropped or retained via the bundle reachability gate. The SSR hydration e2e waits on the homepage effect log instead of a fixed post–network-idle delay before the first router event.

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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 15, 2026
@github-actions
github-actions Bot marked this pull request as draft October 15, 2026 12:35

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/octane/src/runtime.ts Resolved
@trueadm
trueadm marked this pull request as ready for review October 15, 2026 12:43
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 76 value(s) increased
  • 🔴 bundle-reachability: 84 value(s) increased

Compares 5370a3161, the merge commit's first parent (main has moved 6 commit(s) past the pull request's recorded base ee7d52073) with b5a42e258 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 4.050 4.025 ±0.0% −5.4% … +7.4% ⚪ within noise
octane-tsrx replace 9.975 9.967 +5.5% −6.4% … +12.5% ⚪ within noise
octane-tsrx add 3.767 3.508 −2.0% −10.9% … +16.0% ⚪ within noise
octane-tsrx update 0.146 0.149 −0.2% −7.0% … +3.2% ⚪ within noise
octane-tsrx select 0.009 0.009 −0.8% −2.6% … +4.3% ⚪ within noise
octane-tsrx swap 0.028 0.030 +1.9% −6.9% … +5.3% ⚪ within noise
octane-tsrx remove 0.029 0.030 +2.9% −3.4% … +9.9% ⚪ within noise
octane-tsrx runlots 37.050 37.483 −1.9% −10.6% … +5.9% ⚪ within noise
octane-tsrx select_lots 0.010 0.009 −3.3% −10.3% … +1.9% ⚪ within noise
octane-tsrx clear 82.950 82.925 +1.4% −3.5% … +5.6% ⚪ within noise
octane-jsx run 6.675 5.867 −3.1% −14.1% … +0.9% ⚪ within noise
octane-jsx replace 12.000 13.258 +6.6% −1.5% … +18.0% ⚪ within noise
octane-jsx add 4.967 5.117 +3.3% −3.3% … +5.4% ⚪ within noise
octane-jsx update 0.238 0.284 +8.8% +1.6% … +19.2% ⚪ within noise
octane-jsx select 0.140 0.117 −3.1% −15.5% … +1.4% ⚪ within noise
octane-jsx swap 0.209 0.215 +5.2% −1.9% … +22.5% ⚪ within noise
octane-jsx remove 0.182 0.196 +6.5% +1.8% … +11.0% ⚪ within noise
octane-jsx runlots 42.358 42.442 −0.9% −8.1% … +9.3% ⚪ within noise
octane-jsx select_lots 1.770 1.693 −3.3% −22.4% … +6.4% ⚪ within noise
octane-jsx clear 70.625 68.400 +4.9% −3.5% … +9.2% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx js_raw 93,565 93,777 +212 (+0.2%) 🔴
octane-tsrx js_gzip 31,333 31,429 +96 (+0.3%) 🔴
octane-tsrx js_brotli 28,287 28,360 +73 (+0.3%) 🔴
octane-tsrx app_gzip 2,617 2,615 −2 (−0.1%) 🟢
octane-tsrx app_brotli 2,268 2,269 +1 (+0.0%) 🔴
octane-tsrx fw_raw 86,009 86,221 +212 (+0.2%) 🔴
octane-tsrx fw_gzip 28,716 28,814 +98 (+0.3%) 🔴
octane-tsrx fw_brotli 26,019 26,091 +72 (+0.3%) 🔴
octane-tsrx todo_js_raw 106,404 106,616 +212 (+0.2%) 🔴
octane-tsrx todo_js_gzip 35,995 36,090 +95 (+0.3%) 🔴
octane-tsrx todo_js_brotli 32,203 32,304 +101 (+0.3%) 🔴
octane-tsrx todo_app_gzip 2,779 2,780 +1 (+0.0%) 🔴
octane-tsrx todo_app_brotli 2,336 2,321 −15 (−0.6%) 🟢
octane-tsrx todo_fw_raw 100,163 100,375 +212 (+0.2%) 🔴
octane-tsrx todo_fw_gzip 33,216 33,310 +94 (+0.3%) 🔴
octane-tsrx todo_fw_brotli 29,867 29,983 +116 (+0.4%) 🔴
octane-tsrx chat_js_raw 105,255 105,467 +212 (+0.2%) 🔴
octane-tsrx chat_js_gzip 35,732 35,822 +90 (+0.3%) 🔴
octane-tsrx chat_js_brotli 32,031 32,167 +136 (+0.4%) 🔴
octane-tsrx chat_app_brotli 2,797 2,798 +1 (+0.0%) 🔴
octane-tsrx chat_fw_raw 98,114 98,326 +212 (+0.2%) 🔴
octane-tsrx chat_fw_gzip 32,522 32,612 +90 (+0.3%) 🔴
octane-tsrx chat_fw_brotli 29,234 29,369 +135 (+0.5%) 🔴
octane-tsrx weather_js_raw 143,023 143,235 +212 (+0.1%) 🔴
octane-tsrx weather_js_gzip 47,339 47,433 +94 (+0.2%) 🔴
octane-tsrx weather_js_brotli 42,040 42,000 −40 (−0.1%) 🟢
octane-tsrx weather_app_brotli 7,329 7,328 −1 (−0.0%) 🟢
octane-tsrx weather_fw_raw 117,936 118,148 +212 (+0.2%) 🔴
octane-tsrx weather_fw_gzip 38,715 38,809 +94 (+0.2%) 🔴
octane-tsrx weather_fw_brotli 34,711 34,672 −39 (−0.1%) 🟢
octane-tsrx bindings_js_raw 685,281 686,453 +1,172 (+0.2%) 🔴
octane-tsrx bindings_js_gzip 226,456 226,847 +391 (+0.2%) 🔴
octane-tsrx bindings_js_brotli 192,857 193,048 +191 (+0.1%) 🔴
octane-tsrx bindings_app_raw 354,182 354,313 +131 (+0.0%) 🔴
octane-tsrx bindings_app_gzip 116,965 116,997 +32 (+0.0%) 🔴
octane-tsrx bindings_app_brotli 97,156 96,986 −170 (−0.2%) 🟢
octane-tsrx bindings_fw_raw 331,099 332,140 +1,041 (+0.3%) 🔴
octane-tsrx bindings_fw_gzip 109,491 109,850 +359 (+0.3%) 🔴
octane-tsrx bindings_fw_brotli 95,701 96,062 +361 (+0.4%) 🔴
octane-tsrx wayfinder_js_raw 438,267 438,714 +447 (+0.1%) 🔴
octane-tsrx wayfinder_js_gzip 144,544 144,706 +162 (+0.1%) 🔴
octane-tsrx wayfinder_js_brotli 126,167 126,233 +66 (+0.1%) 🔴
octane-tsrx threadline_oxc_js_raw 160,616 160,828 +212 (+0.1%) 🔴
octane-tsrx threadline_oxc_js_gzip 52,860 52,953 +93 (+0.2%) 🔴
octane-tsrx threadline_oxc_js_brotli 46,455 46,509 +54 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_raw 178,635 178,847 +212 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_gzip 59,796 59,883 +87 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_brotli 52,629 52,565 −64 (−0.1%) 🟢
octane-tsrx pagecraft_oxc_js_raw 544,561 545,599 +1,038 (+0.2%) 🔴
octane-tsrx pagecraft_oxc_js_gzip 171,281 171,604 +323 (+0.2%) 🔴
octane-tsrx pagecraft_oxc_js_brotli 145,353 145,672 +319 (+0.2%) 🔴
octane-tsrx pagecraft_esbuild_js_raw 577,018 578,076 +1,058 (+0.2%) 🔴
octane-tsrx pagecraft_esbuild_js_gzip 186,569 186,892 +323 (+0.2%) 🔴
octane-tsrx pagecraft_esbuild_js_brotli 158,588 158,871 +283 (+0.2%) 🔴
octane-tsrx full_fw_raw 522,733 523,802 +1,069 (+0.2%) 🔴
octane-tsrx full_fw_gzip 163,178 163,593 +415 (+0.3%) 🔴
octane-tsrx full_fw_brotli 138,796 139,222 +426 (+0.3%) 🔴
octane-jsx js_raw 169,120 169,565 +445 (+0.3%) 🔴
octane-jsx js_gzip 55,100 55,260 +160 (+0.3%) 🔴
octane-jsx js_brotli 48,603 48,721 +118 (+0.2%) 🔴
octane-jsx app_gzip 3,581 3,580 −1 (−0.0%) 🟢
octane-jsx fw_raw 158,061 158,506 +445 (+0.3%) 🔴
octane-jsx fw_gzip 51,519 51,680 +161 (+0.3%) 🔴
octane-jsx fw_brotli 45,714 45,832 +118 (+0.3%) 🔴
octane-jsx shell_js_raw 327,113 328,164 +1,051 (+0.3%) 🔴
octane-jsx shell_js_gzip 106,589 106,878 +289 (+0.3%) 🔴
octane-jsx shell_js_brotli 92,500 92,851 +351 (+0.4%) 🔴
octane-jsx shell_app_raw 1,093 1,107 +14 (+1.3%) 🔴
octane-jsx shell_app_gzip 761 771 +10 (+1.3%) 🔴
octane-jsx shell_app_brotli 656 673 +17 (+2.6%) 🔴
octane-jsx shell_fw_raw 326,020 327,057 +1,037 (+0.3%) 🔴
octane-jsx shell_fw_gzip 105,828 106,107 +279 (+0.3%) 🔴
octane-jsx shell_fw_brotli 91,844 92,178 +334 (+0.4%) 🔴
octane-jsx shell_client_js_raw 278,558 279,610 +1,052 (+0.4%) 🔴
octane-jsx shell_client_js_gzip 90,186 90,542 +356 (+0.4%) 🔴
octane-jsx shell_client_js_brotli 78,867 79,183 +316 (+0.4%) 🔴
octane-jsx shell_client_app_raw 1,101 1,115 +14 (+1.3%) 🔴
octane-jsx shell_client_app_gzip 773 782 +9 (+1.2%) 🔴
octane-jsx shell_client_fw_raw 277,457 278,495 +1,038 (+0.4%) 🔴
octane-jsx shell_client_fw_gzip 89,413 89,760 +347 (+0.4%) 🔴
octane-jsx shell_client_fw_brotli 78,198 78,514 +316 (+0.4%) 🔴
octane-jsx full_fw_raw 522,733 523,802 +1,069 (+0.2%) 🔴
octane-jsx full_fw_gzip 163,178 163,593 +415 (+0.3%) 🔴
octane-jsx full_fw_brotli 138,796 139,222 +426 (+0.3%) 🔴

9 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
cli-spa-starter raw 85,850 86,062 +212 (+0.2%) 🔴
cli-spa-starter gzip 29,525 29,607 +82 (+0.3%) 🔴
cli-spa-starter brotli 26,430 26,485 +55 (+0.2%) 🔴
root-static-specialized raw 57,141 57,352 +211 (+0.4%) 🔴
root-static-specialized gzip 19,381 19,448 +67 (+0.3%) 🔴
root-static-specialized brotli 17,642 17,698 +56 (+0.3%) 🔴
root-chained-jsx raw 59,282 59,493 +211 (+0.4%) 🔴
root-chained-jsx gzip 20,097 20,160 +63 (+0.3%) 🔴
root-chained-jsx brotli 18,313 18,360 +47 (+0.3%) 🔴
root-static raw 144,698 145,143 +445 (+0.3%) 🔴
root-static gzip 47,262 47,422 +160 (+0.3%) 🔴
root-static brotli 42,074 42,235 +161 (+0.4%) 🔴
root-static-local raw 57,040 57,251 +211 (+0.4%) 🔴
root-static-local gzip 19,335 19,402 +67 (+0.3%) 🔴
root-static-local brotli 17,607 17,671 +64 (+0.4%) 🔴
root-callback-local raw 59,700 59,911 +211 (+0.4%) 🔴
root-callback-local gzip 20,180 20,251 +71 (+0.4%) 🔴
root-callback-local brotli 18,362 18,423 +61 (+0.3%) 🔴
hooks-state raw 68,052 68,264 +212 (+0.3%) 🔴
hooks-state gzip 23,027 23,109 +82 (+0.4%) 🔴
hooks-state brotli 20,913 20,965 +52 (+0.2%) 🔴
prop-attributes raw 65,155 65,366 +211 (+0.3%) 🔴
prop-attributes gzip 22,148 22,235 +87 (+0.4%) 🔴
prop-attributes brotli 20,224 20,213 −11 (−0.1%) 🟢
context raw 75,147 75,359 +212 (+0.3%) 🔴
context gzip 25,196 25,275 +79 (+0.3%) 🔴
context brotli 22,786 22,837 +51 (+0.2%) 🔴
hydrate-root raw 96,114 96,326 +212 (+0.2%) 🔴
hydrate-root gzip 32,328 32,406 +78 (+0.2%) 🔴
hydrate-root brotli 28,834 28,893 +59 (+0.2%) 🔴
deferred-hydration raw 180,118 180,330 +212 (+0.1%) 🔴
deferred-hydration gzip 58,700 58,783 +83 (+0.1%) 🔴
deferred-hydration brotli 51,291 51,302 +11 (+0.0%) 🔴
hydrate-frame raw 340,353 340,799 +446 (+0.1%) 🔴
hydrate-frame gzip 109,246 109,374 +128 (+0.1%) 🔴
hydrate-frame brotli 94,858 94,949 +91 (+0.1%) 🔴
suspense-transition raw 119,986 120,198 +212 (+0.2%) 🔴
suspense-transition gzip 39,214 39,296 +82 (+0.2%) 🔴
suspense-transition brotli 34,862 34,903 +41 (+0.1%) 🔴
component-owned-effects raw 61,227 61,438 +211 (+0.3%) 🔴
component-owned-effects gzip 20,722 20,780 +58 (+0.3%) 🔴
component-owned-effects brotli 18,872 18,928 +56 (+0.3%) 🔴
descriptor-children raw 166,432 167,465 +1,033 (+0.6%) 🔴
descriptor-children gzip 54,004 54,335 +331 (+0.6%) 🔴
descriptor-children brotli 47,999 48,255 +256 (+0.5%) 🔴
descriptor-native-jsx raw – 144,173 – 🆕
descriptor-native-jsx gzip – 47,049 – 🆕
descriptor-native-jsx brotli – 41,919 – 🆕
descriptor-custom-jsx raw – 145,000 – 🆕
descriptor-custom-jsx gzip – 47,321 – 🆕
descriptor-custom-jsx brotli – 42,149 – 🆕
binding-hooks raw 70,453 70,665 +212 (+0.3%) 🔴
binding-hooks gzip 24,047 24,129 +82 (+0.3%) 🔴
binding-hooks brotli 21,806 21,845 +39 (+0.2%) 🔴
split-shell raw 391,235 391,682 +447 (+0.1%) 🔴
split-shell gzip 127,365 127,542 +177 (+0.1%) 🔴
split-shell brotli 111,020 111,148 +128 (+0.1%) 🔴
split-shell-runtime raw 316,020 316,467 +447 (+0.1%) 🔴
split-shell-runtime gzip 101,596 101,776 +180 (+0.2%) 🔴
split-shell-runtime brotli 87,819 87,979 +160 (+0.2%) 🔴
binding-base-ui-vite raw 176,955 177,987 +1,032 (+0.6%) 🔴
binding-base-ui-vite gzip 57,602 57,919 +317 (+0.6%) 🔴
binding-base-ui-vite brotli 51,063 51,399 +336 (+0.7%) 🔴
binding-base-ui-esbuild raw 198,369 199,412 +1,043 (+0.5%) 🔴
binding-base-ui-esbuild gzip 66,596 66,968 +372 (+0.6%) 🔴
binding-base-ui-esbuild brotli 58,895 59,076 +181 (+0.3%) 🔴
binding-aria-esbuild brotli 2,645 2,646 +1 (+0.0%) 🔴
binding-radix-vite raw 176,391 177,423 +1,032 (+0.6%) 🔴
binding-radix-vite gzip 57,263 57,578 +315 (+0.6%) 🔴
binding-radix-vite brotli 50,749 51,033 +284 (+0.6%) 🔴
binding-radix-esbuild raw 197,857 198,900 +1,043 (+0.5%) 🔴
binding-radix-esbuild gzip 66,299 66,659 +360 (+0.5%) 🔴
binding-radix-esbuild brotli 58,612 58,833 +221 (+0.4%) 🔴
binding-mantine-hooks-vite raw 68,743 68,955 +212 (+0.3%) 🔴
binding-mantine-hooks-vite gzip 23,485 23,584 +99 (+0.4%) 🔴
binding-mantine-hooks-vite brotli 21,326 21,452 +126 (+0.6%) 🔴
binding-mantine-hooks-esbuild raw 77,574 77,790 +216 (+0.3%) 🔴
binding-mantine-hooks-esbuild gzip 27,501 27,582 +81 (+0.3%) 🔴
binding-mantine-hooks-esbuild brotli 24,883 24,939 +56 (+0.2%) 🔴
binding-apollo-client-vite raw 321,565 322,600 +1,035 (+0.3%) 🔴
binding-apollo-client-vite gzip 100,573 100,899 +326 (+0.3%) 🔴
binding-apollo-client-vite brotli 88,889 89,265 +376 (+0.4%) 🔴
binding-apollo-client-esbuild raw 350,228 351,279 +1,051 (+0.3%) 🔴
binding-apollo-client-esbuild gzip 113,572 113,958 +386 (+0.3%) 🔴
binding-apollo-client-esbuild brotli 100,261 100,525 +264 (+0.3%) 🔴
binding-usehooks-ts-vite raw 69,525 69,737 +212 (+0.3%) 🔴
binding-usehooks-ts-vite gzip 23,745 23,843 +98 (+0.4%) 🔴
binding-usehooks-ts-vite brotli 21,553 21,671 +118 (+0.5%) 🔴
binding-usehooks-ts-esbuild raw 78,342 78,558 +216 (+0.3%) 🔴
binding-usehooks-ts-esbuild gzip 27,742 27,825 +83 (+0.3%) 🔴
binding-usehooks-ts-esbuild brotli 25,071 25,130 +59 (+0.2%) 🔴

38 other measured values are unchanged.

@trueadm trueadm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks. The direction fits next's rule that a render writes no committed DOM, and custom-element callbacks running at commit match React's timing. CI shows a real regression in this change, though, so it needs another pass before merging.

Failing on this head and green on next:

  • packages/octane/tests/focus-restoration.test.ts, "restores a focused native editor relocated by its host update at the 'first' / 'last' position", in octane and octane-prod: expected [ 2, 4 ] to deeply equal [ 2, 9 ]. The focused input keeps focus but loses its selection range.
  • packages/octane/tests/browser/mobile-input/mobile-input.test.ts, "restores a relocated native …", in real Chromium, on the same two orders ([2, 1, 3, 4] and [2, 3, 4, 1]).
  • test (24) and CI provenance fail only because of the jobs above.

Why it's probably related. The fixture (tests/_fixtures/relocating-native-editor.ts) is a custom element whose attributeChangedCallback moves its own host into an external container when data-relocate goes 0 → 1, and the focus-restoration path brings it back. Deferring a custom host's props through DeoptOrder changes when that callback runs relative to the keyed move and its focus/selection snapshot. The restore now seems to run against a selection captured after the relocation (2–4), not before it (2–9). I haven't traced it to the exact line, so treat that as a hypothesis.

What I'd check:

  1. Does the deferral reach these hosts at all? The PR only intends newly created custom hosts in reconcileDeoptNode. If existing relocating editors also take the deferred path, for example through desc = deoptRecord(...), that's the bug, and narrowing the condition to genuinely new elements would fix it.
  2. If it's ordering: the deferred props op has to run where the old render-time write ran relative to moveNativeNodeBefore's focus capture and restore. That could mean queueing it before the move, or making the restore capture the selection once per commit before any custom-host op.
  3. Re-run focus-restoration.test.ts and the browser mobile-input suite, plus your two new anchorless-host cases.

Reviewed with Claude Code

@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.

Stale Bugbot comment from a previous run.

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

@trueadm trueadm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the follow-up commits. Two things to confirm on the current head (0e26b42), where CI is still running:

  1. Work counters. The last benchmark report on this PR (head 8b89b2f, run 38743397122) failed the js-framework gate with 8 increases, one extra call per mounted row:

    • tsrx calls_run / calls_replace / calls_add each +1,000, and calls_runlots +10,000;
    • the same four on jsx.

    "skip absent custom-host receipts on list placement" looks aimed at exactly this. Please check that the new report puts every counter back at or below next. The gate fails on any increase, and these rows have no custom hosts, so ordinary list placement shouldn't pay anything for this fix.

  2. Focus restoration. Earlier heads failed focus-restoration.test.ts ("restores a focused native editor relocated by its host update", with selection [2, 4] instead of [2, 9]) and the Chromium mobile-input relocation cases. Please confirm both suites pass on this head.

On size: the last report also showed roughly +70–110 B gzip on the full-surface bundles (shell_, full_fw, hydrate-frame). If the final number stays there, a note in the PR body on where those bytes go would help, since next is size-focused.

Reviewed with Claude Code

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/octane/src/runtime/deopt.ts Resolved

@trueadm trueadm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks. The work counters are back to next's on all 64, and the focus-restoration and mobile-input relocation cases pass, so both earlier concerns are resolved. The root-cause write-up (connectedCallback reading uninitialized attributes) is helpful.

The remaining blocker is size. By your own numbers this now costs about 990 B raw on the full-surface bundles:

  • js-framework TSRX +108 B gzip and JSX +263 B;
  • full framework +300 B, shell JS +261 B, hydrate-frame +299 B;
  • bindings +341 B, Threadline +133–141 B, Pagecraft +294–322 B.

next is a size-focused branch, and this is paid by every app, including the large majority that never render a custom element, to handle a rare edge case: a custom element's setter unmounting the root during its first render.

Could the cost be made pay-for-use?

  • Compiled templates: the compiler knows statically when a template contains a custom-element tag (a hyphenated name). The fresh-custom-host commit path (initial props before connect, the receipt, the interrupted-commit guard) could live behind a driver that only those templates install, the same way other optional features install their drivers. Shared slot and list commit paths would then test the driver by truthiness and fold away when it's absent.
  • Descriptors / JSX: install the same driver lazily from the descriptor path when it first creates a hyphenated element, so a JSX app that never makes a custom element doesn't retain it either.
  • Target: close to 0 B on apps without custom elements. If that can't be reached, please keep it under about 100 B gzip on those apps, and give the remaining cost per bundle.

The bundle gates you already have (no descriptor renderer or hydration in compiled-only roots) are a good model for a gate that keeps the custom-host path out of apps without custom elements.

Reviewed with Claude Code

@trueadm trueadm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the extra coverage. The two new anchorless-host cases (a compiled @if child and a plain createElement parent/child mounting into a retained section, each with an unmounting attribute callback) are useful evidence that initial props land before connectedCallback and that cancellation empties the root.

The blocker from the last review is still open, though. 729a875 changes tests only (git diff 31c7e68bb..729a875e6 touches just tests/_fixtures/anchorless-host.tsrx and tests/anchorless-host.test.ts), so the runtime cost is the same. The benchmark on this head (run 38752742759) shows it falling on apps that never create a custom element:

bundle raw gzip
js-framework TSRX (js_*) +408 +134
js-framework JSX (js_*) +989 +321
todo / chat / weather TSRX +408 +133 / +140 / +133
Threadline Oxc / esbuild +408 / +414 +130 / +135
Pagecraft Oxc / esbuild +990 / +1,010 +294 / +281
bindings / full_fw +989 / +991 +329 / +381
reachability: hooks-state, root-static-local, component-owned-effects +405–406 +113–135

80 application values and 84 reachability values grew; none shrank. All 64 work counters are unchanged, which is good. The paired timings flag one slower op: TSRX add at +8.9% (95% CI +3.2% … +20.0%). It may be noise, but add goes through placeRun, which now reads frag.$$next and calls commitFrontierMembers on every run.

Why it isn't pay-for-use yet. The cost lands in two places:

  1. Paid by everyone, about 408 B raw / 130 B gzip. These run unconditionally on shared commit paths that compiled-only apps already use:

    • runtime/engine.ts placeRun: the (frag as any).$$next read and the next.writes test.
    • runtime/commit.ts:
      • the COMMITTING_GENERATION checks added to applySlotNext and to every iteration of applyOutgoing;
      • the extra next parameter threaded through applyOutgoing → placeRoots;
      • commitFrontierMembers itself.

    With no custom element anywhere, none of this does anything.

  2. Paid by any descriptor or JSX app, a further ~580 B raw / ~190 B gzip. The placement argument now threads through every reconcileDeoptNode / reconcileDeoptChildren call, along with the isHtmlCustomElement branch, the frontier-search loop over parentBlock and forSlot.next, and queueFrontierHost (runtime/deopt.ts, runtime/child-slots.ts).

What I'd need in order to approve:

  • A driver for the frontier receipt. Move commitFrontierMembers, the receipt grouping and the interrupted-commit generation checks behind a driver, say CUSTOM_HOST_COMMIT, that the descriptor path installs the first time it creates a hyphenated element during a root render (and that a compiled template with a hyphenated tag installs at module init, if those need it). The shared paths then test it by truthiness: if (CUSTOM_HOST_COMMIT !== null && next.writes !== undefined) …. That lets compiled-only bundles fold all of it away.
  • No placement on ordinary nodes. Rather than threading placement through every reconcileDeoptNode call, compute it only on the branch that has just created a custom element, since that branch already walks ownerBlock for the frontier. Then ordinary descriptor nodes pay nothing.
  • A bundle gate. Add one to the existing set, as you did for the descriptor renderer and hydration: a compiled-only root and a JSX root with no hyphenated tags must not contain commitFrontierMembers or queueFrontierHost.
  • Targets. About 0 B on the TSRX js-framework, todo/chat/weather and reachability rows, and under about 100 B gzip on JSX/descriptor bundles without custom elements, with the remaining per-bundle cost listed in the PR body.

CI. website integration suite failed on this head in website/tests/ssr-hydration.e2e.test.ts ("/devtools never showed the TanStack Devtools trigger"). The page errors are Vite 504 (Outdated Optimize Dep) for node_modules/.vite/deps/RVI7YCPX-*.js, which looks like a dep-optimizer race rather than this change; test (24) and CI provenance fail only as its rollups. Please rerun it with the next push.

The correctness direction (props before connect, committing at the actual frontier, revoking the rest of the commit after a reentrant unmount) still looks right to me. This is purely about who pays for it.

Reviewed with Claude Code

@github-actions github-actions Bot removed the agent-authored Diff or issue body substantially produced by an AI agent label Oct 15, 2026

@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 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 171ee7d. Configure here.

Comment thread packages/octane/src/runtime/deopt.ts Resolved
@domgan-oai

Copy link
Copy Markdown
Contributor Author

@trueadm Following up on your size review: the current head is 9739a18a0. The custom-host receipt writer now sits behind an optional compiler-enabled capability, and the Oxc production gate executes both compiled-only and native JSX negative controls plus a custom-host positive control. Proven native/local component cases do not enable it; public dynamic factories remain conservative.

This is not fully pay-for-use: the placement argument still passes through descriptor reconciliation, some shared placement checks remain, and root-generation cancellation stays general because ordinary cleanup can replace a root. The current-head benchmark reports full JS gzip at +96 B TSRX and +160 B JSX (Oxc), Threadline +93 B Oxc / +87 B esbuild, and Pagecraft +323 B with both. Pagecraft retains the writer through a genuinely dynamic public createElement call. JSX and Pagecraft still miss your ~100 B target; the PR body includes the full local Oxc/esbuild table. I do not consider the size blocker resolved.

All 64 work counters are unchanged. The report did not flag any timing at its ±3% decision threshold, but JSX update and remove had slower intervals, so I cannot claim unchanged performance. The current-head CI run passed, including the website and Chromium suites; all 30 PR checks are green. The website case now waits for its client effect rather than network idle, while keeping the router event and DOM identity assertions.

@trueadm trueadm closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants