Repository navigation
fix(signals): load the browser's own query selection over a seed for another request - #1618
Merged
Merged
Conversation
…another request
A hydration frame rejected a resource seed whose request no longer matched the
client's selection with a hard SignalFrameError ("The presented query
definition does not match"), even under the native adoption resolver. The live
binding already treats a seed for another request as no seed and starts the
client load, so only the historical read failed.
The frame now leaves such a read to the live graph during hydration, exactly
like a request the server never seeded: the client loads its own selection once,
the boundary (or root) waits for it, and adoption keeps the server's nodes while
reporting changed text as a recoverable hydration mismatch. An explicit
`beginAdoption` frame keeps the error, since it has no live fallback.
The defect predates #1601: a `.tsrx` app whose props select another request
than the server's already failed. #1601 gave `.tsx` returned-JSX components the
server's owner key, which exposed it to #1607's tests, whose browser-only
selection previously landed under an unseeded owner.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 2, 2026 23:10
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. |
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
Fixes main, which has been red since #1601. Main CI run 37067163551 fails 6 of 8 cases in
returned-jsx-query-resume.test.ts(octaneandoctane-prod), and every open PR inherits the failure.Root cause: an engine defect that predates #1601, not the retry-owner cache.
AdoptionFrameImpl.read(packages/octane/src/signals/engine.ts) rejects a resource seed whose request no longer matches the client's selection. It throws a hardSignalFrameError(145), "The presented query definition does not match", and does so even under the native adoption resolver.requests.tsmatchesSeed). Only the historical read failed..tsrxApp whose props select'b'while the server seeded'a'failed with the same 145..tsxscenario only passed there because the.tsxField's owner key differed from the server's. That made the seed invisible, so the query loaded as if unseeded.'a'seed now reaches the frame, and the latent 145 surfaces.Fix: under hydration, the frame leaves such a read to the live graph, just like a request the server never seeded.
readHistoricalNodealready usesundefinedto mean "read live" for non-seedable owners.scope.beginAdoption()frame keeps the error, since it has no live fallback;signals-serialization.test.tsstill pins that.Why not recovery
The alternative was to throw
NativeAdoptionMiss, the documented recovery for a missing channel. I prototyped it in the same scenarios. It:'b'twice, because the discarded attempt had already started its load;.tsrx-Field case, left the boundary showing its fallback after the data settled.It also fails #1607's tests as written. The read-live behavior matches the docs' "a matching completed resource seed avoids a duplicate client load": a seed that doesn't match doesn't avoid the load. The adoption paragraph in
docs/signals.mdnow states this case.Changes
packages/octane/src/signals/engine.ts: under hydration,AdoptionFrameImpl.readreturnsundefined(read live) for a resource seed of another request, checked before the historical source is created. An explicit frame still throws 145.packages/octane/tests/hydration/returned-jsx-query-resume.test.ts: new test, "loads the browser's own selection over a seed for another request", 12 cases. It covers.tsx,.tsrxand boundary-free.tsrxApps ×.tsxand.tsrxField × dev and prod compile. It asserts one load of'b', the server<output>adopted (same node), the text'browser b', and only hydration-mismatch reports.docs/signals.md: documents the behavior.octanepatch.Validation
pnpm format:check: not run. Ran scopedpnpm format:files:checkon the 4 changed files, which passed.pnpm typecheck: not run. Ran scopedpnpm typecheck:fileson the engine and test files, which passed.pnpm test: not run, to limit local load. Left to CI.--project octaneunless noted):hydration/returned-jsx-query-resume.test.ts: 20/20 with the fix. Without the fix (main'sengine.ts), 18/20 fail: all 12 new cases plus fix(hydration): keep a JSX boundary's query across retries and resume reads in returned JSX #1607's 6.hydration/signal-instance-identity.test.ts, fix(hydration): key signal owners below returned JSX by authored invocations only #1601's contract: 153/153.--project octane-signals-node:signals-serialization,signals-native-seeds,signals-async: 142/142.--project octane-signals:signals-hydration,hydration/initial-document-signals,signals-deferred-values: 64/64.node benchmarks/bundle-size/run-minimal.mjs --budgets root-static-local root-chained-jsx hooks-state prop-attributes contextpasses. The output is byte-identical to main (root-chained-jsx 86002 raw / 28544 gzip), because the signals engine isn't in these bundles.hydrate-rootis also byte-identical to main (169643 raw), so its existing budget failure on main is unchanged.pnpm sync: no generated changes.Risk / follow-ups
NativeAdoptionMissrecovery, unchanged. That recovery path has no test coverage. The prototype above showed a double load and a stuck fallback there, which could be worth a follow-up.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 hydration adoption for async queries when server seed and client selection diverge; behavior is documented and heavily tested but mixes historical and live reads briefly during adoption.
Overview
Hydration no longer hard-fails when the client’s
query$selection differs from the server-seeded request under the same signal owner. Instead ofSignalFrameError(145)(“The presented query definition does not match”),AdoptionFrameImpl.readreturnsundefinedduring native hydration so the graph reads the query live, loads the browser’s current selection once, keeps the server DOM nodes, and surfaces text differences as recoverable hydration mismatches.Explicit
scope.beginAdoption()frames still throw 145 (no live fallback). The mismatch check runs before a historical read source is registered, avoiding stale subscriptions.Docs (
signals.md) and a patch changeset describe the behavior. Tests add 12 matrix cases inreturned-jsx-query-resume.test.ts(tsx/tsrx apps and fields, with/without Suspense, dev/prod).Reviewed by Cursor Bugbot for commit 2432ba6. Bugbot is set up for automated code reviews on this repo. Configure here.