Skip to content

refactor: reuse child teardown for hydration slots - #2098

Merged
trueadm merged 1 commit into
octanejs:nextfrom
openai-oss-forks:codex/next-teardown-ownership
Oct 15, 2026
Merged

trueadm merged 1 commit into
octanejs:nextfrom
openai-oss-forks:codex/next-teardown-ownership

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Hydration-boundary slots already run their feature-owned teardown before generic slot dispatch. Remove the duplicate hydrateBlockSlot branch and use the existing child-block fallback, preserving the abort/waiter cleanup before child unmount. Keep the prefetch rationale beside its owner.

Validation

  • pnpm format:check (repo-wide not run; changed-file formatting passed)
  • pnpm typecheck (repo-wide not run; scoped owning-project typecheck passed)
  • pnpm test (repo-wide not run)
  • Targeted tests: 3 deferred-hydration lifecycle cases passed; deliberately skipping child unmount failed both cleanup cases. A focused Vitest config used the repository Octane plugin, jsdom, and per-test setup because the root config could not load unrelated dependencies in the filtered install.
  • pnpm sync passed without generated changes; independent complexity review found no actionable issue.
  • Complete production client JS (gzip-9, one asset per app): Threadline 52,807 → 52,801 B (Oxc), 59,760 → 59,755 B (Vite esbuild minifier); Draftboard 70,034 → 70,025 B (Oxc), 80,169 → 80,165 B (Vite esbuild minifier). Source maps confirm the duplicate condition disappears; portal implementations remain unchanged.
  • Paired CI benchmark report: 12 of 13 reported complete application gzip rows decreased by 4–14 B; the JSX shell increased by 2 B. The complete bindings app was 226,456 → 226,450 B gzip. All 64 work counters were unchanged; all 20 timed operations were within noise.
  • perf-review: final diff scan found 0 candidates. unmountSlot runs per teardown slot; no shape, allocation, DOM, or scheduling changes. Common later slot kinds lose one comparison; a hydration-boundary teardown gains two fixed comparisons. The paired browser timings show no significant regression or speedup.
  • concise-code: src +1/−6 (runtime +1/−6); no new files or exports. Keeping the branch preserves duplicate logic; removing the feature-owned callback would break prefetch cleanup.

Risk / follow-ups

The gzip savings are small and not universal. Brotli changes were mixed, including +145 B for the complete bindings app and +35 B for Threadline Oxc. This does not move portal teardown ownership or change foreign-target cleanup.

Provenance

  • An agent produced this diff (agent-authored)

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

Low Risk
Teardown order is preserved (feature teardown then child unmount); targeted deferred-hydration lifecycle tests reportedly cover prefetch abort and child cleanup.

Overview
Removes the dedicated hydrateBlockSlot branch from generic unmountSlot dispatch so hydration boundaries are torn down like other slots with a child block: teardownHydrateBoundary still runs first via SLOT_FLAG_TEARDOWN (installers, stream wait, prefetchAbort, waiters), then the existing fallback else path unmounts val.block.

Documents that load()-driven procedural prefetch can start before passive setup, so aborting prefetch belongs in boundary teardown rather than in the removed generic walk comment in block.ts.

Reviewed by Cursor Bugbot for commit 2913f9c. 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 refactor PR: internal restructuring, no behavior change labels Oct 15, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 15, 2026 16:17
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 21 value(s) increased
  • 🔴 bundle-reachability: 9 value(s) increased

Compares 5370a3161, the merge commit's first parent with c5c49fb37 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.808 3.517 ±0.0% −6.5% … +12.2% ⚪ within noise
octane-tsrx replace 7.617 7.617 −2.0% −11.1% … +11.5% ⚪ within noise
octane-tsrx add 2.667 2.742 −3.7% −7.8% … +4.2% ⚪ within noise
octane-tsrx update 0.084 0.085 +1.4% −3.2% … +5.6% ⚪ within noise
octane-tsrx select 0.006 0.006 −0.8% −3.1% … +3.2% ⚪ within noise
octane-tsrx swap 0.023 0.024 +0.9% −1.5% … +11.0% ⚪ within noise
octane-tsrx remove 0.018 0.018 +3.8% −5.9% … +9.7% ⚪ within noise
octane-tsrx runlots 26.017 27.833 +3.7% −8.3% … +11.2% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 +0.0% −1.8% … +4.4% ⚪ within noise
octane-tsrx clear 58.400 58.233 −2.2% −4.7% … +6.4% ⚪ within noise
octane-jsx run 4.067 4.025 −1.2% −6.6% … +6.5% ⚪ within noise
octane-jsx replace 7.758 7.800 −7.8% −11.5% … +1.2% ⚪ within noise
octane-jsx add 4.758 4.192 −6.2% −11.2% … +10.1% ⚪ within noise
octane-jsx update 0.198 0.191 −1.2% −6.5% … +8.8% ⚪ within noise
octane-jsx select 0.136 0.129 −1.2% −11.7% … +9.8% ⚪ within noise
octane-jsx swap 0.172 0.175 −3.0% −5.3% … +7.6% ⚪ within noise
octane-jsx remove 0.148 0.161 +4.1% −1.4% … +8.5% ⚪ within noise
octane-jsx runlots 37.242 35.067 −5.0% −18.1% … +7.2% ⚪ within noise
octane-jsx select_lots 1.223 1.240 +3.3% −6.7% … +14.4% ⚪ within noise
octane-jsx clear 54.667 57.517 −0.7% −3.3% … +7.4% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx js_raw 93,565 93,512 −53 (−0.1%) 🟢
octane-tsrx js_gzip 31,333 31,322 −11 (−0.0%) 🟢
octane-tsrx js_brotli 28,287 28,300 +13 (+0.0%) 🔴
octane-tsrx app_gzip 2,617 2,615 −2 (−0.1%) 🟢
octane-tsrx fw_raw 86,009 85,956 −53 (−0.1%) 🟢
octane-tsrx fw_gzip 28,716 28,707 −9 (−0.0%) 🟢
octane-tsrx fw_brotli 26,019 26,032 +13 (+0.0%) 🔴
octane-tsrx todo_js_raw 106,404 106,351 −53 (−0.0%) 🟢
octane-tsrx todo_js_gzip 35,995 35,989 −6 (−0.0%) 🟢
octane-tsrx todo_js_brotli 32,203 32,181 −22 (−0.1%) 🟢
octane-tsrx todo_fw_raw 100,163 100,110 −53 (−0.1%) 🟢
octane-tsrx todo_fw_gzip 33,216 33,210 −6 (−0.0%) 🟢
octane-tsrx todo_fw_brotli 29,867 29,845 −22 (−0.1%) 🟢
octane-tsrx chat_js_raw 105,255 105,202 −53 (−0.1%) 🟢
octane-tsrx chat_js_gzip 35,732 35,728 −4 (−0.0%) 🟢
octane-tsrx chat_js_brotli 32,031 32,091 +60 (+0.2%) 🔴
octane-tsrx chat_app_gzip 3,210 3,211 +1 (+0.0%) 🔴
octane-tsrx chat_app_brotli 2,797 2,805 +8 (+0.3%) 🔴
octane-tsrx chat_fw_raw 98,114 98,061 −53 (−0.1%) 🟢
octane-tsrx chat_fw_gzip 32,522 32,517 −5 (−0.0%) 🟢
octane-tsrx chat_fw_brotli 29,234 29,286 +52 (+0.2%) 🔴
octane-tsrx weather_js_raw 143,023 142,970 −53 (−0.0%) 🟢
octane-tsrx weather_js_gzip 47,339 47,334 −5 (−0.0%) 🟢
octane-tsrx weather_js_brotli 42,040 41,983 −57 (−0.1%) 🟢
octane-tsrx weather_app_brotli 7,329 7,331 +2 (+0.0%) 🔴
octane-tsrx weather_fw_raw 117,936 117,883 −53 (−0.0%) 🟢
octane-tsrx weather_fw_gzip 38,715 38,710 −5 (−0.0%) 🟢
octane-tsrx weather_fw_brotli 34,711 34,652 −59 (−0.2%) 🟢
octane-tsrx bindings_js_raw 685,281 685,228 −53 (−0.0%) 🟢
octane-tsrx bindings_js_gzip 226,456 226,450 −6 (−0.0%) 🟢
octane-tsrx bindings_js_brotli 192,857 193,002 +145 (+0.1%) 🔴
octane-tsrx bindings_app_brotli 97,156 97,174 +18 (+0.0%) 🔴
octane-tsrx bindings_fw_raw 331,099 331,046 −53 (−0.0%) 🟢
octane-tsrx bindings_fw_gzip 109,491 109,485 −6 (−0.0%) 🟢
octane-tsrx bindings_fw_brotli 95,701 95,828 +127 (+0.1%) 🔴
octane-tsrx wayfinder_js_raw 438,267 438,214 −53 (−0.0%) 🟢
octane-tsrx wayfinder_js_gzip 144,544 144,538 −6 (−0.0%) 🟢
octane-tsrx wayfinder_js_brotli 126,167 126,111 −56 (−0.0%) 🟢
octane-tsrx threadline_oxc_js_raw 160,616 160,563 −53 (−0.0%) 🟢
octane-tsrx threadline_oxc_js_gzip 52,860 52,855 −5 (−0.0%) 🟢
octane-tsrx threadline_oxc_js_brotli 46,455 46,490 +35 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_raw 178,635 178,582 −53 (−0.0%) 🟢
octane-tsrx threadline_esbuild_js_gzip 59,796 59,790 −6 (−0.0%) 🟢
octane-tsrx threadline_esbuild_js_brotli 52,629 52,522 −107 (−0.2%) 🟢
octane-tsrx pagecraft_oxc_js_raw 544,561 544,508 −53 (−0.0%) 🟢
octane-tsrx pagecraft_oxc_js_gzip 171,281 171,272 −9 (−0.0%) 🟢
octane-tsrx pagecraft_oxc_js_brotli 145,353 145,367 +14 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_raw 577,018 576,965 −53 (−0.0%) 🟢
octane-tsrx pagecraft_esbuild_js_gzip 186,569 186,562 −7 (−0.0%) 🟢
octane-tsrx pagecraft_esbuild_js_brotli 158,588 158,614 +26 (+0.0%) 🔴
octane-tsrx full_fw_raw 522,733 522,680 −53 (−0.0%) 🟢
octane-tsrx full_fw_gzip 163,178 163,172 −6 (−0.0%) 🟢
octane-tsrx full_fw_brotli 138,796 138,755 −41 (−0.0%) 🟢
octane-jsx js_raw 169,120 169,067 −53 (−0.0%) 🟢
octane-jsx js_gzip 55,100 55,089 −11 (−0.0%) 🟢
octane-jsx js_brotli 48,603 48,607 +4 (+0.0%) 🔴
octane-jsx app_gzip 3,581 3,580 −1 (−0.0%) 🟢
octane-jsx app_brotli 2,889 2,890 +1 (+0.0%) 🔴
octane-jsx fw_raw 158,061 158,008 −53 (−0.0%) 🟢
octane-jsx fw_gzip 51,519 51,509 −10 (−0.0%) 🟢
octane-jsx fw_brotli 45,714 45,717 +3 (+0.0%) 🔴
octane-jsx shell_js_raw 327,113 327,060 −53 (−0.0%) 🟢
octane-jsx shell_js_gzip 106,589 106,591 +2 (+0.0%) 🔴
octane-jsx shell_js_brotli 92,500 92,488 −12 (−0.0%) 🟢
octane-jsx shell_app_gzip 761 770 +9 (+1.2%) 🔴
octane-jsx shell_app_brotli 656 664 +8 (+1.2%) 🔴
octane-jsx shell_fw_raw 326,020 325,967 −53 (−0.0%) 🟢
octane-jsx shell_fw_gzip 105,828 105,821 −7 (−0.0%) 🟢
octane-jsx shell_fw_brotli 91,844 91,824 −20 (−0.0%) 🟢
octane-jsx shell_client_js_raw 278,558 278,505 −53 (−0.0%) 🟢
octane-jsx shell_client_js_gzip 90,186 90,172 −14 (−0.0%) 🟢
octane-jsx shell_client_js_brotli 78,867 78,907 +40 (+0.1%) 🔴
octane-jsx shell_client_app_gzip 773 768 −5 (−0.6%) 🟢
octane-jsx shell_client_app_brotli 669 663 −6 (−0.9%) 🟢
octane-jsx shell_client_fw_raw 277,457 277,404 −53 (−0.0%) 🟢
octane-jsx shell_client_fw_gzip 89,413 89,404 −9 (−0.0%) 🟢
octane-jsx shell_client_fw_brotli 78,198 78,244 +46 (+0.1%) 🔴
octane-jsx full_fw_raw 522,733 522,680 −53 (−0.0%) 🟢
octane-jsx full_fw_gzip 163,178 163,172 −6 (−0.0%) 🟢
octane-jsx full_fw_brotli 138,796 138,755 −41 (−0.0%) 🟢

13 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
cli-spa-starter raw 85,850 85,797 −53 (−0.1%) 🟢
cli-spa-starter gzip 29,525 29,519 −6 (−0.0%) 🟢
cli-spa-starter brotli 26,430 26,421 −9 (−0.0%) 🟢
root-static-specialized raw 57,141 57,088 −53 (−0.1%) 🟢
root-static-specialized gzip 19,381 19,376 −5 (−0.0%) 🟢
root-static-specialized brotli 17,642 17,650 +8 (+0.0%) 🔴
root-chained-jsx raw 59,282 59,229 −53 (−0.1%) 🟢
root-chained-jsx gzip 20,097 20,092 −5 (−0.0%) 🟢
root-chained-jsx brotli 18,313 18,300 −13 (−0.1%) 🟢
root-static raw 144,698 144,645 −53 (−0.0%) 🟢
root-static gzip 47,262 47,254 −8 (−0.0%) 🟢
root-static brotli 42,074 42,017 −57 (−0.1%) 🟢
root-static-local raw 57,040 56,987 −53 (−0.1%) 🟢
root-static-local gzip 19,335 19,330 −5 (−0.0%) 🟢
root-static-local brotli 17,607 17,604 −3 (−0.0%) 🟢
root-callback-local raw 59,700 59,647 −53 (−0.1%) 🟢
root-callback-local gzip 20,180 20,176 −4 (−0.0%) 🟢
root-callback-local brotli 18,362 18,358 −4 (−0.0%) 🟢
hooks-state raw 68,052 67,999 −53 (−0.1%) 🟢
hooks-state gzip 23,027 23,021 −6 (−0.0%) 🟢
hooks-state brotli 20,913 20,959 +46 (+0.2%) 🔴
prop-attributes raw 65,155 65,102 −53 (−0.1%) 🟢
prop-attributes gzip 22,148 22,143 −5 (−0.0%) 🟢
prop-attributes brotli 20,224 20,222 −2 (−0.0%) 🟢
context raw 75,147 75,094 −53 (−0.1%) 🟢
context gzip 25,196 25,190 −6 (−0.0%) 🟢
context brotli 22,786 22,766 −20 (−0.1%) 🟢
hydrate-root raw 96,114 96,061 −53 (−0.1%) 🟢
hydrate-root gzip 32,328 32,320 −8 (−0.0%) 🟢
hydrate-root brotli 28,834 28,865 +31 (+0.1%) 🔴
deferred-hydration raw 180,118 180,065 −53 (−0.0%) 🟢
deferred-hydration gzip 58,700 58,693 −7 (−0.0%) 🟢
deferred-hydration brotli 51,291 51,321 +30 (+0.1%) 🔴
hydrate-frame raw 340,353 340,300 −53 (−0.0%) 🟢
hydrate-frame gzip 109,246 109,241 −5 (−0.0%) 🟢
hydrate-frame brotli 94,858 94,857 −1 (−0.0%) 🟢
suspense-transition raw 119,986 119,933 −53 (−0.0%) 🟢
suspense-transition gzip 39,214 39,211 −3 (−0.0%) 🟢
suspense-transition brotli 34,862 34,814 −48 (−0.1%) 🟢
component-owned-effects raw 61,227 61,174 −53 (−0.1%) 🟢
component-owned-effects gzip 20,722 20,716 −6 (−0.0%) 🟢
component-owned-effects brotli 18,872 18,881 +9 (+0.0%) 🔴
descriptor-children raw 166,432 166,379 −53 (−0.0%) 🟢
descriptor-children gzip 54,004 53,994 −10 (−0.0%) 🟢
descriptor-children brotli 47,999 47,918 −81 (−0.2%) 🟢
binding-hooks raw 70,453 70,400 −53 (−0.1%) 🟢
binding-hooks gzip 24,047 24,040 −7 (−0.0%) 🟢
binding-hooks brotli 21,806 21,798 −8 (−0.0%) 🟢
split-shell raw 391,235 391,182 −53 (−0.0%) 🟢
split-shell gzip 127,365 127,361 −4 (−0.0%) 🟢
split-shell brotli 111,020 110,959 −61 (−0.1%) 🟢
split-shell-runtime raw 316,020 315,967 −53 (−0.0%) 🟢
split-shell-runtime gzip 101,596 101,589 −7 (−0.0%) 🟢
split-shell-runtime brotli 87,819 87,752 −67 (−0.1%) 🟢
binding-base-ui-vite raw 176,955 176,902 −53 (−0.0%) 🟢
binding-base-ui-vite gzip 57,602 57,595 −7 (−0.0%) 🟢
binding-base-ui-vite brotli 51,063 51,109 +46 (+0.1%) 🔴
binding-base-ui-esbuild raw 198,369 198,316 −53 (−0.0%) 🟢
binding-base-ui-esbuild gzip 66,596 66,588 −8 (−0.0%) 🟢
binding-base-ui-esbuild brotli 58,895 58,893 −2 (−0.0%) 🟢
binding-radix-vite raw 176,391 176,338 −53 (−0.0%) 🟢
binding-radix-vite gzip 57,263 57,258 −5 (−0.0%) 🟢
binding-radix-vite brotli 50,749 50,773 +24 (+0.0%) 🔴
binding-radix-esbuild raw 197,857 197,804 −53 (−0.0%) 🟢
binding-radix-esbuild gzip 66,299 66,292 −7 (−0.0%) 🟢
binding-radix-esbuild brotli 58,612 58,540 −72 (−0.1%) 🟢
binding-mantine-hooks-vite raw 68,743 68,690 −53 (−0.1%) 🟢
binding-mantine-hooks-vite gzip 23,485 23,476 −9 (−0.0%) 🟢
binding-mantine-hooks-vite brotli 21,326 21,333 +7 (+0.0%) 🔴
binding-mantine-hooks-esbuild raw 77,574 77,521 −53 (−0.1%) 🟢
binding-mantine-hooks-esbuild gzip 27,501 27,491 −10 (−0.0%) 🟢
binding-mantine-hooks-esbuild brotli 24,883 24,810 −73 (−0.3%) 🟢
binding-apollo-client-vite raw 321,565 321,512 −53 (−0.0%) 🟢
binding-apollo-client-vite gzip 100,573 100,558 −15 (−0.0%) 🟢
binding-apollo-client-vite brotli 88,889 88,873 −16 (−0.0%) 🟢
binding-apollo-client-esbuild raw 350,228 350,165 −63 (−0.0%) 🟢
binding-apollo-client-esbuild gzip 113,572 113,561 −11 (−0.0%) 🟢
binding-apollo-client-esbuild brotli 100,261 100,164 −97 (−0.1%) 🟢
binding-usehooks-ts-vite raw 69,525 69,472 −53 (−0.1%) 🟢
binding-usehooks-ts-vite gzip 23,745 23,740 −5 (−0.0%) 🟢
binding-usehooks-ts-vite brotli 21,553 21,563 +10 (+0.0%) 🔴
binding-usehooks-ts-esbuild raw 78,342 78,289 −53 (−0.1%) 🟢
binding-usehooks-ts-esbuild gzip 27,742 27,725 −17 (−0.1%) 🟢
binding-usehooks-ts-esbuild brotli 25,071 25,048 −23 (−0.1%) 🟢

39 other measured values are unchanged.

@trueadm
trueadm merged commit 27fc1c1 into octanejs:next Oct 15, 2026
79 of 82 checks passed
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 refactor PR: internal restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants