Repository navigation
fix: recover the template-call-memo, transition-hooks, signal-favoring and SSR metadata ratio guards - #1591
Merged
Conversation
…g and SSR metadata ratio guards Four ratio suites breached deterministic guards on main. Each was bisected over the suite's own output, with every old checkout on its own installed dependencies. - template-call-memo (0df8be7, #1265): a Strong `@for` row calling `console.log` lost DEP-PURE because `console` is a host global. The receiver of a statement-position `console.method()` call no longer counts as an ambient row read; its arguments still do. - ssr-final-metadata (5ead1ff, #1069): `ssrComponent` re-encoded a keyed descriptor's key that ssrChildValue's `child-key` membrane already holds. ssrChildValue now passes `identityScoped: 'key'`. - transition-hooks (5ead1ff, #1069; 8a45222, #1068): runTransition's native candidate resolver and fireEventSlot's invoke callback no longer allocate a closure per transition or delegated event. The pooled event frame's first allocation gets a one-time work-model allowance. - signal-favoring (5ead1ff, #1069): the JSX static-fragment fold matches `_$createElementFromConfig(site, C, props)` again, and bindSignalChild keeps textHoleUpdate's primitive fast path. Bump samples are calibrated to 20 ms because a TSRX bump sat under Chromium's 100 us clock floor; the dialect ceiling moves to 18 from same-runner measurements before #1069 and after this fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 2, 2026 18:38
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Pending skip poisons text token
- Hoisted the pending-state condition into a
pendingSkipvariable and gated thereturn primitiveToken ? value : texton!pendingSkip, so a pending render no longer stores the new primitive as the token and the subsequent committed render correctly writes via setText.
- Hoisted the pending-state condition into a
Or push these changes by commenting:
@cursor push 1b171eae50
Preview (1b171eae50)
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -35652,11 +35652,8 @@
value !== null &&
type !== 'object' &&
type !== 'function';
- if (
- primitiveToken &&
- prior === null &&
- !(CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate)
- ) {
+ const pendingSkip = !!(CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate);
+ if (primitiveToken && prior === null && !pendingSkip) {
const state = parentScope.slots[slotKey] as ChildSlot | undefined;
if (
state !== undefined &&
@@ -35686,7 +35683,7 @@
if (WIP_CAPTURE === null) finish(false);
else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
}
- return primitiveToken ? value : text;
+ return primitiveToken && !pendingSkip ? value : text;
}
if (prior !== null && !prior.disposed && prior.handle === value) {
const next = readSignalBinding(value);You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 6812f00. Configure here.
Contributor
Benchmark report
Compares js-framework: 1k/10k row operations (ms, lower is better)All 20 timed operations (20 within noise)
Application bundle size (bytes)
7 other measured values are unchanged. Public-import reachability bundles (bytes)
33 other measured values are unchanged. |
…-JSX budget bindSignalChild returned the new primitive as its token even when the block was already pending, so childSlot skipped the write. The repeated render then matched that token and left the previous text in place. A skipped pass now keeps the token unpublished; the new test drives a mid-render self-update through an earlier hole. invokeEventSlot is an if/else chain without the redundant bundle alias, which brings root-chained-jsx back to its raw and gzip ceilings. Removing the per-event closure still costs 2 brotli bytes, so that budget moves one 32-byte step to 25344. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # benchmarks/bundle-size/minimal-budgets.json
Fold the pending-pass check into the primitive-token flag and drop the ownsHost test: only the implicit childSlot path passes ownsHost, and that path's implicitSignal already keeps it off the fast path. Saves 36 raw and 19 gzip bytes in bundles that reach bindSignalChild. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 task done
trueadm
added a commit
that referenced
this pull request
Oct 3, 2026
…ive (#1643) Since #1069 a `{props.value}` hole that is its host's only child compiles to bindSignalChild, because the value can carry a signal handle. The binding kept the Text node as its token, so every render went through updateTextValue, which reads nodeValue to compare. 128 unchanged updates now made 128 live nodeValue reads where the compiled childTextHoleUpdate path made none. An unchanged value also overwrote an outside edit to the text. The only-child path now keeps the last written primitive as its token, like #1591 did for marker-bounded holes. An unchanged primitive returns before any DOM read; raw HTML still claims the host first. The token's Text node is the host's first child. A changed primitive or a switch to a signal handle recovers it from there. A primitive becomes the token only where that position is proven: - by the previous token; - by a client mount's empty template; - otherwise by one comparison, because hydration can keep unclaimed server content ahead of the node it adopted. A staged ViewTransition render keeps the Text token. Restores root-transactions equal_reads text-compiled to 0 (guard maxRatio 0). Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Four ratio suites breached deterministic guards on main. The weekly Bench job never reported them, because it has failed before its
--ratiosstep since late August. Each breach was bisected over the suite's own output, with every old checkout running on its own installed dependencies. Five are framework regressions and are fixed in the owning code. Two are harness problems, corrected and documented in the suite READMEs. After the fix, every suite's--ratiosrun passes.stable_reads/stable_logs512 (max 0),insert_reads9.25,snapshot_reads9.5,reorder_reads18encoded_units58.6 (max 52.5),identity_key_encodings5.02 (max 4.02)cycle/updater/clickruntime functions,click_runtime_objects257bump_shallow33.8× (max 5.5), plus 30 failingwork.mjsgatesWhy and changes
template-call-memo (#1265). #1265 keeps keyed
@forrows live when they read mutable globals.consoleis a host global, so a Strong-mode row containingconsole.log('row', item.id)lost DEP-PURE and re-ran every render.docs/differences-from-react.mddocuments that diagnostic calls do not disqualify reuse. The ambient-read check now ignores the globalconsolereceiver of a statement-positionconsole.method(…)call. Every console operation returns undefined, and the call's arguments still count as row reads. A module binding namedconsolekeeps the row live.ssr-final-metadata (#1069).
ssrComponentDescriptorstarted passing the descriptor key tossrComponentfor signal instance keys.ssrComponentthen also appended|@component-key:, althoughssrChildValue'schild-keymembrane already encodes the same key inside the same list item scope.ssrChildValuenow passesidentityScoped: 'key', which skips only that duplicate segment. Signal instance keys still receive the key, andssrDescriptorPart, which has no enclosing key membrane, keeps the segment. The counts return to the audited 514 encodings and 6,712 units.transition-hooks (#1069, #1068). Per-site attribution maps each creation event through the source map to its
runtime.tsline. It found:runTransitionallocated asetNativeCandidateResolver(() => …)closure per transition, plus a lazily registered Action resolver closure. Both are now module functions; the transition resolver readsACTIVE_TRANSITION_ACTION_BATCH, which is that transition's batch while it is installed.fireEventSlotallocated aninvokeclosure per delegated handler. The body is nowinvokeEventSlot, and a callback is created only when the handler enters another signal owner.click_runtime_objectsgets a one-time allowance of 1 in the work model. Its per-cycle budget of 4 is unchanged.The suite's
cycle/updater/clickbreaches are not the #833 root-transaction cost that #1583 attributes inhook-memo: every cycle here is a hook update.signal-favoring (#1069).
_$createElementFromConfig(site, C, props). The static-fragment fold (perf: lower proven JSX components through compiled renderers #619) still matched only_$createElement(C, props), so every private static link fell back to a full component slot plus a descriptor child slot. The proof now matches the new descriptor, and reads the body-call record that fix(octane): defer JSX returned by direct calls of named functions #1378 later split out. All 90 lite slots are restored.ctx.signalBindingsUsedflag flips on any prop-bound attribute, after which identifier holes compile tobindSignalChild. For a primitive, that always went throughchildSlot.bindSignalChildnow keepstextHoleUpdate's fast path for an ordinary marker-bounded hole. The token is the last primitive (never an object). A changed primitive is onesetText, and an unchanged one does nothing. Pending blocks, raw-HTML hosts, implicit bindings, and non-text modes still takechildSlot.1ed5d2ab9measures 14.66–15.26×, and this branch 13.23–13.26×. The 5.5 ceiling was below the true pre-regression ratio, so it moves to 18. The feat: add async signals and streaming SSR #1069 regression (~72×) still breaches it widely.Bisect evidence
Old checkouts used
git worktree add --detachpluspnpm install --frozen-lockfile --prefer-offline --filter …, sinceoxc-tsrx→@tsrx/oxcand other dependency changes prevent reusing current dependencies.git bisect runfrom 42256eb (guard landed, strongstable_logs0) to 18fbcb0 → 0df8be7. Its parent compiles LoggedRows'forBlockwith flags 30, and 0df8be7 with 26 (DEP-PURE bit cleared).ssrComponentstring-key encoding per row.click_runtime_objectsfirst fails at 8a45222 (256 → 257). The function counters are still clean at fe1b2b7, and a second bisect gives 5ead1ff (cycle 128 → 193, updater 64 → 128, click 0 → 64).bindSignalChildand TSX lite slots 90 → 0 both start at 5ead1ff, with parent 1ed5d2a clean. The TSXdeferRecordwrapper comes from df0a086 (fix(octane): defer JSX returned by direct calls of named functions #1378), a correctness change whose body-call path renders the same descriptors.Validation
node benchmarks/bench.mjs --ratios <suite>on the final head (rebased on 0b0e10f, which includes fix(compiler): restore the hook-memo ratio guards and gate Lynx bench fixtures in PR CI #1583): template-call-memo 13/13, transition-hooks 42/42, ssr-final-metadata 15/15, signal-favoring 2/2 plus all deterministic work gates (counts identical to the 2026-09-14 baseline; full nine-target runs measured 14.19× and 13.45×), and hook-memo 24/24 alongside fix(compiler): restore the hook-memo ratio guards and gate Lynx bench fixtures in PR CI #1583for-item-purity.test.ts: Strong console diagnostic rows keep PURE/DEP-PURE. Controls: a moduleletin the arguments, a modulelet console, and compatibility mode. The positive cases fail before the fix; the module-binding control fails when its guard is removed.direct-signal-bindings.test.ts: a signal-capable text hole beside siblings updates in place (same Text node, exactly one characterData mutation, none when unchanged) through boolean, element, signal-handle and primitive values. It fails for a never-write and an always-write fast path, and passes on main's runtime, so it pins preserved behavior.direct-signal-bindings.test.ts: a text hole skipped by a pending pass (an earlier hole updates the component's own state mid-render) is written by the repeated pass. Bugbot found this; it showed stalen:atbefore the fix.signals-action-lifecycle.test.ts(octane-signals) fails 5 cases when the transition resolver returns no candidate.event-signal-owner.test.tsfails when the owner-switch branch skipsrunWithSignalOwner.for-item-purity,jsx-context-children(octane + octane-prod; its prod fixture now folds twice, main folds zero times),returned-jsx-direct-calls/switch-fold/try-fold(octane + octane-prod),ssr-deopt-list-identity,ssr-async-identity-*,hydration/direct-signal-bindings,hydration/mismatch-*,compiler/ssr-tsx-children,compiler/component-tag-names,same-file-void-root,universal-renderer,event-signal-owner,signals-action-lifecyclepnpm typecheck:fileson the changed TypeScript files;pnpm format:fileson every changed filepnpm test,pnpm typecheck,pnpm format:check(not run in full locally; left to CI)Risk / follow-ups
_fragrenderers. That is true on main without this PR. The fold moves the client toward the server shape. That parity gap is filed separately.bindSignalChildfast path applies to plain marker-bounded holes only. Only-child, binding-marker andownsHostholes keep their existing paths.run-minimal.mjs:bindSignalChildgrow by about 14 raw bytes forinvokeEventSlot(root-chained-jsx86,001 / 28,540 / 25,331 against main's feat(islands): renderer-free island activation and islands-only routes #1582 ceiling of 86,016 / 28,544 / 25,344; all PR-gated budgets pass).bindSignalChild(root-static, the base-ui/radix/apollo bindings, the JSX app) grow by about 357 raw / 89 gzip bytes. That is the restored primitive text fast path, which feat: add async signals and streaming SSR #1069 had replaced with a fullchildSlotper text update in every signal-capable module.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches compiler fold proofs, SSR async-identity encoding, signal child reconciliation, and transition/event dispatch—high-impact paths, but changes are targeted regression fixes with dedicated tests and deterministic suite gates.
Overview
Restores several ratio-suite guards that broke on main after async-signals work (#1069), plus related compiler, client runtime, SSR, and benchmark harness updates.
Compiler: Private static JSX components fold through the parent template again by recognizing
_$createElementFromConfig(site, Component, props)(and the direct-call body record from #1378), not the old two-argument_$createElementshape. Strong-mode keyed@forrows can stay DEP-PURE when the only ambient read is a statement-positionconsole.method(…)on the globalconsole; argument reads still count, and a moduleconsolebinding keeps the row live.Client runtime:
bindSignalChilduses the primitive text-hole fast path (unchanged value → no work; changed → onesetText) for ordinary marker-bounded holes in signal-capable modules. Transitions and delegated events stop allocating a resolver/handler closure on every call—module functions read the active batch, andrunWithSignalOwneronly wraps handlers that enter another owner.SSR: Keyed descriptors reached via
ssrChildValueno longer double-encode the same key in async identity scope.Benchmarks: Signal-favoring bump timing calibrates batch size to ≥20 ms per sample (fixes ratio noise from Chromium’s 100 µs clock);
bump_shallowmax ratio moves to 18. Transition-hooks work model allows one one-timeclick_runtime_objectsfrom the delegated frame pool (#1068).Reviewed by Cursor Bugbot for commit 688d178. Bugbot is set up for automated code reviews on this repo. Configure here.