Repository navigation
fix(octane): resume a query read only through a declared handle on the server - #1766
Merged
Merged
Conversation
…on the server A function a component body creates reads the handles it closes over through `__declared`, which resolves the declaring owner's cell wherever the function renders. The server's query-attempt observer only accepted the rendering owner and its enclosing chain. A render prop rendered inside another component therefore started the declaring owner's query unobserved, and the server announced no streamed selection. Hydration then loaded the query again, or threw client error 267 when the page streamed no other query. A lexical handle's reads now run under the observer re-scoped to the declaring owner, for the same request's document only. The observer's walk up enclosing owners then starts from the declaring owner, so a row's derived value that reads the component's query is announced too. Handles passed as values keep their reader-owned resolution and observation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 5, 2026 12:24
Contributor
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)
56 other measured values are unchanged. Public-import reachability bundles (bytes)No changes across 105 measured values. |
…ver-observation # Conflicts: # packages/octane/tests/hydration/signal-declaration-owner.test.ts
trueadm
added a commit
that referenced
this pull request
Oct 5, 2026
…#1772 and #1794 Same method as before: each budget is main's value minus the measured esbuild-to-Oxc difference on the merged source, never raised (131 lowered, 28 unchanged). The baseline record and home summary follow the new bytes; every ratio guard still holds with the ceilings already cut. Co-Authored-By: Claude Opus 5.5 <[email protected]>
7 of 8 tasks
trueadm
added a commit
that referenced
this pull request
Oct 6, 2026
* ci(bench): measure bundle sizes with Vite 8's default minifier The bundle-size and bundle-reachability harnesses forced Vite's `minify: 'esbuild'`. That mode turns Rolldown's own minifier off, and with it the dead-code elimination that removes branches guarded by a never-written module flag, so the numbers were not what a Vite app ships. - run.mjs builds every framework with `minify: 'oxc'` (Vite 8's default client minifier), still identical settings for every target. - run-minimal.mjs builds its Vite scenarios with `'oxc'`; the esbuild bundler scenarios keep esbuild's `minify: true`. The async-identity encoder check accepts Oxc's template-literal quotes. - Every budget is ratcheted down (144 lowered, 15 unchanged, 0 raised), the bundle-size baseline is re-recorded, the 18 cross-framework ratio guards are re-cut, and the website summary and copy follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-measure the Oxc budgets on main with #1761 and #1782 Budgets move by the measured esbuild-to-Oxc difference on the same source (budget - max(0, esbuild - oxc)), so the methodology change lowers 131 values, keeps 28, raises none, and leaves the headroom #1782 granted to #1783 in place. The baseline, ratio guards and website summary are recomputed from the merged source. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(website): compare home summary ceilings at stable precision The smoke test rounds each summary row to 15 significant digits because Math.log/exp can differ by one ULP between libc implementations, but it compared the bundle-size range ends exactly. Those ends are geometric means too: the recorded Solid ceiling was 0.9500824085923075 on macOS and 0.9500824085923076 on the Linux runner. Round them the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-derive the Oxc budgets on main with #1766, #1768, #1770, #1772 and #1794 Same method as before: each budget is main's value minus the measured esbuild-to-Oxc difference on the merged source, never raised (131 lowered, 28 unchanged). The baseline record and home summary follow the new bytes; every ratio guard still holds with the ceilings already cut. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-derive the Oxc budgets on main with #1783 #1783 landed and spent the headroom #1782/#1793/#1794 granted it. Each budget is again main's value minus the measured esbuild-to-Oxc difference on the merged source (131 lowered, 28 unchanged, none raised). The baseline record, home summary and refresh note follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-cut the cross-framework ratio guards after #1784 With #1784's hydrating flag folded by Oxc, Octane's totals shrink 8.5-10% instead of about 5%, so the total-gzip ceilings had grown about 6% loose. They are re-cut at about 1.5% headroom on the merged-source measurement; application-code ceilings are unchanged. All 72 bundle-size guards hold. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- 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
A
query$read only through #1706's lexical__declared(x$)path now resumes during hydration. Before this change, the server never announced the query to the browser. Hydration then threw client error 267 ("The streamed signal selection bootstrap is missing or incompatible"), or, when the page streamed another query, loaded this one again in the browser.record$.get()in the render prop compiles to__declared(record$).get(). That read resolvesApp's cell, as it should; the browser-only case already started one query. On the server, though, the read runs whileRender's render-prop body is rendering.serverSignalQueryAttemptObserveraccepts only the rendering owner and itsenclosingOwnerchain, andAppis not on that chain. So the attempt went unobserved: the HTML carried the server's value and seed, but no streamed selection.Why this design
There were two options: let the observer also accept the descriptor's declaring owner, or have the lexical copy run its reads under an observer for its declaring owner. This PR takes the second.
reader()returnsthis.ownerfor the lexical copy, so its server observation should match. The observer's rule stays the same: the rendering owner and its enclosing chain.Entry.observepasses only the cell's scope key. Accepting "the declaring owner" there would need a side channel from the facade, or acceptance of any owner in the same document, which widens what every render may announce.derived$(() => record$.get()), and a render prop can read it through the row's handle. The component's query is then found through the row'senclosingOwner. Accepting only the declaring owner exactly would still drop it; a mutation that does so fails the new row test.read(x$)and producer closures, never take the lexical path. Their resolution and observation are unchanged.Changes
signals/query-attempt-observer.ts: addsrunAsDeclaredServerSignalReader(owner, read).readunder the same request'sobserveandcreateObservations, re-scoped to the declaring owner.signals/facade.ts:get,snapshot,latestand[SIGNAL_BINDING_READ]go through that helper only whenthis.lexical === this. The non-lexical path still makes its direct call, with no closure.assertWritable).[SIGNAL_BINDING_READ]matters because__startSignalReadsuses it. A server cell observes its attempt only on its first compute, so an unwrapped early start would lose the observation for good.octanepatch.Validation
pnpm format:check: not run repo-wide.format:files:checkpassed on every changed file.pnpm typecheck: not run repo-wide.typecheck:filespassed on all four changed source and test files.pnpm test: not run locally; CI runs it.hydration/signal-declaration-owner.test.ts:renderpropframe joins the existing matrix: one browser query, the server query resumed with a setup read, and with frame reads only.octane(dev) and 200/200 inoctane-prod(prod and strong).signals-query-attempt-observer.test.ts(octane-signals), 2/2, with a new observer-level case:octane: the 4read only by 'renderprop' … framescases and the row hydration case. Run alone, a frames case throws error 267, as reported. After an earlier case has installed the selection mailbox, the same defect shows as a browser reload. That happens becauseresetStreamRuntimeGlobalsdoesn't clear the mailbox.enclosingOwnerchain fails the row hydration case;run-minimal.mjs --budgetsandrun.mjs --budgets octane-tsrx octane-jsxboth hold, so no budget PR is needed.octane/signalsentry (esbuild, production) grows by 388 B raw, 73 B gzip and 46 B brotli.Risk / follow-ups
@{ … }blocks #1761 has merged. Merging main into this branch kept itsblockandrow blockframes beside this PR'srenderpropframe inframes(). On the merged tree the file passes 135/135 inoctane. The two changes compose: fix(octane): resolve a component's signal handles from its nested@{ … }blocks #1761 links a render function rendered as a child to the component rendering it, and lexical reads still resolve, and now observe, through their declaring owner.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes server query-attempt observation and hydration streaming for lexical signal reads; scoped to
__declaredpaths with a document guard, but mistakes could leak or miss streamed selections.Overview
Fixes SSR/hydration when a
query$is read only from a closure the declaring component created (e.g. a render prop), where the read runs under another component’s renderer owner so the server never streamed the query selection.Lexical
__declaredreads on the signal facade (get,snapshot,latest, and binding reads) now run throughrunAsDeclaredServerSignalReader, which temporarily re-attaches the active server query-attempt observer to the declaring owner (still walkingenclosingOwnerfor row-derived reads) while skipping cross-document callbacks. Non-lexical handles passed as props are unchanged.Adds a
renderprophydration matrix case, row + render-prop client/SSR tests, and an observer unit test for same-document vs other-request isolation.octanepatch changeset.Reviewed by Cursor Bugbot for commit 706e129. Bugbot is set up for automated code reviews on this repo. Configure here.