Skip to content

fix(octane): retain hook boundaries for opaque property reads - #1770

Merged
trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/getter-hook-boundaries
Oct 5, 2026
Merged

trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/getter-hook-boundaries

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Depends on #1784; do not merge before it. This branch tracks landed main (3754039) while #1784 is in progress. Once #1784 lands, integrate its final main and run pinned current-head CI again. #1776 is on hold pending those measurements, not a prerequisite.

Preserve independent state when plain-module custom hooks read a getter or Proxy property that itself reaches a hook. The slot-free proof considered only calls, constructors, and tags; it could elide both call-site boundaries and hydrate server d1d0 into client d1d1. Opaque property reads now prevent that proof, while the independent single-use optimization remains intact.

The regression covers dot and optional reads, three compiler modes, server HTML, adoption without recoverable mismatch, updates, and unmount. Includes an Octane patch changeset.

Validation

Risk / follow-ups

More custom hooks with unproven property reads retain their correct boundaries. Per-render cost for those callers may increase. The binding-usehooks-ts size run could not build (local fallback lacks lodash.debounce); full pinned CI, including bundle budgets, must validate this surface.

Historical main fb404c2 breached the old deferred-hydration raw cap. #1784 substantially changes that output; validate against its landed, pinned build before considering any budget increase.

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. Autofix is disabled.


Note

Medium Risk
Compiler behavior changes which plain-module custom hooks keep slot boundaries; hooks with member reads may emit more withSlot calls and slightly higher per-render cost, but fixes incorrect shared state and hydration mismatches.

Overview
Fixes incorrect sharing of custom-hook state when a plain-module hook returns state read through a getter or optional member access (including behind a Proxy). The compiler’s “slot-free” optimization could still drop withSlot boundaries for those hooks, so two call sites could share one slot and SSR/hydration could show duplicated values (e.g. d1d1 instead of d1d0).

evaluatesOpaqueCode in hook-deps.js now treats MemberExpression and OptionalMemberExpression like constructors and tagged templates—opaque execution that may run hooks—so those hooks are not proven slot-free and keep per–call-site boundaries. Safe elision for truly slot-free hooks is unchanged.

Adds hydration + update tests for source.cell and source?.cell getter patterns (shared loadPair helper) and an Octane patch changeset.

Reviewed by Cursor Bugbot for commit 2e85cca. 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 5, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 5, 2026 12:36
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 2 value(s) increased within budget

Compares 9c8429317, the merge commit's first parent with 9a183b7f2 on the same runner. A byte value over its committed budget or any increase in a js-framework work counter fails this check. 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.758 3.242 −5.9% −11.4% … −0.0% ⚪ within noise
octane-tsrx replace 9.642 9.742 +1.0% −11.5% … +7.1% ⚪ within noise
octane-tsrx add 2.967 3.017 −3.5% −11.7% … +3.5% ⚪ within noise
octane-tsrx update 0.178 0.206 +3.6% −4.5% … +16.2% ⚪ within noise
octane-tsrx select 0.007 0.007 +1.4% −4.2% … +10.2% ⚪ within noise
octane-tsrx swap 0.047 0.045 +0.5% −15.1% … +3.5% ⚪ within noise
octane-tsrx remove 0.033 0.032 −2.7% −8.5% … +3.5% ⚪ within noise
octane-tsrx runlots 42.317 45.142 +0.3% −15.1% … +11.5% ⚪ within noise
octane-tsrx select_lots 0.009 0.009 −0.5% −2.4% … +4.1% ⚪ within noise
octane-tsrx clear 75.692 79.158 +0.3% −6.2% … +8.2% ⚪ within noise
octane-jsx run 7.708 7.492 +1.4% −6.5% … +10.5% ⚪ within noise
octane-jsx replace 16.958 18.325 +5.0% −0.3% … +14.8% ⚪ within noise
octane-jsx add 5.775 6.100 +3.8% −6.6% … +27.8% ⚪ within noise
octane-jsx update 0.496 0.485 −2.0% −12.1% … +5.1% ⚪ within noise
octane-jsx select 0.240 0.227 −0.8% −15.1% … +8.0% ⚪ within noise
octane-jsx swap 0.331 0.333 +5.7% ±0.0% … +14.2% ⚪ within noise
octane-jsx remove 0.279 0.294 −5.8% −15.5% … +11.5% ⚪ within noise
octane-jsx runlots 46.633 44.917 +3.2% −11.1% … +8.7% ⚪ within noise
octane-jsx select_lots 4.658 4.450 +5.4% −13.0% … +14.6% ⚪ within noise
octane-jsx clear 75.625 74.942 +1.2% −9.8% … +12.9% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx bindings_js_gzip 239,552 239,539 −13 (−0.0%) 🟢
octane-tsrx bindings_js_brotli 204,091 204,213 +122 (+0.1%) 🔴
octane-tsrx bindings_app_gzip 121,383 121,370 −13 (−0.0%) 🟢
octane-tsrx bindings_app_brotli 101,517 101,639 +122 (+0.1%) 🔴

56 other measured values are unchanged.

Public-import reachability bundles (bytes)

No changes across 105 measured values.

@trueadm
trueadm merged commit 2f88235 into octanejs:main Oct 5, 2026
30 checks passed
trueadm added a commit that referenced this pull request Oct 5, 2026
…#1772 and #1794

Same method as before: each budget is main's value minus the measured
esbuild-to-Oxc difference on the merged source, never raised (131
lowered, 28 unchanged). The baseline record and home summary follow the
new bytes; every ratio guard still holds with the ceilings already cut.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm added a commit that referenced this pull request Oct 6, 2026
* ci(bench): measure bundle sizes with Vite 8's default minifier

The bundle-size and bundle-reachability harnesses forced Vite's
`minify: 'esbuild'`. That mode turns Rolldown's own minifier off, and with
it the dead-code elimination that removes branches guarded by a
never-written module flag, so the numbers were not what a Vite app ships.

- run.mjs builds every framework with `minify: 'oxc'` (Vite 8's default
  client minifier), still identical settings for every target.
- run-minimal.mjs builds its Vite scenarios with `'oxc'`; the esbuild
  bundler scenarios keep esbuild's `minify: true`. The async-identity
  encoder check accepts Oxc's template-literal quotes.
- Every budget is ratcheted down (144 lowered, 15 unchanged, 0 raised),
  the bundle-size baseline is re-recorded, the 18 cross-framework ratio
  guards are re-cut, and the website summary and copy follow.

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

* ci(bench): re-measure the Oxc budgets on main with #1761 and #1782

Budgets move by the measured esbuild-to-Oxc difference on the same
source (budget - max(0, esbuild - oxc)), so the methodology change
lowers 131 values, keeps 28, raises none, and leaves the headroom #1782
granted to #1783 in place. The baseline, ratio guards and website
summary are recomputed from the merged source.

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

* test(website): compare home summary ceilings at stable precision

The smoke test rounds each summary row to 15 significant digits because
Math.log/exp can differ by one ULP between libc implementations, but it
compared the bundle-size range ends exactly. Those ends are geometric
means too: the recorded Solid ceiling was 0.9500824085923075 on macOS and
0.9500824085923076 on the Linux runner. Round them the same way.

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

* ci(bench): re-derive the Oxc budgets on main with #1766, #1768, #1770, #1772 and #1794

Same method as before: each budget is main's value minus the measured
esbuild-to-Oxc difference on the merged source, never raised (131
lowered, 28 unchanged). The baseline record and home summary follow the
new bytes; every ratio guard still holds with the ceilings already cut.

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

* ci(bench): re-derive the Oxc budgets on main with #1783

#1783 landed and spent the headroom #1782/#1793/#1794 granted it. Each
budget is again main's value minus the measured esbuild-to-Oxc
difference on the merged source (131 lowered, 28 unchanged, none
raised). The baseline record, home summary and refresh note follow.

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

* ci(bench): re-cut the cross-framework ratio guards after #1784

With #1784's hydrating flag folded by Oxc, Octane's totals shrink 8.5-10%
instead of about 5%, so the total-gzip ceilings had grown about 6% loose.
They are re-cut at about 1.5% headroom on the merged-source measurement;
application-code ceilings are unchanged. All 72 bundle-size guards hold.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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 fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants