Skip to content

fix(octane): defer unused SSR signal key serialization - #1147

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/fix-ssr-unused-signal-identities
Sep 19, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/fix-ssr-unused-signal-identities

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

An ordinary object-keyed @for list with opaque text output can throw during SSR because optional signal bookkeeping coerces its reconciliation keys before any handle is read. Keep raw list/component keys in a persistent identity recipe and serialize them only when an actual handle needs its wire identity. Nested directive and mapped lists, both within one component scope and across component frames, retain separate handle values through parked discovery, hydration, native edits, reorder and cleanup.

Addresses the eager SSR key serialization part of #1130 §2.1; the broader frame/envelope and bundle regressions remain open.

Validation

  • Targeted dev/prod SSR, discovery, render-phase, streaming and hydration tests: 110 passed across five owning/adjacent suites (38 final owning results plus 72 adjacent results).
  • Production bundle-boundary Node suite: 24 passed. The 200-row scalar control performs zero signal key coercions; the actual-handle control still serializes 200 keys and preserves distinct identities across both orders.
  • Regression reproduced on exact main 481819ec2: the object-key case throws, and the deterministic guard observes 200 unwanted coercions. Dropping frame list identities and dropping the outer raw-key chain each deliberately produce eight actual-handle failures, including observable value collisions. Exact source restored before final checks.
  • Scoped typecheck, formatting and pnpm sync.
  • Full current-head CI: all 26 jobs passed on 441a55990 (run 35457399292), including all four runtime and React parity shards, Chromium/website/heavy integrations, full typecheck, lint, package validation and examples. Repository-wide tests/types were not run locally.

Matched production public-entry builds use the same frozen fixtures, lockfile, Node 24.19.0, Vite 8.1.5 and esbuild 0.28.1. Client/model-engine closures are unchanged. Ordinary SSR increases from 17,728 to 17,837 gzip bytes (+109); used-native SSR from 33,472 to 33,559 (+87). This fixes correctness and unused work, with a small SSR byte cost.

Risk / follow-ups

Potential list arms still allocate one raw-key recipe. Actual reads resolve and cache the existing wire keys. These deterministic counters establish neither a wall-time speedup nor zero signal overhead. Existing budgets are unchanged.

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
Touches server signal instance identity for keyed lists and hydration wire keys; behavior is narrowly scoped but correctness-critical for SSR and hydration.

Overview
Fixes SSR throwing or doing unnecessary work when object-keyed @for lists render opaque scalar output without reading signal handles.

Server runtime replaces eager per-list-arm signalIdentityKey serialization with a lazy linked recipe (ServerSignalListKeys): list arms only record raw keys and parent context; resolveServerSignalListKeys materializes wire keys when a real handle needs an instance identity. Component frames keep raw signalKey values until resolution, matching prior behavior for actual-handle paths (nested lists, reorder, discovery).

Tests and guards: hydration suite covers scalar keyed lists across SSR modes/streams (no signals payload, keys not coerced) and nested keyed lists through prerender, hydration, native input edits, and reorder; bundle-boundaries adds a production SSR guard counting zero key coercions for scalar rows vs preserved control identities when handles are used.

Reviewed by Cursor Bugbot for commit 441a559. 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 19, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review September 19, 2026 17:13
@domgan-oai
domgan-oai merged commit b819a83 into octanejs:main Sep 19, 2026
51 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.

1 participant