Skip to content

fix: diagnose eager imported signal samples in DOM bindings - #1304

Merged
domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/binding-live-read-diagnostic
Sep 24, 2026
Merged

domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/binding-live-read-diagnostic

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

An imported signal's count$.get() can pass the pure-projection gate in a DOM
binding view and leave the server text as an unsubscribed snapshot. Selected
binding artifacts now diagnose an actual canonical native read during activation
or a later source publication, with guidance to bind the handle directly or
provide an explicit BindingSource sample.

The compiler follows imported receivers through pure setup aliases and fixed-prop
specialization, preserving original method receivers and optional short circuit.
Props samples, native event adapters, mount initializers, already subscribed
native attribute projections, pure foreign methods and ordinary renderer/SSR
compilation retain their existing behavior. Deferred provider configuration
callbacks keep their invocation contract. Includes behavioral regression
coverage, migration documentation and an Octane patch
changeset.

Refs #1284.

Validation

  • pnpm format:check (current-head CI)
  • pnpm typecheck (current-head CI)
  • pnpm test (all four current-head CI shards)
  • targeted tests: packages/octane/tests/behavior-root.test.ts in development
    and production modes, including SSR, adoption, mount and later-publication
    cleanup
  • node --check for both changed compiler files and verify-dist.mjs
  • git diff --check
  • node scripts/check-changesets.js
  • node scripts/check-tsrx-module-decls.mjs
  • Syntax parsing with exact cached TypeScript 5.9.3 for both changed TS files
    (not a semantic typecheck)
  • Runtime-only smoke against actual canonical source, using exact cached
    esbuild 0.28.1 and alien-signals 3.2.0: scalar/declaration-facade/derived/pending
    and failed reads, foreign Proxy/this, optional fallback, foreign error
    identity, observer restoration and owner cancellation. Isolated graph excludes
    client/server renderer modules. Does not test compiler/SSR/adoption.
  • Helper-only production build through the public source export
    octane/dom-binding-signals, with exact cached esbuild 0.28.1 and no resolver
    aliases: only the helper and canonical read-protocol contribute bytes; no
    retained renderer modules. Isolated output is 449 raw / 333 gzip / 257 Brotli
    bytes, not a matched route saving or a compiled binding/package-dist check.

Blocked local gates: exact pinned @tsrx/[email protected] and
@tsrx/[email protected] are unavailable from the protected Socket registry.
The frozen install terminated with HTTP 403; registry, pins and lockfile are
preserved. With pinned pnpm 11.15.1 and the supported per-command
pnpm_config_verify_deps_before_run=warn setting, which prevents unintended
auto-installs, the following required/targeted commands were attempted:

  • pnpm sync exited 1 during react-parity:lockfiles:generate:
    ERR_MODULE_NOT_FOUND: Cannot find package 'typescript' imported from scripts/binding-surface-policy.mjs. Its earlier fixture synchronization
    produced no tracked diff.
  • Scoped pnpm format:files:check exited 1: spawnSync prettier ENOENT.
  • Scoped pnpm typecheck:files exited 1: spawnSync tsrx-tsc ENOENT.
  • pnpm exec vitest run packages/octane/tests/behavior-root.test.ts --project=octane --project=octane-prod exited 1: Command "vitest" not found.

Full current-head CI
passed on signed head 881a478b688e27ed206b718939be8500ba6da6b8: all 26 jobs
succeeded, including real configured formatting/typecheck, all four test shards,
all four parity shards, browser/website lanes, examples, package/dist verification,
release validation, compatibility and full-suite provenance. The binding test
file passed all 195 tests in both octane and octane-prod projects, executing
its SSR/adoption/mount/later-publication controls. Local package access remains
blocked. Integrated pre-fix reproduction, complete local sync and matched
compiler/runtime measurements remain unverified.

Risk / follow-ups

Each selected imported .get() check adds a synchronous thunk and temporary
native-read observer, including for a pure foreign accessor on source publication.
The common renderer path and artifacts without those reads emit no diagnostic
helper. Representative compiler output, raw/gzip/Brotli graphs and runtime costs
still require matched measurement after approved package access.

Mixed props/import aliases, receivers containing props samples, mixed optional
chains and opaque provider callbacks remain outside this diagnostic slice.
Subscribed .get/.latest and setup lowering remain later #1284 work; this PR
does not close the broad issue.
Direct .latest(fallback) is covered as an existing unsupported compiler
diagnostic, not claimed as a reproduced stale-read defect. Namespace/opaque
projection variants need further qualification.

The remaining #1284 roadmap also includes zero-argument exported views,
mount-only activation/cleanup, async arms with reset/error/cancellation ownership,
conditional control handles and genuine state-consumer migration, renderer-free
independent artifacts, an explicit islands-only route, signal-chat and
benchmark/fixture pilots, and final matched raw/gzip/Brotli graphs with semantic
and lifetime/allocation counters. Preserve merged #1286/#1288/#1289. The smaller
public signal entry remains intentionally deferred and Action registration
intentionally retained; neither is implemented here by copying core or adding a
public entry.

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 compiled binding activation and source publication for views that sample imported signals via .get(); misclassified reads could throw at runtime, though exclusions limit blast radius to the new diagnostic slice.

Overview
Imported signal .get() in DOM binding views no longer silently freezes as unsubscribed server text. The compiler classifies eager zero-arg .get() on imported receivers (including aliases, optional chains, and fixed-prop paths) and wraps those sites with runtime __assertBindingSnapshot, which throws during activation or BindingSource publication when the canonical native-read protocol observes a live signal read without a binding subscription.

Unchanged paths include direct handle bindings (count$ as string), props-based props.*.get() samples, pure foreign .get() methods, event/ref/mount adapter projectors (marked read-excluded), already-subscribed native attribute projections, deferred provider callbacks, and ordinary SSR.

Docs and an Octane patch changeset describe the author contract; verify-dist now requires the new octane/dom-binding-signals export. Large behavior-root regression tests cover attach/mount, structure selection, mixed chains, StyleX projections, and later publication.

Reviewed by Cursor Bugbot for commit 9be2fcd. 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 24, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review September 24, 2026 12:31
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