Skip to content

refactor(three): render Canvas as a Strong template - #2080

Merged
trueadm merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/strong-three-2059
Oct 15, 2026
Merged

trueadm merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/strong-three-2059

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Converts Three's Canvas DOM boundary to a Strong template for #2059. Uses committed effect events for callbacks and one coherent layout snapshot for event source/target/prefix, preserving async renderer setup, retained scene ownership, resizing and discrete event timing. Opts hooks, root, store and loop into Strong; their emitted code is unchanged apart from the directive in client/server development/production modes. Includes a patch changeset and strengthens existing lifecycle tests.

The actual website audit has zero diagnostics across 98 modules. Three's only remaining dependency boundary is web/events.ts, whose flushSync preserves synchronous discrete-event behavior. Canvas descriptor factories fall from 2 to 0 on the client and 5 to 0 on the server; this does not claim the whole website is descriptor-free.

Validation

  • Scoped formatting, package/public API/website typechecks, source-publication check, upstream crosswalk, changeset/release-plan checks, and pnpm sync.
  • Three + differential: 148/148 tests, 23 files, on both main and candidate. Assertions cover callback freshness across pending renderer setup, no callback-driven reconfiguration, and exactly one connection to a replacement event target.
  • Three browser suite: 17/17 tests, including SSR/hydration and Vite/Rsbuild/Rspack consumers. The successful rerun used normal browser launch permissions after a sandbox launch failure.
  • Actual homepage flame: 8/8 paired flows, main/candidate × dev/production × desktop 1280×900/narrow 390×844. Same dependency graph and main base a9dfdf7b539203c00fd7887cd07c3770c6011060; source hashes fixed across builds. Real Chrome WebGL2 on ANGLE Metal: 2 extruded meshes, 3 lights, 2 draw calls and 7,878 triangles. Verified SSR DOM adoption, mouse and emulated-touch capture/rotation plus changed rendered pixels, live reduced-motion changes, canvas identity and drawing-buffer resize, navigation disposal/context loss and fresh renderer on return. Screenshots, videos, traces and JSON receipts retained with the Codex task. No physical-device or deployed-site claim.
  • Complete production public JavaScript: 614 files, 4,353,241 → 4,353,397 gzip bytes (+156, +0.0036%); raw +222 bytes. Sum of deterministic level-9 gzip for every public JS/MJS/CJS file, including copied runtimes; excludes server output/maps and is not an initial-route metric.
  • perf-review: zero scan candidates and no unresolved findings. Canvas render/commit path adds one fixed-shape snapshot record; source/target/prefix changes can require prepaint convergence. No per-frame work, new task poster, forced layout or async hop. Configure dependencies still exclude callbacks/children; resize remains [resize], root cleanup remains mount-lifetime. No speed claim.
  • concise-code and independent complexity review: shipped source +84/−79 lines, no new modules/exports/options or core runtime changes. Reuses existing primitives. Retaining callback refs fails Strong; a target-only snapshot reconnects through a stale target, demonstrated by the connection regression assertion. The coherent snapshot is the smallest passing design.
  • All required and relevant current-head checks pass on signed 0c8a779fd: full CI, PR benchmarks, and Bugbot. This includes website integration, Three compatibility, all unit/React-parity/example shards, Chromium integration, lint, types and package publication. Completed CI logs record 54,091 unit tests passed (2 skipped), 105/105 website tests, 616/616 Chromium tests, and publication checks for 123 tarballs (1,187 authored TSRX files). The 51-binding packed-source matrix passed TypeScript 5.9/6/7.1 with and without Node ambient types; existing deferred binding cases remain explicit. Normal hosted dependency installation passed. The final head incorporates main’s test-only warm-up fix; the five runtime files hash-match the paired browser build.

Risk / follow-ups

Local frozen install hit the configured registry's HTTP 403 for an unrelated table package. Both checkouts used the same previously installed graph with remapped workspace links and byte-identical localized stores; no firewall bypass or dependency changes. Normal hosted CI dependency installation and the complete validation suite passed.

The successful PR benchmark flags octane-tsrx select_lots +10.0% (95% CI +8.9% to +11.0%; both displayed medians round to 0.006 ms). All 64 work counters, 93 application-bundle values and 120 public-import values are unchanged. Exact medians are 0.005783→0.006440 ms. The row fixture imports only Octane, and its compiler/runtime, benchmark inputs and dependencies are unchanged; it does not exercise Three. This timing observation is retained without causal attribution or rerunning for a different result; no runtime-speed claim is made.

Main and candidate both show pre-existing offscreen/startup reduced-motion frames and Lynx teardown errors. Live preference changes settle correctly; no new request failures or unexpected errors appeared. Unrelated hero interaction can activate the deferred scene before scrolling, so this does not claim strictly scroll-only activation. The homepage uses native DOM drag events; existing Three event tests separately cover immediate discrete-event removal.

The selected binding audit was refreshed. Main advanced only in /devtools warm-up test setup (1622fa02); complete tracked-tree comparison found no changes to the affected runtime/compiler/dependencies, so paired QA retains its fixed base. Router/Start boundaries and recursive Strong declarations/enforcement remain separate #2059 work.

Provenance

  • An agent produced this diff (agent-authored)

Codex task · implementation host: com-79386.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
Changes Canvas commit timing, async configure callbacks, and DOM event target rebinding—subtle lifecycle behavior with broad Three consumer impact, though covered by expanded tests.

Overview
Converts @octanejs/three Canvas to a Strong template (use strong, template markup with @if for ThreeBoundary) and adds the same directive to hooks, loop, root, and store without changing their runtime logic.

Callback and event wiring are reworked for Strong rules: onCreated / onPointerMissed go through useEffectEvent instead of render-time ref cells, so committed props stay fresh without re-running async configure. Event source, resolved target, and prefix are tracked together via useLayoutSnapshot, driving bindCanvasEvents and wrapper pointerEvents when refs or props change. Canvas layout effects drop explicit dependency arrays in favor of Strong lifetime semantics while keeping async renderer setup and root teardown behavior.

Tests assert latest callbacks across pending GL setup, no extra onCreated on callback-only updates, pointer-missed freshness, and a single connect when a ref-backed event target changes. Patch changeset for @octanejs/three.

Reviewed by Cursor Bugbot for commit 0c8a779. 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 refactor PR: internal restructuring, no behavior change labels Oct 15, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 15, 2026 11:22
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🟡 js-framework: 1 timed operation(s) slower beyond ±3%

Compares 1622fa020, the merge commit's first parent with 2967cf6f4 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

target operation base ms head ms head/base 95% CI
octane-tsrx select_lots 0.006 0.006 +10.0% +8.9% … +11.0% 🟡 slower
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 3.467 3.258 −3.1% −6.5% … +3.0% ⚪ within noise
octane-tsrx replace 7.417 7.475 −1.3% −4.0% … +3.3% ⚪ within noise
octane-tsrx add 2.808 2.825 +1.8% −3.7% … +3.9% ⚪ within noise
octane-tsrx update 0.117 0.113 −0.7% −3.0% … +1.8% ⚪ within noise
octane-tsrx select 0.006 0.006 −1.1% −2.4% … +1.0% ⚪ within noise
octane-tsrx swap 0.017 0.016 −3.4% −6.1% … −1.0% ⚪ within noise
octane-tsrx remove 0.016 0.017 +1.1% −2.7% … +7.3% ⚪ within noise
octane-tsrx runlots 26.575 26.067 +0.2% −4.4% … +2.5% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 +10.0% +8.9% … +11.0% 🟡 slower
octane-tsrx clear 48.867 48.550 −1.9% −4.1% … +0.4% ⚪ within noise
octane-jsx run 3.583 3.942 ±0.0% ±0.0% … +6.7% ⚪ within noise
octane-jsx replace 9.542 9.342 +2.3% −6.1% … +5.4% ⚪ within noise
octane-jsx add 3.533 3.675 −1.3% −5.0% … +6.9% ⚪ within noise
octane-jsx update 0.279 0.274 +0.6% −3.0% … +1.7% ⚪ within noise
octane-jsx select 0.132 0.135 −1.1% −5.2% … −0.0% ⚪ within noise
octane-jsx swap 0.184 0.190 +1.6% +0.2% … +4.3% ⚪ within noise
octane-jsx remove 0.177 0.182 ±0.0% −1.6% … +1.3% ⚪ within noise
octane-jsx runlots 30.408 30.808 +0.3% −0.7% … +3.1% ⚪ within noise
octane-jsx select_lots 1.653 1.706 +2.7% +0.8% … +6.4% ⚪ within noise
octane-jsx clear 51.600 51.875 −0.4% −3.4% … +2.4% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 93 measured values.

Public-import reachability bundles (bytes)

No changes across 120 measured values.

@trueadm
trueadm merged commit 8318702 into octanejs:main Oct 15, 2026
52 checks passed
@trueadm trueadm mentioned this pull request Oct 15, 2026
6 of 7 tasks
trueadm added a commit that referenced this pull request Oct 15, 2026
* fix(octane): remove a .tsx Provider's children when they become null (#2076)

* fix(octane): remove a .tsx Provider's children when they become null

* fix(octane): remove CompiledContext children when they become null

* fix(octane): keep CompiledContext's emptied dialect so a rolled-back transition can't duplicate its children

* test(website): reload the dev /devtools warm-up once before failing

Main a9dfdf7 failed the website integration suite: the dev-SSR beforeAll
waited 120 s for the TanStack Devtools trigger on /devtools and skipped all 37
dev-SSR tests. The wait came with #2062 and has failed on main and two
branches since, while passing locally on every cold warm-up (~3.9 s).

The devtools client mounts after hydration from modules a cold dev server may
only discover on that first visit, and Vite recovers with a reload a slow
runner can miss. Wait 60 s, log what the first attempt saw, reload once, and
fail with the page errors if the trigger still never appears. The devtools
tests themselves still assert the trigger and panel on fresh loads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(three): render Canvas as a Strong template (#2080)

* fix(octane): seed nothing for a pending snapshot read instead of throwing (#2077)

A server module that reads module signals installs the native read collector
as it loads, and every later render in the process then collects its reads
for the hydration snapshot. A render that read a pending query through
snapshot(), such as an automatically streamed query, completed with a read it
could not seed and threw "A completed native server read has no serializable
ready value". On main 0bb503f, 28 of the 30 early-independent-intent cases
throw once that collector exists, while the same page renders in a server
that has loaded no such module.

A snapshot renders a pending or failed state as it is, without suspending.
The client resolves that state itself, or takes a stream's later delivery, so
the read now contributes no seed, which is also no invented ready one. A
completed value read of an unready source still throws.

The signals-hydration case that pinned the throw now asserts that contract:
the pending output renders with no hydration snapshot, adopts the same node,
and shows the result once the query resolves. The supplemental native DOM
smoke case says the same. The new streamed test loads a module-signal page,
renders a pending snapshot under streamed signals, hydrates while the client
is still pending, and takes the stream's result without a second fetch.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(octane): render a server element entry as its component's root, as hydrateRoot does (#2078)

* fix(octane): render a server element entry as its component's root, as hydrateRoot does

renderToString(<App />), and every other server renderer given an element,
rendered the element as a value its root returns (renderEntryValue), which
frames the component in a range of its own. hydrateRoot(container, <App />)
unwraps an element whose type is a component into the root's body and props,
as it does App itself, so the client root has no such range. When App returns
a component, a fragment, a Suspense boundary or a template, or renders its
children, the server's HTML did not match, and the root rendered on the
client with a recoverable error.

Each server renderer now reads its entry through renderEntry: a component
element renders as that component's root, with the props its descriptor
renders it with (descriptorProps, shared with ssrComponentDescriptor), and any
other value as before. The two entry forms produce the same HTML, and either
hydrates through either hydrateRoot form.

root-entry-forms pins every pairing of renderToString and
renderToReadableStream, each given App or <App />, with hydrateRoot given App
or <App />, for a root that returns host JSX, a template, a component, a
fragment, text, null, a Suspense boundary or its children, in dev and prod
compiles: 80 of its 256 cases fail before this change.

Client bundles are unchanged; the minified server runtime shrinks 234 B raw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(octane): read a server descriptor's children only after the scoped check

A scoped component descriptor's children getter resolves deferred children,
so reading it first ran them in the parent's scope before the component
entered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* test(website): let the generated MDX hot-update test re-write and outwait a slow runner

Main 8318702 failed the website integration suite: "hot-updates
generated MDX twice while preserving the surrounding interactive page" timed
out waiting 20 s for an edit to reach the page. It also failed on
perf/runtime-size-redesign; it passes locally every time. Until 1622fa0
the /devtools warm-up flake skipped the whole dev-SSR block, which hid it.

Each edit now waits in 15 s rounds, re-writing the file between rounds in
case the watcher dropped a write that followed the previous one, for up to
60 s; the test's budget grows to 180 s. The assertions are unchanged: the
generated text updates, the sibling counter keeps its state, and no errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(octane): keep an emptied Provider's dialect, and refill it through a frontier (#2043)

Clearing an emptied CompiledContext at commit dropped its hooks map, so the
empty dialect was lost; it is now kept. A refill's reset opens the scope's
frontier like a dialect flip, so its incoming body builds off-document.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Olzhas Alexandrov <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: domgan-oai <[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 refactor PR: internal restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants