Skip to content

fix(octane): move delegated event slots off Solid's $$<type> expando - #1883

Merged
domgan-oai merged 9 commits into
octanejs:mainfrom
dion04:fix/event-slot-namespace
Oct 8, 2026
Merged

domgan-oai merged 9 commits into
octanejs:mainfrom
dion04:fix/event-slot-namespace

Conversation

@dion04

@dion04 dion04 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Why

  • Solid's event delegation stores handlers at node.$$click and calls them from a document listener. Octane used the identical property, so inside an Octane root each dispatcher ran the other's handlers:
    • Clicking a TanStack Query devtools row ran its toggle twice, so the details view never opened in docked mode. Picture-in-picture worked because its document has no Octane root.
    • Once Solid's listener was registered, every Octane onClick on the page ran twice. In examples/hacker-news, the header link handler measured 2 calls per click.
    • Solid also calls whatever it finds at $$click, including Octane's HandlerBundle objects.

Changes

  • runtime.ts: new EVENT_SLOT_PREFIX = '$o' and CAPTURE_PREFIX = '$ocapture:', used by eventSlot(), createDelegatedEventType(), and the prototype expando seeding. The direct slot reads in the controlled-input and hydration-claim paths ($oinput, $ochange, $oclick, and their capture forms) use the new keys too.
  • compile.js: event attributes lower to the same $o… keys.
  • Every key keeps its old length, so compiled output and runtime size do not grow.
  • The view-transition image wait now reads $oload when it skips images whose onLoad the app handles. Cursor Bugbot caught this read, which the first commit missed. A new regression in view-transition-scoped-effects.test.ts covers it.
  • Non-event expandos ($$portalParent, $$ctrl, $$formAction, …) are unchanged. No DOM event type matches their names, so no delegation looks them up.
  • Tests and the compiler-output benchmark that named the old key are updated.
  • The changeset is an octane patch. The old key was internal and undocumented.

Validation

All local runs were on Windows.

  • New regression packages/octane/tests/foreign-delegation.test.ts covers two cases:
    • A foreign $$click stamp inside an Octane root must never run through Octane.
    • With a Solid-shaped document delegation installed, an Octane button and a foreign $$click element must each run once.
    • Before the fix, both tests failed in the octane and octane-prod projects with the expected assertions: 1 call instead of 0, and a doubled octane-bubble. After the fix, both pass.
  • Image-wait regression: does not wait for an image whose onLoad the app handles failed on 77a9c89 in dev and prod and passes on 6c1d212. All view-transition suites pass (18 files, 344 tests).
  • Targeted suites pass: prop-removal, portal-events, capture-events, compiler-inspect-segments, and website/tests/playground-mapping (10 files, 325 tests).
  • Full packages/octane/tests run: 45,513 passed and 96 failed. I reran every failing file against unmodified upstream/main on the same machine:
    • 63 of the failures also fail on main. They are symlink, Vite, typecheck, and Volar tests that break on Windows.
    • The other 33 are timing-sensitive tests that took 5 to 7 seconds under full-suite load (behavior-root, hydration-ssr-diagnostics, two Volar cases). They pass when those files run alone with this change.
  • octane-tsc -p packages/octane/tsconfig.json
  • pnpm sync is clean, apart from a Windows-only backslash rewrite of docs/binding-parity-gaps.md, which I reverted and did not commit. pnpm changeset:check passes.
  • End to end: I applied this diff to the feat(tanstack-query-devtools): port @tanstack/react-query-devtools 5.102.8 #1881 worktree and ran examples/hacker-news with ReactQueryDevtools docked. Clicking a query row now opens Query Details, and the header link's Octane handler runs once per click.
  • Bundle size: with the same toolchain on this machine, base versus head totals for the complete-app scenarios move by +2 to +4 raw bytes (rows +4, todo +4, chat +4, weather +4, bindings +4, rows-jsx +2), well inside the +32 ratchet. On this Windows machine the committed budgets fail the ratchet on main too, so the Linux CI budget shard decides.
  • pnpm typecheck (full) and pnpm test (full): not run locally because of Windows command-line and path limits. CI covers them.
  • PR bench (run 37758398797, 573127fd3 vs 91f770fd0): the check passed, with no value over budget and all 64 js-framework work counters unchanged. Raw bytes move +2 to +6 per bundle (the same-length key rename, plus one string literal the minifier no longer shares). gzip moves −17 to +16 and brotli −145 to +101 in both directions, which fits the non-monotonic brotli behavior that benchmarks/README.md documents. One timing is flagged (perf review row 3).
  • perf-review: report below.

Perf review: fix/event-slot-namespace (upstream/main..HEAD)

Scan: node scripts/perf-review-scan.mjs --base upstream/main found 0 candidates. The same scan on packages/octane/src/compiler/ also found 0.

Hot paths touched:

  • The delegated dispatch walk (snapshotDelegatedSlots) runs per event and per ancestor. It still reads node[type.bubbleKey], and only the key string changes.
  • eventSlot runs per spread or de-opt event prop. It changes only the cached key string.
  • Compiled event bindings run per element with a handler. They change only the string literal, which has the same length.
# Severity Location Dimension Finding Required evidence Provided?
1 note packages/octane/src/runtime.ts (seedExpando(Element.prototype, EVENT_SLOT_PREFIX + name)) shapes The prototype seeding that keeps missing-slot reads off the full prototype walk still seeds every bubble key, now under the new name. No receiver map changes, and nothing new is allocated. none n/a
2 note packages/octane/src/compiler/compile.js (event attribute slotKey) compiler output The key literal keeps its length ('$$click' → '$oclick'). The bundle rows above show +2 to +4 raw bytes per app, which suggests the minifier now shares one fewer literal with other $$ names. CI bundle rows partial (local, same toolchain)
3 needs-evidence js-framework octane-jsx / clear timing The PR bench (run 37758398797) reports clear at +6.3% (95% CI +3.9% … +9.3%). Clearing rows does not read delegated slot keys: removal stamps $$retiredEpoch, which is unchanged, and the diff only renames key strings. All 64 work counters are unchanged, and octane-tsrx / clear, which runs the same runtime path, is within noise (+1.4%, CI −0.6% … +2.7%). This reads as runner noise. A PR bench rerun on the current head partial

Not checked: browser event latency, since the dispatch logic is unchanged.

Risk / follow-ups

  • The PR bench flagged octane-jsx / clear at +6.3%. The reasoning is in perf review row 3, and a maintainer rerun of PR bench on the current head would settle it.
  • Third-party code that wrote el.$$click by hand to piggyback on Octane's delegation stops receiving events. That was never a documented API, and the changeset says so.
  • Svelte 5 uses __<type> and Inferno $EV, so neither collides with $o. I know of no library that uses $o<type>.
  • feat(tanstack-query-devtools): port @tanstack/react-query-devtools 5.102.8 #1881 (@octanejs/tanstack-query-devtools) depends on this fix for its docked-panel row selection.

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

Medium Risk
Renames every delegated event DOM slot used on every click path; behavior change is intentional but touches core event infrastructure and breaks undocumented $$click expando usage.

Overview
Fixes double-firing delegated clicks when Solid (or anything using node.$$click) lives inside an Octane root by moving Octane’s handler expandos from $$<type> / $$capture:<type> to $o<type> / $ocapture:<type> in the runtime and compiler.

The dispatch and seeding paths use the new keys; spread/removal, form diagnostics, and portal delegation tests follow the same naming. View-transition image waits now check $oload so images with an app onLoad are not held incorrectly after the rename.

Adds foreign-delegation regression tests and updates bundle-size budgets for tiny gzip/brotli drift. Hand-written el.$$click hooks are no longer supported—use el.$oclick.

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

Octane stamped delegated handlers at `node.$$click`, the same property
Solid's event delegation reads from its document listener. Inside an
Octane root each dispatcher ran the other's handlers, so one click ran
a handler twice: TanStack Query devtools rows toggled selection on and
off, and every Octane onClick ran twice once Solid was on the page.

Bubble slots are now `$o<type>` and capture slots `$ocapture:<type>`,
emitted identically by the compiler. Keys keep their length, so
compiled output does not grow.

Fixes octanejs#1882

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 fix PR: bug fix labels Oct 8, 2026
@dion04
dion04 marked this pull request as ready for review October 8, 2026 09:30
Copilot AI balanced review requested due to automatic review settings October 8, 2026 09:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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 77a9c89. Configure here.

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

The resource wait skipped images whose `onLoad` the app handles by
reading `$$load`, which the slot rename left behind, so those images
could hold the snapshot for up to the 500ms wait again.

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

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🟡 js-framework: 1 timed operation(s) slower beyond ±3%
  • 🔴 bundle-size: 23 value(s) increased within budget
  • 🔴 bundle-reachability: 15 value(s) increased within budget

Compares 8444db8ae, the merge commit's first parent with d42c4307a 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

target operation base ms head ms head/base 95% CI
octane-tsrx select_lots 0.006 0.007 +8.1% +5.7% … +9.9% 🟡 slower
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 3.367 3.392 +1.4% −1.5% … +4.8% ⚪ within noise
octane-tsrx replace 9.400 9.142 −2.2% −6.0% … +6.6% ⚪ within noise
octane-tsrx add 2.992 2.967 −3.5% −6.5% … −3.2% ⚪ within noise
octane-tsrx update 0.134 0.132 −2.0% −5.1% … +1.5% ⚪ within noise
octane-tsrx select 0.006 0.006 +1.2% −0.6% … +2.3% ⚪ within noise
octane-tsrx swap 0.035 0.035 −0.8% −1.6% … +0.0% ⚪ within noise
octane-tsrx remove 0.019 0.019 +0.8% −2.6% … +5.1% ⚪ within noise
octane-tsrx runlots 31.508 29.558 −2.1% −7.2% … +1.6% ⚪ within noise
octane-tsrx select_lots 0.006 0.007 +8.1% +5.7% … +9.9% 🟡 slower
octane-tsrx clear 53.683 55.650 +3.3% +0.6% … +7.6% ⚪ within noise
octane-jsx run 4.042 4.258 −2.5% −4.9% … +1.2% ⚪ within noise
octane-jsx replace 9.075 9.367 +1.2% −3.4% … +3.0% ⚪ within noise
octane-jsx add 3.867 3.867 +0.0% −1.3% … +3.7% ⚪ within noise
octane-jsx update 0.314 0.321 −1.3% −4.0% … +3.3% ⚪ within noise
octane-jsx select 0.151 0.151 +0.3% −1.1% … +2.6% ⚪ within noise
octane-jsx swap 0.260 0.264 +0.6% −1.2% … +3.3% ⚪ within noise
octane-jsx remove 0.199 0.199 +0.7% −1.3% … +1.7% ⚪ within noise
octane-jsx runlots 33.500 34.717 +1.7% −2.1% … +3.8% ⚪ within noise
octane-jsx select_lots 1.886 1.847 −1.8% −5.2% … +1.3% ⚪ within noise
octane-jsx clear 51.625 53.133 +0.6% −2.7% … +4.0% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx js_brotli 32,630 32,635 +5 (+0.0%) 🔴
octane-tsrx app_gzip 2,335 2,334 −1 (−0.0%) 🟢
octane-tsrx app_brotli 2,029 2,030 +1 (+0.0%) 🔴
octane-tsrx fw_gzip 34,521 34,522 +1 (+0.0%) 🔴
octane-tsrx fw_brotli 30,601 30,605 +4 (+0.0%) 🔴
octane-tsrx todo_js_gzip 39,643 39,644 +1 (+0.0%) 🔴
octane-tsrx todo_js_brotli 34,884 34,897 +13 (+0.0%) 🔴
octane-tsrx todo_app_brotli 1,878 1,884 +6 (+0.3%) 🔴
octane-tsrx todo_fw_gzip 37,423 37,424 +1 (+0.0%) 🔴
octane-tsrx todo_fw_brotli 33,006 33,013 +7 (+0.0%) 🔴
octane-tsrx chat_js_brotli 34,771 34,789 +18 (+0.1%) 🔴
octane-tsrx chat_app_gzip 2,715 2,714 −1 (−0.0%) 🟢
octane-tsrx chat_app_brotli 2,387 2,389 +2 (+0.1%) 🔴
octane-tsrx chat_fw_gzip 36,759 36,760 +1 (+0.0%) 🔴
octane-tsrx chat_fw_brotli 32,384 32,400 +16 (+0.0%) 🔴
octane-tsrx weather_js_gzip 50,863 50,864 +1 (+0.0%) 🔴
octane-tsrx weather_js_brotli 44,362 44,375 +13 (+0.0%) 🔴
octane-tsrx weather_app_gzip 7,873 7,872 −1 (−0.0%) 🟢
octane-tsrx weather_app_brotli 6,674 6,678 +4 (+0.1%) 🔴
octane-tsrx weather_fw_gzip 42,990 42,992 +2 (+0.0%) 🔴
octane-tsrx weather_fw_brotli 37,688 37,697 +9 (+0.0%) 🔴
octane-tsrx bindings_js_gzip 224,574 224,571 −3 (−0.0%) 🟢
octane-tsrx bindings_js_brotli 190,765 190,779 +14 (+0.0%) 🔴
octane-tsrx bindings_app_gzip 115,667 115,665 −2 (−0.0%) 🟢
octane-tsrx bindings_app_brotli 96,233 96,188 −45 (−0.0%) 🟢
octane-tsrx bindings_fw_gzip 108,907 108,906 −1 (−0.0%) 🟢
octane-tsrx bindings_fw_brotli 94,532 94,591 +59 (+0.1%) 🔴
octane-tsrx full_fw_gzip 170,500 170,498 −2 (−0.0%) 🟢
octane-tsrx full_fw_brotli 143,508 143,556 +48 (+0.0%) 🔴
octane-jsx js_gzip 59,507 59,505 −2 (−0.0%) 🟢
octane-jsx js_brotli 51,719 51,708 −11 (−0.0%) 🟢
octane-jsx app_gzip 2,858 2,856 −2 (−0.1%) 🟢
octane-jsx app_brotli 2,404 2,411 +7 (+0.3%) 🔴
octane-jsx fw_brotli 49,315 49,297 −18 (−0.0%) 🟢
octane-jsx full_fw_gzip 170,500 170,498 −2 (−0.0%) 🟢
octane-jsx full_fw_brotli 143,508 143,556 +48 (+0.0%) 🔴

24 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
root-static gzip 52,244 52,243 −1 (−0.0%) 🟢
root-static brotli 45,469 45,475 +6 (+0.0%) 🔴
hooks-state gzip 27,754 27,756 +2 (+0.0%) 🔴
hooks-state brotli 24,711 24,764 +53 (+0.2%) 🔴
prop-attributes gzip 27,758 27,761 +3 (+0.0%) 🔴
prop-attributes brotli 24,783 24,730 −53 (−0.2%) 🟢
context gzip 31,462 31,464 +2 (+0.0%) 🔴
context brotli 27,913 27,911 −2 (−0.0%) 🟢
deferred-hydration gzip 69,655 69,654 −1 (−0.0%) 🟢
deferred-hydration brotli 60,091 60,098 +7 (+0.0%) 🔴
hydrate-frame gzip 112,921 112,920 −1 (−0.0%) 🟢
hydrate-frame brotli 96,525 96,595 +70 (+0.1%) 🔴
suspense-transition gzip 44,333 44,334 +1 (+0.0%) 🔴
suspense-transition brotli 38,876 38,882 +6 (+0.0%) 🔴
component-owned-effects gzip 25,131 25,132 +1 (+0.0%) 🔴
component-owned-effects brotli 22,475 22,433 −42 (−0.2%) 🟢
binding-hooks brotli 24,464 24,471 +7 (+0.0%) 🔴
binding-base-ui-vite brotli 54,216 54,181 −35 (−0.1%) 🟢
binding-base-ui-esbuild brotli 60,118 60,044 −74 (−0.1%) 🟢
binding-radix-vite brotli 54,725 54,721 −4 (−0.0%) 🟢
binding-radix-esbuild brotli 60,572 60,557 −15 (−0.0%) 🟢
binding-mantine-hooks-vite gzip 28,364 28,365 +1 (+0.0%) 🔴
binding-mantine-hooks-vite brotli 25,290 25,236 −54 (−0.2%) 🟢
binding-mantine-hooks-esbuild gzip 30,478 30,477 −1 (−0.0%) 🟢
binding-mantine-hooks-esbuild brotli 27,182 27,117 −65 (−0.2%) 🟢
binding-apollo-client-vite gzip 104,683 104,682 −1 (−0.0%) 🟢
binding-apollo-client-vite brotli 91,413 91,288 −125 (−0.1%) 🟢
binding-apollo-client-esbuild brotli 100,843 100,877 +34 (+0.0%) 🔴
binding-usehooks-ts-vite gzip 28,577 28,579 +2 (+0.0%) 🔴
binding-usehooks-ts-vite brotli 25,476 25,458 −18 (−0.1%) 🟢
binding-usehooks-ts-esbuild gzip 30,719 30,718 −1 (−0.0%) 🟢
binding-usehooks-ts-esbuild brotli 27,405 27,412 +7 (+0.0%) 🔴

79 other measured values are unchanged.

dion04 and others added 7 commits October 8, 2026 13:10
The `EVENT_SLOT_PREFIX` constant grew every production bundle by four raw
bytes and pushed `bindings_fw_gzip` and `bindings_js_gzip` over their
committed budgets. Inlining the `'$o'` literal at its three uses returns raw
size to the `main` level; the slot keys are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inlining the bubble event-slot prefix shrank seven measured values below
their committed budget minus headroom, which `--ratchet` rejects. Lower
each budget to the CI measurement plus headroom: root-static,
deferred-hydration and hydrate-frame gzip, binding-radix-esbuild brotli,
the bindings app brotli, and the octane-jsx total and app gzip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@domgan-oai
domgan-oai merged commit d1e308b into octanejs:main Oct 8, 2026
29 checks passed
trueadm added a commit that referenced this pull request Oct 8, 2026
Main c0192ec (#1889, #1872, #1883, #1878 landing together) failed the new
"bundle size checks" job: binding-base-ui-vite measures 62,351 gzip, so the
downward ratchet requires its budget to drop from 62,384 to 62,383.
run-minimal.mjs and run.mjs --write-budgets on that head change nothing else.

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.

Event delegation shares the $$<type> expando with Solid, so handlers fire twice inside Octane roots

3 participants