Repository navigation
Conversation
… … }` blocks A nested block got a signal instance of its own, so a component handle it read resolved to a second cell: a second query request, and a value computed from signals the component never updated. The block now links to the template that renders it, as directive arms and keyed rows do, on the client and the server. It still owns the declarations it evaluates. Fragment renderers link to their component the same way, so a nested block in returned JSX reads the component's cells below the root too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A host or fragment renderer copies the recipe of the scope it renders for, including a nested block's `t:` site, so it was treated as a block and linked past it to the block's parent. A block nested in that renderer then missed the outer block's declarations and started its own query. Check the key first: a renderer keeps its parent's key and links to it, and only a scope that adds a segment of its own links to the scope that rendered it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nto fix/nested-block-signal-owner
…nent A hookless component's blocks hang off a DOM stand-in rather than its scope, and the stand-in has no owner of its own. A renderer the component renders, such as value-position JSX, therefore skipped the link, and a nested block in it read a handle prop from a cell of its own. The stand-in records the scope the component is registered on, so resolve the component's scope from that scope's children. Arms inside a hookless component now link the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t passes
Compiled `.tsrx` children rendered in the receiving component's signal
instance, so `<Card>{record$.get()}</Card>` gave the read a cell of its own:
a second query in the browser and on the server, and derived reads computed
from signals the author never updated. `.tsx` children are evaluated by the
parent, so they already read the author's cells.
markChildrenBlock now records the owner the authoring template renders in.
On the client, a block whose body is those children, and a context provider
that renders them inline, link their owner to it. On the server, children
rendered in a slot link the same way, and Suspense, ViewTransition,
ErrorBoundary and context providers, which render them inline in their own
frame, carry a new capability bit so their owner links to the author.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)❌ 26 value(s) exceed their committed budget. Reduce the growth, or raise the budget in a separate pull request that names the bytes and the reason (CONTRIBUTING.md, "Size budgets").
9 other measured values are unchanged. Public-import reachability bundles (bytes)❌ 55 value(s) exceed their committed budget. Reduce the growth, or raise the budget in a separate pull request that names the bytes and the reason (CONTRIBUTING.md, "Size budgets").
33 other measured values are unchanged. |
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: Children owner symbol is copy-local
- Changed CHILDREN_SIGNAL_OWNER from Symbol() to Symbol.for('octane.childrenSignalOwner') in both runtime.ts and runtime.server.ts so the owner stamp survives across multiple Octane runtime copies, matching the existing pattern used by CHILDREN_BLOCK and CHILDREN_BODY.
Or push these changes by commenting:
@cursor push 6fe9deddd9
Preview (6fe9deddd9)
diff --git a/packages/octane/src/runtime.server.ts b/packages/octane/src/runtime.server.ts
--- a/packages/octane/src/runtime.server.ts
+++ b/packages/octane/src/runtime.server.ts
@@ -513,7 +513,7 @@
// Compiled children are part of the template that authored them, not of the
// component rendering them. markChildrenBlock records the owner that template
// renders in, and the children's owner links to it (runtime.ts does the same).
-const CHILDREN_SIGNAL_OWNER: unique symbol = Symbol() as any;
+const CHILDREN_SIGNAL_OWNER: unique symbol = Symbol.for('octane.childrenSignalOwner') as any;
let SIGNAL_COMPONENT_INSTANCE_KEY: ServerSignalInstanceKey = '';
let SERVER_SIGNAL_OWNER_ACTIVE = false;
let SIGNAL_CONTROL_SITE = '';
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
@@ -14839,7 +14839,7 @@
// their parent are. markChildrenBlock records the signal owner that template
// renders in, and scopeSignalOwner links the children's owner to it. A render
// runs in an owner identity, which never retains its renderer tree.
-const CHILDREN_SIGNAL_OWNER: unique symbol = Symbol() as any;
+const CHILDREN_SIGNAL_OWNER: unique symbol = Symbol.for('octane.childrenSignalOwner') as any;
/**
* Compiler-emitted: attach markerless single-host-root metadata while a freshYou can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 40a7404. Configure here.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nto fix/children-signal-owner # Conflicts: # packages/octane/src/runtime.ts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er fix (#1797) #1781 lands #1774's children signal owner and the Hydrate children fix on top of main c3c0a3b. #1773's raises for #1774 were used up by #1783's budgets (#1793, #1794), which were sized without #1774's code. Measured on main + #1781: 69 values breach, all raw or gzip; brotli fits everywhere. Each breached value goes to measured + 32; no other value moves. Co-authored-by: Claude Opus 5.5 <[email protected]>


Summary
The children a
.tsrxcomponent writes between another component's tags now resolve itssignal$,derived$andquery$handles to the component's own cells. Before this change, compiled children rendered in a signal instance of the receiving component.On #1761's head this starts two requests in the browser. The server also calls
loadtwice, so hydration cannot resume the server's result for both reads. A derived read in the children computes from a copy of the component's signals that never sees its writes..tsxevaluates<Card>{record$.get()}</Card>in the parent, so only.tsrxdiverged.The same defect applied when the children went to
<Suspense>,<ViewTransition>,<ErrorBoundary>(component form, for example through an alias), or a context provider.Stacked on #1761. The branch contains #1761's commits. Review only the top commit (
fix(octane): resolve a component's signal handles from the children it passes) until #1761 merges.Size budgets: this needs the budget-only PR #1773. Since
maingained #1762, #1773 is computed againstmainand covers #1761 as well, so #1760 is no longer required. Merge order: #1773, #1761, then this PR, mergingmainin after each.Why
The contract is the
docs/signals.mdparagraph that begins "Module declarations resolve to request-local cells…":A compiled children function is created by the authoring component's body and closes over its declarations. Compiled children are excluded from #1761's
't:'link on purpose: they belong to the template that authored them, not to the component rendering them. Linking them to the renderer would trade one wrong cell for another. So the runtime needs the author's owner, and only the creation site knows it.Changes
runtime.ts):markChildrenBlockalready runs when the authoring template creates its children each render. It now records the signal owner that template renders in. The check is two reads while no owner is active.scopeSignalOwnerlinks an owner to that recorded owner, instead of to the structural parent, in two cases:{props.children}, and the try body of<Suspense>or the component-form<ErrorBoundary>;runtime.server.ts):markChildrenBlockrecords the active renderer owner.ssrComponentpasses it as the enclosing owner for children rendered in a slot (ssrChildValue,ssrDescriptorPart).ssrComponentalso passes it for built-ins that render compiled children inline in their own frame: Suspense, ViewTransition, ErrorBoundary, and context providers. The client renders those children in a block of their own instead; resolution is identical because the built-ins declare nothing.serverSignalQueryAttemptObserveralready walksenclosingOwner, so the streamed selection observes the read under the author's key.component-flags.ts: addsCOMPONENT_FLAG_AUTHOR_CHILDREN, plus a pre-combinedCOMPONENT_FLAGS_AUTHOR_BOUNDARY. A computedA | Bargument kept the pure built-in definitions alive, and theserver-hooksreachability gate caught it pulling in DOM namespace tables.docs/signals.mdadds children, including through the built-ins above, to the template rule.octanepatch.Validation
pnpm format:check: not run repo-wide.format:files:checkpassed on every changed file.pnpm typecheck: not run repo-wide.typecheck:filespassed oncomponent-flags.ts,runtime.ts,runtime.server.tsand the test.pnpm test: not run locally; CI runs it.pnpm sync: no generated changes.packages/octane/tests/hydration/signal-declaration-owner.test.tspasses on the final head: 217/217 inoctane(dev) and 434/434 inoctane-prod(prod and strong).framesshapes, each run through the existing cases (one browser query for setup plus template reads; server query resumed with a setup read; server query resumed with template reads only):children,forwarded children,row children,Suspense,Suspense row,ViewTransition,ErrorBoundary(aliased component form) andprovider.computes a children read from the component's cells. A derived read in children, rendered by a Card with its own state, must see the component'scount$write, with one request.@{ … }blocks #1761's runtime (5208a78) with these tests. Dropping the server flag from ErrorBoundary alone fails its 8 hydration cases.@{ … }blocks #1761's head and the byte trim (same logic):suspense-parent-render-query(client and hydration),signal-instance-identity,event-signal-owner,private-context,returned-jsx-query-resume,view-transition-staging,signals-deferred-values,direct-signal-bindings(550 passed). Alsosignals-local*,signals-rendering,signal-local-selectors,signals-query-attempt-observer,event-signal-owner-retirement,children-block,jsx-context-children*,provider-children-dialect,component-children-hydrate,children-local-hydrate,document-signal-ownerand others (128 passed).run-minimal.mjsandrun.mjsagainst ci(bench): raise byte budgets for the nested-block signal owner fix #1760's budgets.server-render.Risk / follow-ups
<Hydrate>children are not covered. The client renders them inline inside its own try body, and the server inside its frame, so they still read the Hydrate instance's cells, consistently on both sides. Linking them needs the island capture path checked first.props.childrenand tests it for the children marker. A built-in check follows only when the children carry an owner.ScopeDisposedErroron read. That matches fix(octane): resolve a body's signal declarations from the functions it creates #1706's rule for the body's own functions.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
High Risk
Changes core signal instance / enclosing-owner resolution on client and SSR hydration paths; incorrect linking would duplicate queries or mis-associate cells across boundaries.
Overview
Fixes signal cell ownership so compiled
.tsrxtemplate pieces read the declaring component’ssignal$/derived$/query$cells instead of spinning up duplicate instances (extra fetches, stale derived values, broken hydration resume).Nested
@{ … }blocks now resolve parent handles like directive arms and keyed@forrows already do, via aTEMPLATE_INVOCATION_SITE('t:') link on client and server while blocks still own their own declarations.Compiled children (
markChildrenBlock) record the authoring template’s signal owner; rendering paths (child slots, forwarded children,<Suspense>,<ViewTransition>,<ErrorBoundary>, context providers) pass that asenclosingOwnerso reads match.tsxparent-evaluated children. Server built-ins getCOMPONENT_FLAG_AUTHOR_CHILDREN/COMPONENT_FLAGS_AUTHOR_BOUNDARY.docs/signals.mdand hydration tests (signal-declaration-owner.test.ts) document and lock in single-query and SSR-resume behavior across these shapes.Reviewed by Cursor Bugbot for commit 9eb4da6. Bugbot is set up for automated code reviews on this repo. Configure here.