Skip to content

fix(hydration): isolate native signal attribute diagnostics - #1238

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/native-deferred-signal-diagnostics
Sep 22, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/native-deferred-signal-diagnostics

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

  • Compare deferred hydration attributes against preserved native signal history instead of collecting a live render during the development-only diagnostic pass.
  • Allow value-only useSignal$ through an isolated, disposable built-in adapter. Lazy initializers and unknown native hooks remain conservative; comparison cannot publish reads, write signals, attach refs, or run effects.
  • Restore native adoption, write guards, lifecycle state, and temporary local scopes after successful or throwing comparisons. Allocate the diagnostic adapter only when a historical probe actually runs.

Validation

  • Exact upstream d9042265 with the same final regression tests: 24 failed / 28 passed. Candidate: 52 / 52 passed, covering split and unsplit boundaries, development and production, true initial mismatches, later updates, local state, cleanup, and thrown comparisons.
  • Related signals suites: 294 tests passed across development, production, and strong modes.
  • Package and signal typetests; four changed test/fixture TSRX typechecks; package build; staged DOM classification and its 10 tests; changed-file formatting; changeset/release-plan checks; pnpm sync.
  • Five stock production bundle fixtures retain identical raw/gzip/Brotli sizes and reachability checks. A separate production bundle retaining all signals/client exports changes by +9 / +7 / +17 bytes (raw/gzip/Brotli) against upstream. User-facing signal exports/signatures are unchanged; the compiler-internal entrypoint gains a probe flag accessor. No CPU performance claim.
  • Broad hydration run: 1,878 passed / 2 timed out in the existing production SSR diagnostic file. That file passes 8 / 8 in isolation at unchanged 5-second deadlines. Both original timeout cases also pass against unmodified upstream; the upstream-only isolated control timed out in a different case. The broad run is not claimed green.
  • Locally, full root pnpm format:check, pnpm typecheck, and pnpm test were not run; scoped checks above were used. Local browser/device validation was not run; CI's own lanes are reported separately.

Risk / follow-ups

The historical comparison is development-only. Function-valued initializers and arbitrary hook factories are intentionally not evaluated by this diagnostic path. Ready-triggered CI passes on b02c7f8c (run); review is pending.

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 development hydration diagnostics, native read collection, and useSignal$ initialization paths; production behavior is gated but runtime probe wiring is intricate and error-prone if teardown order regresses.

Overview
Development-only deferred hydration diagnostics now replay preserved native signal history when comparing attributes, instead of treating the diagnostic pass like a live render that collects reads or throws on native hooks.

The historical probe pauses the native read driver lifecycle, enables write guards, and wires a native seed resolver from nativeSeedRaw. Native read scopes, witnesses, and block beginRender/endRender no-op while hydrateAttributeProbe is active. useSignal$ with a literal initial value may use a private diagnostic initializer and createDiagnosticLocalScope so comparison state is disposable and isolated—no subscriptions, writes, refs, or effects on the live tree. Lazy function initializers and unknown nativeLocalHook factories stay blocked.

Cleanup restores adoption, guards, driver lifecycle, and diagnostic scopes even when the probe throws. isNativeSignalDiagnosticProbe() is exposed for internal/compiler use. Regression coverage spans split/unsplit hydrate boundaries, attribute mismatches, local signal isolation, and throwing probes.

Reviewed by Cursor Bugbot for commit b02c7f8. 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 14:06
@domgan-oai
domgan-oai merged commit 4b0eac4 into octanejs:main Sep 22, 2026
51 checks passed
domgan-oai pushed a commit that referenced this pull request Sep 23, 2026
…nders (#1282)

When a mounted parent changes a dormant Hydrate boundary's captures or
provided context before activation, the server HTML predates the client's
state. Decide that by comparing the initial and current captures instead
of rendering the child with its historical props, and repair attributes,
class, style and text without mismatch diagnostics in dev and prod.

Removes the development-only historical attribute probe (#1181) and the
native-signal isolation built on it (#1238), which re-ran component
bodies, state initializers, memo factories and getSnapshot with stale
props.

Co-authored-by: Claude Opus 5.5 <[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