Repository navigation
feat: compile Strong named render blocks without descriptors - #2068
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 2b08f81. Configure here.
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
47 other measured values are unchanged. Public-import reachability bundles (bytes)
90 other measured values are unchanged. |
Brings in #2067 (mdx providers as Strong templates), #2068 (479118f, Strong named render blocks without descriptors), #2070 and Version Packages. #2068's squash matches its reviewed head 2203905 in runtime and compiler source; it adds only the MCP benchmark entry and its changeset line. Conflicts: - package.json: ci:workflow:test keeps the redesign's check-render-writes test in place of check-staged-dom; typecheck takes main's mdx typetests. - runtime.ts, hostComponent: #2068 drops the stable delegating children body; the redesign's commit-time props (state.next, commitHostComponent) stay. Re-expressed (the trial resolution of 4bf8ab0ddd): renderHostTagChildren's replacement. #2068 journalled the slot and its range, deferred the outgoing Block (deferRootReplacement, STAGED_DOM) and removed children at render. Here a different body builds in the slot's frontier over committed DOM, the outgoing Block and its nodes are queued as the slot's deletion, and landHostTagChildren swaps the slot's Block at commit; fresh DOM, or no open root render, replaces at once. scripts/render-writers.mjs classifies replaceHostTagChildren as fresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
renderHostTagChildren swapped a same-body capture into the children's Block at render. A render that was then dropped left the Block holding the dropped render's captures, so the Block's own next update rendered them: a parent render passes label 'two' to the body, a sibling suspends and the render drops, and a click inside the body then showed 'two:1' instead of 'one:1'. renderWithBody renders with the new body and, in a root render that can be dropped, restores the committed body after the render and lands the new one at commit (landBody). A dropped render, or a held boundary's dropped window, discards that op with the rest of its work; nothing is journalled. The replacement's swap of the slot's Block now runs as the outgoing range's deletion cleanup, so it lands and drops with the slot's pending structure (dropRootOps, and the failed @Try's dropBodyOps, which leaves other ops in place). childSlot's isBodyFn swap has no such gap today: its existing root-journal entry restores the body. The new test's direct case pins that, and fails when that entry is removed. Tests (strong-render-values): - a body update after a dropped render renders the committed captures, direct and through a dynamic host; the dynamic-host case failed before; - two replacements of one forwarded body in one drain (urgent, then the owner's transition in its boundary's window) land the last; the non-suspending case fails when the pending-replacement branch is skipped; the suspending case drops that window, and dropTransitionRender drops the transaction and renders it again, so the urgent replacement commits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

Summary
Strong DOM templates now compile direct named props such as
content={@{ <span>{props.label as string}</span> }}into marked render bodies without an authored arrow or element descriptor. Ordinary JSX and blocks in other value positions retain their descriptor contract. Closes #2066.The compiler reuses children-body lowering, retains simple own-data capture dependencies with the existing guarded dependency probe, and declines outer memoization for setup, conditional reads, or deeper paths. Accessors remain unread until insertion. Existing reconciliation now distinguishes changed captures from different authored bodies, including descriptor,
hostComponent, and dynamic-host forwarding. Markerless dynamic hosts use the existing whole-range rollback machinery.Validation
ba7005865f7b59345c348af75e3c3bbd22f7ca96: CI 27/27 jobs passed; PR benchmarks passed; Bugbot passed with no issues. Both earlier review threads are resolved.pnpm format:check,pnpm typecheck, andpnpm testwere not completed successfully locally; scoped alternatives and limits are below.git diff --checkpass. All commands from thepnpm syncscript completed; no generated diff remained.as,satisfies, and non-null wrappers retain the direct-block contract in client and server output. Regression coverage verifies hidden getters stay deferred and updates retain DOM identity; pinned2b08f813fails classification and eagerly reads the hidden client getter. The wrapper fix leaves all six measured complete app assets and three executable microbenchmark bundles byte-identical.perf-review: exact-base scan reports zero candidates. Hot paths:sameRenderBody(runtime.ts:16680),hostComponent(runtime.ts:36843),renderHostTagChildren(runtime.ts:38511), andchildSlot(runtime.ts:39571). Shapes remain fixed, allocation changes are measured below, and there are no new scheduling hops or layout reads. Compiler capture emission (compiler/compile.js:34923) reuses guarded reflection; no new runtime type or Block/Scope field. Production shape probes retain one map per record family; the host record shrinks from 80 to 64 shallow bytes. No unresolved must-fix finding.concise-code: compiler +71/−3, runtime +59/−31; no new public API. Reused nested-template compilation, guarded dependency probes, and range transactions. Rejected a new render-value runtime abstraction and broad descriptor rewriting. Independent read-only review findings were resolved. New files are the behavior fixture/test, focused benchmark fixture/entry, and changeset.Production client/server output was compared against upstream
0bb503fc619303ef783fb1d52218186ae7984890. The direct block has no descriptor-construction helper in either target. The following are gzip bytes for the complete production JavaScript of the same minimal HTML consumer, including the runtime:The new inline form costs 265/313 B more than the wrapper on the same runtime. Correctness requires the guarded accessor probe; this is not an across-the-board size reduction.
Clean minified Node 26.4.0/happy-dom bundles were measured in 24 balanced variant orders, 4,096 updates/sample after 8,192 warmups, with both V8 semispace bounds fixed at 256 MiB. All 192 measured loops had no GC or deoptimization, and retained DOM/text and teardown checks passed:
Paired inline/wrapper time ratios are 0.723 for unchanged captures and 1.069 for changed captures. Inline time versus the old inline form is inconclusive in both cases (paired 95% intervals include 1). Guarded reflection allocates property-descriptor objects; zero new body-function expressions on a cache hit does not mean zero allocation. These are synthetic update/heap measurements, not browser latency or GC-pause evidence.
node benchmarks/bench.mjs render-values --quick --ratiosretains the function-creation and DOM-identity regression checks.The current-head PR benchmark report also measures existing consumers. Complete Pagecraft production gzip grows from 169,276 to 169,393 B with Oxc (+117 B) and 188,669 to 188,782 B with esbuild (+113 B). All 64 js-framework work counters are unchanged; all 20 Chromium timing comparisons are within noise. This supports preserved measured work and timing, with a small bundle cost.
Risk / follow-ups
isChildrenBlock, not descriptor inspection. Use ordinary JSX for descriptor data. Other value positions and universal renderers are unchanged.@wagmi/connectors/mockdependency, and an existing 6-second large-JS compiler threshold that also fails on the untouched baseline (31.09 s base / 24.64 s candidate; byte-identical output, one sample each—not a speed claim).6e939594fbce7f53bb7e8bb8c8645c1de36b7535during validation. This PR retains the selected/tested base0bb503fc619303ef783fb1d52218186ae7984890. GitHub reports no conflicts but marks it behind under strict branch protection; human review and a base update are still needed before merge. No merge or auto-merge is enabled.[email protected]. Local checks reused an installed dependency tree with an identical lockfile; no package-manager policy or lockfile was changed. Clean CI installation and all validation jobs passed on the final head.hostComponentforwarding is client-only coverage because that existing API does not adopt server DOM; descriptor and dynamic-host forwarding have SSR/hydration coverage.Provenance
agent-authored)Implementation: Codex task · host
com-79386.Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Changes core compiler lowering and child-slot reconciliation for a new Strong-only render contract; behavior is heavily tested but mistakes could affect memoization, remounting, and host children identity.
Overview
Strong DOM templates now treat a direct component prop like
content={@{ ... }}as a render-only body (isChildrenBlock), compiled viamarkChildrenBlockinstead of an authored() =>wrapper or element descriptor. Ordinary JSX and blocks in other positions keep descriptor behavior; docs add a Named render bodies contract.The compiler enables
strongRenderValueson client and server, lowers directJSXCodeBlockprops throughcompileRenderBlockValue, tightens auto-memo (render blocks opt out of flat guards; simpleprops.*captures use guarded dependency probes), and threads Strong mode into server compile.Runtime reconciliation uses
sameRenderBodyso unchanged authored bodies can reuse slots while different bodies replace blocks;hostComponentdrops the delegating children wrapper, and host-tag /childSlotpaths remount or swap bodies when the compiled token changes (including suspension rollback).A
render-valuesbenchmark suite, ratio guards, MCP registration, and broad client/SSR/hydration tests lock in narrow capture invalidation, DOM/focus retention, and parity with explicit wrappers.Reviewed by Cursor Bugbot for commit ba70058. Bugbot is set up for automated code reviews on this repo. Configure here.