Skip to content

feat(compiler): allow zero-argument binding views - #1568

Merged
trueadm merged 4 commits into
mainfrom
claude/admiring-herschel-09e2be
Oct 2, 2026
Merged

trueadm merged 4 commits into
mainfrom
claude/admiring-herschel-09e2be

Conversation

@trueadm

@trueadm trueadm commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Why

  • The binding compiler required exactly one props parameter. The downstream machinery already handled zero parameters (local child views compile through the same path with no props), so the gate was the only blocker.
  • This makes islands eligible but removes no bytes from a real page by itself. Only step 6 (renderer-free activation plus an islands-only route mode) does.

Changes

  • packages/octane/src/compiler/dom-bindings.js: drop the required && params.length !== 1 clause and reword the diagnostic. Views with two or more parameters still fail with "ordinary props parameter".
  • packages/octane/tests/behavior-root.test.ts: zero-argument views over module signals (a scalar Label and a Counter with a click handler) adopt renderToString output early, rehydrate through hydrateRoot with no diagnostics, and mount fresh, in dev and prod. Also a two-parameter rejection.
  • benchmarks/scoped-signals/bundle-boundaries.test.mjs: new CI guard "zero-argument island views adopt module signals without the renderer", for TSRX and TSX. It builds a production island that uses the public adoptBindings and imports its state from a separate module, and asserts the renderer is not in its esbuild graph. A hydrateRoot build of the same view is the positive control. The island adopts real SSR output and is exercised through a click, signal writes and disposal.
  • Docs: a note in docs/deferred-hydration.md, and a Renderer-free island activation: binding-view gates and an islands-only route mode #1514 progress table in docs/hydration-islands-plan.md.
  • Changeset: octane patch.

Activation still takes a BindingSource; a zero-argument view never reads its snapshot. Making the source optional would be a public API change, so it is left out. Step 6's generated activator can pass a constant source.

Performance audit

  • Existing views: the change only narrows a rejection predicate. Every view accepted before is accepted now and compiles through the same code, so output for one-parameter views is unchanged.

  • Compiled artifact, same view with and without props: binding artifact 1,171 B / 519 B gzip (zero-argument) vs 1,183 B / 522 B gzip (props). Ordinary component output 1,493 B / 654 B vs 1,491 B / 653 B.

  • Bundle guard diagnostics (esbuild, production, minified, gzip-9):

    Entry TSRX TSX
    Zero-argument island via adoptBindings (signals engine + binding program, no renderer) 28,126 B 28,128 B
    Same view via hydrateRoot (control) 106,749 B 103,093 B

    These are synthetic reachability numbers, not page savings: a real route still hydrates its shell with the renderer until step 6.

  • Baseline for step 6: examples/signal-chat production build on main @ 4ab33b6 (before the merge) is 156.4 KB gzip-9 of client JS, with the renderer chunk at 96.1 KB (61%).

Validation

All on the merged head (current origin/main merged in).

  • pnpm format:check: not run repo-wide. pnpm format:files:check passes on every changed file.
  • pnpm typecheck: the full run was stopped at a 30-minute limit under heavy machine load, so it did not finish. These passed instead:
    • octane-tsc -p packages/octane/tsconfig.json
    • pnpm typecheck:files on the changed source and test files, which reports only the two existing errors in behavior-root.test.ts at lines 3479 and 3711, outside this diff.
  • pnpm test: not run in full locally; CI runs it.
  • targeted tests:
    • behavior-root.test.ts: the zero-argument, rejection and fix: diagnose eager imported signal samples in DOM bindings #1304 read-diagnostic tests, in both the octane and octane-prod projects. Two of the diagnostic tests timed out once under that load (20+ s); rerun alone, all 8 of their runs pass.
    • node --test benchmarks/scoped-signals/bundle-boundaries.test.mjs: 32/32 pass.
  • Mutation checks:
    • Restoring the old gate fails the behavior test (4 failures across projects and modes) and the bundle guard (build error).
    • Removing the two-or-more-parameter rejection fails the rejection test.
  • pnpm sync leaves the tree clean.

Plan for the rest of #1514 (not in this PR)

  • Step 3, subscribed reads:
    • Evaluate const aliases once per fragment, including in @if/@for arms; today they are copied into every projector and arm-local declarations are rejected.
    • Collect each fragment's native reads, including reads that throw, and re-run it when one changes.
    • Lower .latest(fallback), and drop the Port the Base UI list-navigation and typeahead infrastructure (Phase 3e) #308 diagnostic where reads become subscribed.
  • Step 4, mount-only effects: useLayoutEffect(cb, []) becomes a new activation adapter kind, not a ref. It runs once after the whole tree activates, child before parent, under the captured owner, and its cleanup runs on dispose. The ready flag pattern is lowered too.
  • Step 5, @try/@pending/@catch:
    • A try region kind whose arm is selected by the step-3 reads: a thrown thenable selects @pending, any other error selects @catch.
    • Binding-annotated server markers for the arms.
    • Client-constructible arms, and a renderer-style claim for a boundary still streaming at activation.
    • A deferred reset.
  • Step 6a, renderer-free island activation: an independent island whose only child is a no-props binding view imports a ?octane-island= artifact compiled from the view's own module, which falls back to the renderer activator without the directive. A renderer-free activator adopts the island range and replays captured intents; cloneHydrationReplayEvent moves out of runtime.ts.
  • Step 6b, islands-only route mode:
    • An opt-in route option and a second generated entry that never imports octane; full routes keep today's entry.
    • The Vite plugin discovers islands and shell CSS by transforming the route's imports without bundling them.
    • The build fails closed when the shell has client work. Rspack refuses the mode at first.
  • Coupling to note: every async .get() in the audited islands sits inside a @try arm, so those islands need steps 3 and 5 together.

Risk / follow-ups

  • Low. The diff relaxes one compile-time gate; accepted inputs and their output are unchanged.
  • Binding event handlers run without restoring a custom signal owner. Module declarations still resolve to the document's cells because compiled state modules install the document owner. This is now noted in docs/hydration-islands-plan.md.

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

Low Risk
Narrows a compile-time rejection rule; runtime and one-parameter binding output stay the same, with new tests guarding renderer-free adoption.

Overview
'use dom bindings' views can omit the props parameter when they only read module-scope signals (typical island state). The binding compiler no longer requires exactly one props argument; views with two or more parameters still fail. One-parameter views compile unchanged.

This is step 2 of renderer-free island activation (#1514): it unlocks binding compilation for no-props islands but does not remove renderer bytes from real routes until later steps.

Coverage: dom-bindings.js diagnostic text update; behavior-root.test.ts for adopt, hydrateRoot, and mount over module signals; bundle-boundaries.test.mjs asserts TSRX/TSX islands using adoptBindings stay off the renderer graph (with hydrateRoot as control). Docs note that BindingSource is still required and its snapshot is unused for zero-arg views; the islands plan marks step 2 done.

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

trueadm and others added 2 commits October 2, 2026 15:15
A 'use dom bindings' view that reads only module-scope signal handles may
now declare no props parameter, as an independent island does. It compiles
for adoptBindings, mountBindings and server rendering like a view with props;
views with more than one parameter are still rejected.

A bundle-boundaries guard builds such an island in production for TSRX and
TSX, asserts its graph excludes the renderer (with a hydrateRoot control),
and adopts real SSR output through clicks, signal writes and disposal.

Refs #1514

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 feat PR: new feature or capability labels Oct 2, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 2, 2026 14:58
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No size increases and no timing regressions outside noise.

Compares 3994e1ea0 with 27d8e75e4 on the same runner. Timing verdicts require a change beyond the combined margin of error (at least 5%) and one 0.1ms timer tick, with the fastest sample also moving beyond that margin. Workflow run

js-framework: 1k/10k row operations (ms, lower is better)

All 20 timed operations (20 within noise)
target operation base head Δ noise
octane-tsrx run 3.96 3.72 −6.1% ±22% ⚪ within noise
octane-tsrx replace 8.59 8.80 +2.4% ±65% ⚪ within noise
octane-tsrx add 3.96 3.52 −11.1% ±18% ⚪ within noise
octane-tsrx update 0.44 0.54 +22.7% ±71% ⚪ within noise
octane-tsrx select 0.25 0.26 +4.0% ±66% ⚪ within noise
octane-tsrx swap 0.45 0.51 +13.3% ±74% ⚪ within noise
octane-tsrx remove 0.48 0.46 −4.2% ±46% ⚪ within noise
octane-tsrx runlots 33.25 33.15 −0.3% ±29% ⚪ within noise
octane-tsrx select_lots 0.26 0.26 +0.0% ±47% ⚪ within noise
octane-tsrx clear 42.01 45.26 +7.7% ±21% ⚪ within noise
octane-jsx run 4.46 3.99 −10.5% ±45% ⚪ within noise
octane-jsx replace 9.92 8.44 −14.9% ±36% ⚪ within noise
octane-jsx add 3.49 3.30 −5.4% ±17% ⚪ within noise
octane-jsx update 0.62 0.61 −1.6% ±37% ⚪ within noise
octane-jsx select 0.44 0.47 +6.8% ±46% ⚪ within noise
octane-jsx swap 0.73 0.76 +4.1% ±40% ⚪ within noise
octane-jsx remove 0.61 0.82 +34.4% ±38% ⚪ within noise
octane-jsx runlots 28.65 32.46 +13.3% ±12% ⚪ within noise
octane-jsx select_lots 2.62 2.75 +5.0% ±46% ⚪ within noise
octane-jsx clear 47.06 45.71 −2.9% ±22% ⚪ within noise

Application bundle size (bytes)

No changes across 45 measured values.

Public-import reachability bundles (bytes)

No changes across 105 measured values.

CI job durations

  • 🟡 7 job(s) slower than every recent main run: test shard (Node 24, 2/4), test shard (Node 24, 3/4), test shard (Node 24, 1/4), test shard (Node 24, 4/4), lint checks, validate publishable packages, example apps (1/3)
  • 🟢 1 job(s) faster than every recent main run: typecheck checks

Compares the CI run for c3469d948 (run) with the last 5 successful main push runs. A job is only slower or faster outside the whole main range, by at least 10% and 15s. Job time excludes runner setup.

The run concluded failure; only successful jobs are timed.

job main median main range this PR Δ
wall clock (first job start to last job end) 11m 36s 8m 33s–15m 14s 14m 31s +2m 55s (+25%) ⚪ partial run
total job time 91m 45s 87m 44s–105m 20s 145m 37s +53m 52s (+59%) ⚪ partial run
test shard (Node 24, 2/4) 5m 23s 5m 07s–5m 37s 12m 59s +7m 36s (+141%) 🟡 slower
test shard (Node 24, 3/4) 5m 18s 5m 15s–5m 28s 12m 49s +7m 31s (+142%) 🟡 slower
test shard (Node 24, 1/4) 6m 01s 5m 53s–6m 23s 13m 13s +7m 12s (+120%) 🟡 slower
test shard (Node 24, 4/4) 5m 50s 5m 45s–6m 04s 12m 42s +6m 52s (+118%) 🟡 slower
lint checks 3m 21s 3m 15s–3m 37s 8m 23s +5m 02s (+150%) 🟡 slower
validate publishable packages 2m 29s 2m 15s–2m 29s 4m 21s +1m 52s (+75%) 🟡 slower
example apps (1/3) 3m 00s 2m 51s–3m 17s 3m 32s +32s (+18%) 🟡 slower
typecheck checks 4m 46s 4m 32s–4m 52s 2m 47s −1m 59s (−42%) 🟢 faster

Not compared (skipped, failed, or not run on this pull request): React parity checks, Lynx compatibility (minimum), Lynx compatibility (current), heavy integration (astro), heavy integration (browser), heavy integration (package-builds), Three compatibility (current), heavy integration (eval-corpus), Three compatibility (minimum r156), test shard (Node 22.22.2, 1/4), heavy integration (runtime-loaders), test shard (Node 22.22.2, 3/4), test shard (Node 22.22.2, 2/4), test shard (Node 22.22.2, 4/4), test (24), test (22), CI provenance.

All 22 timed jobs
job main median main range this PR Δ
heavy integration (package builds, eval corpus, runtime loaders, Astro) – – 6m 21s – 🆕 new
React parity shard (1/4) – – 11m 16s – 🆕 new
heavy integration (browser - chromium) – – 14m 00s – 🆕 new
Three compatibility – – 3m 21s – 🆕 new
React parity shard (4/4) – – 11m 50s – 🆕 new
Lynx compatibility – – 2m 11s – 🆕 new
React parity shard (2/4) – – 10m 44s – 🆕 new
test shard (Node 24, 2/4) 5m 23s 5m 07s–5m 37s 12m 59s +7m 36s (+141%) 🟡 slower
test shard (Node 24, 3/4) 5m 18s 5m 15s–5m 28s 12m 49s +7m 31s (+142%) 🟡 slower
test shard (Node 24, 1/4) 6m 01s 5m 53s–6m 23s 13m 13s +7m 12s (+120%) 🟡 slower
test shard (Node 24, 4/4) 5m 50s 5m 45s–6m 04s 12m 42s +6m 52s (+118%) 🟡 slower
lint checks 3m 21s 3m 15s–3m 37s 8m 23s +5m 02s (+150%) 🟡 slower
website integration suite 3m 49s 3m 44s–14m 07s 6m 43s +2m 54s (+76%) ⚪ within noise
validate publishable packages 2m 29s 2m 15s–2m 29s 4m 21s +1m 52s (+75%) 🟡 slower
example apps (2/3) 3m 23s 2m 55s–5m 23s 4m 12s +49s (+24%) ⚪ within noise
example apps (3/3) 2m 59s 2m 55s–9m 45s 3m 48s +49s (+27%) ⚪ within noise
example apps (1/3) 3m 00s 2m 51s–3m 17s 3m 32s +32s (+18%) 🟡 slower
classify changeset release 10s 7s–10s 16s +6s (+60%) ⚪ within noise
typecheck 2s 2s–3s 3s +1s (+50%) ⚪ within noise
examples 2s 1s–3s 3s +1s (+50%) ⚪ within noise
lint 2s 1s–3s 3s +1s (+50%) ⚪ within noise
typecheck checks 4m 46s 4m 32s–4m 52s 2m 47s −1m 59s (−42%) 🟢 faster

@trueadm
trueadm merged commit f03d812 into main Oct 2, 2026
52 of 56 checks passed
@trueadm
trueadm deleted the claude/admiring-herschel-09e2be branch October 2, 2026 16:18
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 feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant