Skip to content

fix(octane): isolate SSR signals for opaque keyed rows - #1252

Merged
domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/fix-ssr-object-key-signals
Sep 22, 2026
Merged

domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/fix-ssr-object-key-signals

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Distinct object-keyed rows currently reuse the first row's component-local signal during SSR, producing first, first instead of first, second. Preserve raw object, function, and symbol identity in structural signal keys without calling user key coercion. Primitive-key encoding and mapped-list key normalization retain their existing behavior.

Opaque identities use a namespace for each structural call site and initial list positions, so deferred hydration and reverse-order streaming reveals agree with the client. Request retry aliases retain pending queries when keys are recreated. Request completion and root unmount release the added bookkeeping; async continuations outside a render pass do not allocate request-owned identities.

Fixes #1249.

Validation

  • 349 tests passed across 10 owning/adjacent SSR, signal, and hydration suites, including explicit development/production compilation, buffered/static/prerender/streamed output, native edits, survivor DOM identity, nested lists, reordered rows, deferred hydration, fresh-key query retries, and async continuations.
  • 30 production bundle-boundary and server-frame benchmark tests passed. Real-handle object-key coercions fall from 400 to zero while existing frame/recipe/cache-work controls stay unchanged.
  • Regression reproduced before the fix: eight object/function/symbol/coercion cases failed; primitive controls passed. A temporary global identity-registry fault fails both deferred-hydration cases; removing only the active-render guard reproduces the async-continuation failure.
  • Scoped source/regression typecheck, changed-file formatting, changeset checks, git diff --check, and pnpm sync passed.
  • After incorporating current main, 249 tests passed across the owning signal/SSR suites and compiler root-behavior suite; matched bundle outputs are unchanged.
  • Full current-head CI passed all 26 jobs at signed head ea311f539, including all test/parity shards, full types/lint, Chromium and website integration, examples, package validation, and compatibility lanes. Cursor Bugbot passed with no findings.

Risk / follow-ups

Matched production public-entry builds add 257 gzip bytes to the ordinary client and 212 bytes to SSR. Scalar/structural bindings, signal-engine, compiled-state, and bootstrap sizes are unchanged. Paired timing samples have substantial variance, so they establish no speed improvement or regression. Opaque wire identities are scoped to one response/root and do not promise a canonical identity across independent requests with different traversal orders. The focused hydration regressions use jsdom; the full Chromium integration lane also passed in CI.

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. Autofix is disabled.


Note

Medium Risk
Changes how structural signal instance keys are derived for lists on SSR and hydration; incorrect scoping could mis-join controls or leak ids across requests/roots.

Overview
Fixes keyed SSR lists where distinct object, function, and symbol reconciliation keys incorrectly shared one component-local signal (e.g. duplicated row values). Signal structural keys now use opaque identity tokens with namespace-scoped numeric ids (seeded from list position and async identity), instead of coercing keys via String(value) / user Symbol.toPrimitive.

The same opaque-key path is applied on client and server (runtime.ts, runtime.server.ts): list arms record position, request/root state holds id allocators, and that bookkeeping is cleared when a render request or root unmounts. SSR only materializes request-owned structural instance keys while a render pass is active.

Benchmarks and hydration/SSR tests are tightened so object keys that throw on coercion stay at zero coercions, real handles stay unique per row within a response, and new cases cover reorder, deferred hydration, query retries, streaming reveal order, and async boundaries.

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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Sep 22, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review September 22, 2026 20:45
@domgan-oai
domgan-oai merged commit 1871491 into octanejs:main Sep 22, 2026
48 checks passed
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.

SSR signal values collide between rows with distinct object keys

1 participant