Skip to content

fix(octane): seed nothing for a pending snapshot read instead of throwing - #2077

Merged
trueadm merged 3 commits into
mainfrom
fix/pending-snapshot-seed-main
Oct 15, 2026
Merged

trueadm merged 3 commits into
mainfrom
fix/pending-snapshot-seed-main

Conversation

@trueadm

@trueadm trueadm commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • A server render that reads a pending or failed query through .snapshot() no longer throws "A completed native server read has no serializable ready value". The read adds no entry to the hydration snapshot, and the client resolves that state itself, or takes the result a stream delivers.
  • A completed .get() of a value that is not ready still throws, as before.

Why

  • The server's native read collector is created lazily, for the rest of the process, by the first module that reads signals natively. Once it exists, every render collects its reads for the hydration snapshot, and a completed snapshot() read of a pending source had no ready value to serialize, so serialization threw.
  • So the same page rendered in a server that had not loaded such a module and threw in one that had. Repro on main: with the collector created at the top of early-independent-intent.test.ts, as any module-signal module in the server bundle does when it loads, 28 of its 30 tests throw. Without it, all 30 pass.
  • A snapshot renders a pending or failed state as it is, without suspending, so there is nothing ready to seed. Seeding nothing also keeps the original intent of the pinned test, which was not to invent a ready seed.

Changes

  • signals/seed-serialization.ts: serializeScopeRead returns no seeds, instead of undefined (which throws), for a snapshot read whose state is not ready. Every other unready read keeps throwing.
  • tests/signals-hydration.test.ts: the case that pinned the throw now asserts the contract. The pending output renders with no hydration snapshot, hydration adopts the same node, and the node shows the result once the query resolves.
  • tests/hydration/pending-snapshot-seed.test.ts (new): loads a module-signal page, renders a pending snapshot under streamed signals, hydrates while the client is still pending, and takes the stream's result without a second fetch.
  • benchmarks/scoped-signals/native-dom-smoke.mjs: the matching supplemental case is reworded the same way.
  • Patch changeset for octane.

Found while working on #2044, which carries the same fix along with collecting signal reads in every render whenever signals exist, so collection no longer depends on what the process loaded first.

Validation

Run on this branch, rebased onto main e8e1555:

  • Regression: pending-snapshot-seed.test.ts and the reworded signals-hydration.test.ts case fail on main ("no serializable ready value") and pass with the fix (octane + octane-signals).
  • early-independent-intent.test.ts with the collector forced on (enableNativeReadCollection(1) at the top of the file, not committed): 28 of 30 fail on main, 60 of 60 pass with the fix (octane + octane-prod).
  • targeted tests, octane + octane-prod: hydration/pending-snapshot-seed, hydration/early-independent-intent, hydration/automatic-signal-stream, streamed-signal-cancellation, hydration/direct-signal-bindings, hydration/independent-island: 12 files, 524 tests passed. (hydration/initial-document-signals belongs to octane-signals, below.)
  • all octane-signals* projects: 103 files, 1,454 tests passed.
  • pnpm typecheck
  • pnpm format:files:check on the changed files
  • pnpm format:check (repo-wide) and pnpm test (full): not run locally; left to CI.
  • native-dom-smoke.mjs: the reworded case passes. The script still reports 14/27 overall, the same as on main; it is supplemental and not run in CI.
  • perf-review: node scripts/perf-review-scan.mjs → 0 candidates. The changed function, serializeScopeRead, runs once per collected read when a server render serializes its snapshot, and the new branch runs only on the path that used to throw. The module is server-only (only the server read driver imports it), so client bundles are unchanged. No findings.
  • concise-code: src +6 −1 (runtime 0); no new exports. Alternatives rejected: skipping only when the render streams its query attempts (about +30 lines threaded through the server driver), because it would still throw for non-streamed pages that render today on the collector-less path; relaxing the check in serializeNativeSeedReads for any unserializable source (smaller), because it would also stop rejecting completed value reads of unready sources. Bytes: server-only module, client rows not applicable.

Risk / follow-ups

Provenance

  • An agent produced this diff (agent-authored)

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
Changes server hydration seed serialization for pending/failed snapshot reads when native read collection is active; behavior now matches the collector-off path but shifts how unseeded nodes hydrate until follow-ups like #2044.

Overview
Server SSR no longer throws when a completed native read uses snapshot() on a pending or failed query after the process has loaded a module that enables signal read collection. Instead of failing with "no serializable ready value", serializeScopeRead returns an empty seed list for that snapshot read so HTML still shows pending (or the current status) and no data-octane-native-signals hydration payload is emitted for it.

.get() on an unready value still throws, unchanged. Hydration and streaming tests now assert the client keeps the server-rendered pending UI, then resolves via live signals or streamed frames without a second fetch. A patch changeset and the native DOM smoke benchmark mirror the new contract.

Reviewed by Cursor Bugbot for commit ac5ddeb. Bugbot is set up for automated code reviews on this repo. Configure here.

…wing

A server module that reads module signals installs the native read collector
as it loads, and every later render in the process then collects its reads
for the hydration snapshot. A render that read a pending query through
snapshot(), such as an automatically streamed query, completed with a read it
could not seed and threw "A completed native server read has no serializable
ready value". On main 0bb503f, 28 of the 30 early-independent-intent cases
throw once that collector exists, while the same page renders in a server
that has loaded no such module.

A snapshot renders a pending or failed state as it is, without suspending.
The client resolves that state itself, or takes a stream's later delivery, so
the read now contributes no seed, which is also no invented ready one. A
completed value read of an unready source still throws.

The signals-hydration case that pinned the throw now asserts that contract:
the pending output renders with no hydration snapshot, adopts the same node,
and shows the result once the query resolves. The supplemental native DOM
smoke case says the same. The new streamed test loads a module-signal page,
renders a pending snapshot under streamed signals, hydrates while the client
is still pending, and takes the stream's result without a second fetch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 15, 2026
@trueadm
trueadm marked this pull request as ready for review October 15, 2026 10:45
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website ac5ddeb Commit Preview URL

Branch Preview URL
Oct 15 2026, 11:22 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp ac5ddeb Commit Preview URL

Branch Preview URL
Oct 15 2026, 11:23 AM

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares 1622fa020, the merge commit's first parent with c10f1b74e on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.800 2.875 ±0.0% ±0.0% … +3.3% ⚪ within noise
octane-tsrx replace 7.350 7.483 +1.3% −0.0% … +5.0% ⚪ within noise
octane-tsrx add 2.642 2.575 ±0.0% −3.7% … +2.0% ⚪ within noise
octane-tsrx update 0.124 0.126 +2.0% −0.9% … +3.1% ⚪ within noise
octane-tsrx select 0.006 0.005 −1.5% −3.7% … −0.0% ⚪ within noise
octane-tsrx swap 0.017 0.018 +0.8% −1.0% … +2.4% ⚪ within noise
octane-tsrx remove 0.016 0.016 +0.4% −1.6% … +2.5% ⚪ within noise
octane-tsrx runlots 26.967 28.333 +2.4% −0.6% … +6.5% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 −0.9% −3.1% … +1.0% ⚪ within noise
octane-tsrx clear 47.658 48.517 +0.0% −2.5% … +5.1% ⚪ within noise
octane-jsx run 3.383 3.317 ±0.0% −3.0% … +0.0% ⚪ within noise
octane-jsx replace 5.925 6.533 +4.6% ±0.0% … +8.8% ⚪ within noise
octane-jsx add 3.242 3.433 +1.6% ±0.0% … +6.7% ⚪ within noise
octane-jsx update 0.237 0.235 +0.5% −1.1% … +2.1% ⚪ within noise
octane-jsx select 0.127 0.124 −2.1% −3.5% … −1.1% ⚪ within noise
octane-jsx swap 0.173 0.179 +0.5% −2.4% … +1.1% ⚪ within noise
octane-jsx remove 0.169 0.169 −1.1% −2.6% … +0.3% ⚪ within noise
octane-jsx runlots 27.808 27.442 −1.9% −3.7% … +0.9% ⚪ within noise
octane-jsx select_lots 1.363 1.358 −1.5% −2.5% … +0.3% ⚪ within noise
octane-jsx clear 45.842 45.242 −0.4% −2.8% … +0.7% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 93 measured values.

Public-import reachability bundles (bytes)

No changes across 120 measured values.

@trueadm
trueadm merged commit 19033e4 into main Oct 15, 2026
77 of 86 checks passed
@trueadm
trueadm deleted the fix/pending-snapshot-seed-main branch October 15, 2026 12:11
@trueadm trueadm mentioned this pull request Oct 15, 2026
6 of 7 tasks
trueadm added a commit that referenced this pull request Oct 15, 2026
* fix(octane): remove a .tsx Provider's children when they become null (#2076)

* fix(octane): remove a .tsx Provider's children when they become null

* fix(octane): remove CompiledContext children when they become null

* fix(octane): keep CompiledContext's emptied dialect so a rolled-back transition can't duplicate its children

* test(website): reload the dev /devtools warm-up once before failing

Main a9dfdf7 failed the website integration suite: the dev-SSR beforeAll
waited 120 s for the TanStack Devtools trigger on /devtools and skipped all 37
dev-SSR tests. The wait came with #2062 and has failed on main and two
branches since, while passing locally on every cold warm-up (~3.9 s).

The devtools client mounts after hydration from modules a cold dev server may
only discover on that first visit, and Vite recovers with a reload a slow
runner can miss. Wait 60 s, log what the first attempt saw, reload once, and
fail with the page errors if the trigger still never appears. The devtools
tests themselves still assert the trigger and panel on fresh loads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(three): render Canvas as a Strong template (#2080)

* fix(octane): seed nothing for a pending snapshot read instead of throwing (#2077)

A server module that reads module signals installs the native read collector
as it loads, and every later render in the process then collects its reads
for the hydration snapshot. A render that read a pending query through
snapshot(), such as an automatically streamed query, completed with a read it
could not seed and threw "A completed native server read has no serializable
ready value". On main 0bb503f, 28 of the 30 early-independent-intent cases
throw once that collector exists, while the same page renders in a server
that has loaded no such module.

A snapshot renders a pending or failed state as it is, without suspending.
The client resolves that state itself, or takes a stream's later delivery, so
the read now contributes no seed, which is also no invented ready one. A
completed value read of an unready source still throws.

The signals-hydration case that pinned the throw now asserts that contract:
the pending output renders with no hydration snapshot, adopts the same node,
and shows the result once the query resolves. The supplemental native DOM
smoke case says the same. The new streamed test loads a module-signal page,
renders a pending snapshot under streamed signals, hydrates while the client
is still pending, and takes the stream's result without a second fetch.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(octane): render a server element entry as its component's root, as hydrateRoot does (#2078)

* fix(octane): render a server element entry as its component's root, as hydrateRoot does

renderToString(<App />), and every other server renderer given an element,
rendered the element as a value its root returns (renderEntryValue), which
frames the component in a range of its own. hydrateRoot(container, <App />)
unwraps an element whose type is a component into the root's body and props,
as it does App itself, so the client root has no such range. When App returns
a component, a fragment, a Suspense boundary or a template, or renders its
children, the server's HTML did not match, and the root rendered on the
client with a recoverable error.

Each server renderer now reads its entry through renderEntry: a component
element renders as that component's root, with the props its descriptor
renders it with (descriptorProps, shared with ssrComponentDescriptor), and any
other value as before. The two entry forms produce the same HTML, and either
hydrates through either hydrateRoot form.

root-entry-forms pins every pairing of renderToString and
renderToReadableStream, each given App or <App />, with hydrateRoot given App
or <App />, for a root that returns host JSX, a template, a component, a
fragment, text, null, a Suspense boundary or its children, in dev and prod
compiles: 80 of its 256 cases fail before this change.

Client bundles are unchanged; the minified server runtime shrinks 234 B raw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(octane): read a server descriptor's children only after the scoped check

A scoped component descriptor's children getter resolves deferred children,
so reading it first ran them in the parent's scope before the component
entered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* test(website): let the generated MDX hot-update test re-write and outwait a slow runner

Main 8318702 failed the website integration suite: "hot-updates
generated MDX twice while preserving the surrounding interactive page" timed
out waiting 20 s for an edit to reach the page. It also failed on
perf/runtime-size-redesign; it passes locally every time. Until 1622fa0
the /devtools warm-up flake skipped the whole dev-SSR block, which hid it.

Each edit now waits in 15 s rounds, re-writing the file between rounds in
case the watcher dropped a write that followed the previous one, for up to
60 s; the test's budget grows to 180 s. The assertions are unchanged: the
generated text updates, the sibling counter keeps its state, and no errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(octane): keep an emptied Provider's dialect, and refill it through a frontier (#2043)

Clearing an emptied CompiledContext at commit dropped its hooks map, so the
empty dialect was lost; it is now kept. A refill's reset opens the scope's
frontier like a dialect flip, so its incoming body builds off-document.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Olzhas Alexandrov <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: domgan-oai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant