Repository navigation
perf: keep native signal transition policy out of ordinary roots - #1139
Merged
domgan-oai merged 1 commit intoSep 19, 2026
Merged
domgan-oai merged 1 commit into
domgan-oai merged 1 commit into
Conversation
domgan-oai
marked this pull request as ready for review
September 18, 2026 23:38
This was referenced Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ordinary roots retain the native signal Action queue, preparation, retry, timeout, and publication policy even when the signals model is absent. Move that policy into a coordinator registered by the model and instantiate it when the renderer acquires its first signal Action frame. Keep the renderer's journals, commit wave, and scheduling primitives in their existing owner.
The registration remains live: signals may first load after an async Action awaits, and presentation consumers may receive handles through props without importing signals themselves. No import-name or type-based signal-free proof is introduced.
Refs #1118 and #1130; continues the unused-signals size work in #1135.
Measurements
Matched production bundles against main
330bb0878b42dbc445659c5ea40494067c4ef296, using identical frozen fixtures, lockfile, compiler, and toolchain (Node 24.19.0, Vite 8.1.5, esbuild 0.28.1, Alien 3.2.0). Whole-bundle gzip bytes:createRootexport, esbuildOrdinary SSR stays at 17,728 gzip bytes. The engine remains free of renderer value imports. The new coordinator emits zero bytes in ordinary client closures; the compiled native Action control retains and executes it.
Complete paired audit, source hashes, and reproducible Vite controls.
Validation
The validation commands above ran in ready-for-review CI at
cc21ab461, in addition to the local checks below. Draft-only skipped jobs are excluded from this evidence.pnpm format:check(repo-wide, CI)pnpm typecheck(repo-wide, CI, including the new Node-only model program)pnpm test(CI: all four Node 24 shards plus the dedicated browser, React parity, and integration lanes)node --test benchmarks/scoped-signals/bundle-boundaries.test.mjs: 18 passed, including ordinary-root emitted-byte guards, a real compiled native Action control, and 100 fixed-source primitive/opaque controls.pnpm sync, changeset validation, andgit diff --check.pnpm typecheck.Independent self-review checked rollback, reentrant queues, ref publication, pending boundary timeouts, urgent writes, and disposal. The moved policy matches the previous implementation after translating renderer ports.
Remaining regression against the original integration baseline
A second matched audit compares the exact parent of #1069,
1ed5d2ab9c6291b734a70a102c78b25c8bcdb3d1, its squash5ead1ff2c, and this PR atcc21ab461. The baseline already includes the earlier scoped signals, ViewTransition and native styles. These are reconstructions using the same current installed lockfile/toolchain and byte-identical authored fixtures, rather than historical-lock builds. All 26 production semantic executions pass.The original regression in #1130 is therefore still substantial. This PR's approximately 1 KB gzip saving against current main is a partial reduction, not recovery to the pre-integration baseline. A diagnostic using the parent compiler on both runtimes still leaves 10.64–13.43% growth; current compiler helper selection accounts for a further 2,242–2,902 gzip bytes in four scenarios. The older compiler is only an attribution control because it lacks the new automatic opaque-handle binding contract.
Risk / follow-ups
This is a focused ordinary-client reduction. Both bundlers retain the graph's live coordinator registration in standalone signals and signal-using SSR bundles, producing the size increases above. Removing the registration with a
PUREannotation also removes required activation from combined bundles; moving it solely to native collection would break props-only and post-await model Actions.Native Action preparation now calls renderer primitives through one coordinator host table created on first use. A warmed synchronous happy-dom smoke checked 96,000 Actions with correct publication and stable identities: median 44.66 ms on main versus 45.04 ms here, with overlapping timing ranges. Browser CPU and SSR throughput were not measured; no speed improvement is claimed. The full reported unused-signals regression remains open, and the existing ordinary-entry budgets are already exceeded on main. This PR leaves those budgets unchanged and reports matched deltas separately from budget compliance.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Refactors transition commit/rollback and suspense timeout paths behind lazy coordinator wiring; behavior is intended to match prior logic but touches core rendering and native signal Actions.
Overview
Moves native signal transition orchestration (queue, preparation, retry, publication) out of the ordinary client renderer into a new
transition-coordinatormodule registered by the signals model. The renderer keeps thin delegates and lazily constructs the coordinator on the first signal Action frame, with renderer hooks passed through a neutral runtime port table.Ordinary
createRootbundles no longer emit transition candidate/action/coordinator code (~1 kB gzip in audited fixtures); standalone signals and signal SSR closures retain the coordinator and grow accordingly. Bundle-boundary and minimal-import guards now includetransition-coordinator.ts.Lifecycle coverage expands for late signal import after an async Action, nested
startTransitionstaged reads, and props consumers surviving peer root unmount. CI adds a Node-only signals engine typetest without DOM/renderer types.Reviewed by Cursor Bugbot for commit cc21ab4. Bugbot is set up for automated code reviews on this repo. Configure here.