Repository navigation
fix(compiler): restore the hook-memo ratio guards and gate Lynx bench fixtures in PR CI - #1583
Merged
Merged
Conversation
Since #1069, a renderable `{expr}` hole in a DOM template lowers to the signal-capable `bindSignalChild` binding whenever the module can carry a signal handle, which is any identifier hole. That branch returned before the only-child path that wraps a compiler-owned calculated descriptor array in its `compilerCacheArray` auto-memo region, so an unchanged array inside a component-children body reached `childSlot` for the list and each item on every parent render. The hook-memo provider-output guard `inline_memo_snapshot_slots` rose from 0 to 256 per 128 updates. Wrap the signal-capable binding in the same region. Only an unchanged plain data array can hit; a signal handle or any other value fails `compilerCacheArray` and rebinds every render, and the existing identity miss rebuilds a previously cached array after the hole held something else. The new value-position case switches one calculated child between cached rows and a signal handle. It fails in the production compile when the region's identity miss is dropped, and passes on the uncached path too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hg86UdUyzRwFTLWhpAMdFE
Eight hook-memo ratio guards breached on main (eligible hit functions 704, eligible hit arrays 3,872, and so on) while the inline memo tier's own counts were unchanged. Per-site attribution put every excess event in the runtime's same-component `root.render()` path: the per-update request/retry closures and the root render transaction's undo log, OffscreenCapture arrays and committed-transaction queue, 2 functions and 10 arrays per render in both compiler variants. Bisecting `run.mjs` output found 5f7a457 (#833, root render transactions) to be the first breaching commit; it did not touch this benchmark, and its documented root-transaction cost is unrelated to hooks. Add a hook-free Driver control that runs the identical phase sequence, report every scenario net of the driver's same-phase counts (failing the run if a scenario falls below it), and keep raw counters in the JSON metadata. Two new guards pin the driver's per-update cost at its current 2 functions and 10 arrays so the root update path cannot grow silently. The corrected runner reports identical net counts on both sides of #833, and against 814a3c1 (before closure-free memo lowering) it still breaches the same seven memo guards the original measurement recorded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hg86UdUyzRwFTLWhpAMdFE
The weekly Bench workflow runs the Lynx table-stage and list fixture contracts before its ratio guards. Those tests compile copies of packages/lynx/src, and Lynx changes broke them twice (09-21: an unresolved `octane/internal/context` import; 09-28: a removed `universalBlock` export, fixed on main by #1391). PR CI never ran them, so each break surfaced only in the next weekly run and kept every ratio guard from executing. Add both suites to `ci:workflow:test`, which the lint job runs on every ready pull request, and assert the two lists stay aligned. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hg86UdUyzRwFTLWhpAMdFE
trueadm
marked this pull request as ready for review
October 2, 2026 17:51
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: Cache skip bypasses innerHTML guard
- Added
!cc.potentialDangerouslySetInnerHTMLguard to the signal-childcompilerCacheArraycondition so innerHTML-eligible hosts always runbindSignalChild, matching the existing guard in the ordinary only-child path.
- Added
Or push these changes by commenting:
@cursor push 0a56ace6ad
Preview (0a56ace6ad)
diff --git a/packages/octane/src/compiler/compile.js b/packages/octane/src/compiler/compile.js
--- a/packages/octane/src/compiler/compile.js
+++ b/packages/octane/src/compiler/compile.js
@@ -27537,7 +27537,7 @@
),
),
);
- if (cc.onlyChildText && cc.autoMemoValue === true) {
+ if (cc.onlyChildText && cc.autoMemoValue === true && !cc.potentialDangerouslySetInnerHTML) {
// A calculated value can still hold a signal handle, so it keeps the
// signal-capable binding. Only an unchanged compiler-owned plain data
// array may skip it, exactly as on the ordinary only-child path below;You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit f702046. Configure here.
Contributor
Benchmark report🟢 No size increases and no timing regressions outside noise. Compares js-framework: 1k/10k row operations (ms, lower is better)All 20 timed operations (20 within noise)
Application bundle size (bytes)No changes across 45 measured values. Public-import reachability bundles (bytes)No changes across 105 measured values. |
A host that may receive dangerouslySetInnerHTML, directly or through a spread, must reach its child binding on every render: that call is where children and raw HTML are kept mutually exclusive. The ordinary only-child path already checks this before choosing the cached-array region, but the region restored around bindSignalChild did not, so an unchanged cached array let a spread add raw HTML beside still-mounted rows without the error. Skip the region for such hosts, as the ordinary path does. The new spread case fails in the production compile without the guard. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hg86UdUyzRwFTLWhpAMdFE
This was referenced Oct 2, 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
node benchmarks/bench.mjs --ratios hook-memobreached 9 guards on main. Neither cause is in the inline memo tier: application-side memo counts were exactly at their designed values. Two unrelated changes produced the breaches, and the weekly Bench job never reached its ratio step to report them.1. Eight hook-allocation guards: root update cost, not memo cost (harness attribution)
root.render()path. That is 2 functions per update (renderOwner.request,renderOwner.retry) and 10 arrays per update (the root transaction'sOffscreenCaptureeight, its undolog, andROOT_RENDER_TRANSACTIONS). Both compiler variants show the same counts.git bisectoverrun.mjsoutput (each commit's own runner, current dependencies) gives first bad commit 5f7a457 (fix: retain suspended roots without a boundary #833, root render transactions). Its parent measures 0/0 on every eligible hit. fix: retain suspended roots without a boundary #833 never touched this benchmark, andpackages/octane/audit/root-suspension-performance.mddocuments this cost as accepted.Drivercontrol runs the identical phase sequence. Every scenario is reported net of the driver's same-phase counts, and the run fails if a scenario falls below the driver. Raw counts stay in the JSON. Two new guards (driver_hit_functions≤ 2/render,driver_hit_arrays≤ 10/render) pin the root update cost so it can't grow silently.2.
inline_memo_snapshot_slots(provider-output): a real compiler regression{expr}hole now lowers to the signal-capablebindSignalChildbinding. That branch skipped thecompilerCacheArrayauto-memo region the only-child path wraps around compiler-calculated descriptor arrays. As a result an unchanged list reachedchildSlottwice per update, for the list and its item.compilerCacheArrayand rebinds every render, and the identity miss rebuilds a previously cached array. The count returns from 256 to 0.3. Why CI never saw this
The weekly Bench run failed before
--ratiosfor different reasons over time:run.mjscouldn't importoctane, since fixed on maininstrument-source.test.mjs:Could not resolve "octane/internal/context"in a copiedmain-renderer.tsfirst-screen-template.test.mjs:No matching export ... "universalBlock", fixed on main by #1391 (09-29)These Lynx stage/list tests compile copies of
packages/lynx/srcbut only ran weekly, so source changes broke them unseen. This PR adds both suites toci:workflow:test, which the lint job runs on every ready PR, and asserts that the PR list stays aligned withbench.yml. On this branch every pre-ratio step ofbench.ymlpasses locally.Validation
pnpm format:check(scopedpnpm format:files:checkon changed files: clean)pnpm typecheck(scopedpnpm typecheck:files: clean)pnpm test(not run in full; see targeted)vitest packages/octane/tests/compiler --project octane: 3,571 passed, 1 skipped; auto-memo and auto-calculation suites: 296/296node benchmarks/bench.mjs --ratios hook-memo: 24/24 guards pass (was 9 breaches)vitest --project octane --project octane-prod: 37,009 passed, 5 failed, all inbehavior-root.test.ts(a 15 s timeout under CPU load, and'use dom bindings'getter re-reads). That test's compiled output is byte-identical with main's compiler, and this PR doesn't touch the runtime or that test, so these failures already happen on main in this environment (Node 22.22.0, versus Node 24 in CI)auto-memo-value-positionsignal round-trip case: fails inoctane-prodwhen the region's identity miss is removed, and passes on the uncached pathpnpm ci:workflow:test: 325/325 on the rebased head, and the new workflow assertion fails without the Lynx gatenode --test benchmarks/hook-memo/instrument.test.mjs: 2/2node benchmarks/bench.mjs --quick --ratios: stopped after 102/125 suites at the 2 h limit. Over the 101 written results, the committed guards show 23 breaches, none in hook-memo. The deterministic ones (template-call-memo,transition-hooks) are identical when run against main's source. Pre-existing gate failures:tsrx-component-graph(also fails on main),hook-store-composition(fixture compiles identically to main), andink-cursor-update(timing under load)pnpm sync(no generated changes),pnpm changeset:check,pnpm test:markers:checkRisk / follow-ups
--ratiosstep will still be red from breaches and gate failures that already exist on main and are independent of this PR (listed under Validation). They need their own fixes.root.render()update. That was fix: retain suspended roots without a boundary #833's documented trade-off. Lazy or reused capture buffers and stable request/retry functions would lower the new driver ceilings. That is a separate runtime optimization that needs timing evidence.autoMemo, which is the scope the region had before feat: add async signals and streaming SSR #1069.Provenance
agent-authored)🤖 Generated with Claude Code
https://claude.ai/code/session_01Hg86UdUyzRwFTLWhpAMdFE
Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
The compiler change alters only-child reconciliation when values may be signals or cached arrays; tests cover the main transitions, but the path is update-hot and easy to regress.
Overview
Restores
compilerCacheArrayaround the signal-capablebindSignalChildpath when an element’s only child is a compiler-calculated descriptor array underautoMemo. After async signals made every child hole signal-capable, that branch stopped skipping reconciliation for unchanged plain arrays; snapshot-slot churn and extra list walks are fixed while signal handles and identity changes still rebind every render. Hosts that might getdangerouslySetInnerHTMLstay on the uncached binding.The hook-memo harness adds a hook-free
Drivercontrol and reports scenario allocation counts net of per-root.render()transaction cost (closures and capture arrays from #833), with newdriver_hit_*ratio guards so the root update path cannot grow unnoticed. Docs andratios.jsonreflect the attribution.PR CI now runs the Lynx table/list bench fixture tests via
ci:workflow:test, aligned with weeklybench.yml, so Lynx breakages are caught before ratio steps. New auto-memo-value-position tests cover toggling between cached rows and a signal handle and rejecting raw HTML beside unchanged cached rows.Reviewed by Cursor Bugbot for commit 76843ce. Bugbot is set up for automated code reviews on this repo. Configure here.