Repository navigation
fix(octane): enumerate deferred JSX values with ordinary element keys - #1659
Merged
Merged
Conversation
Since #1069 the client's scoped value descriptor defined an enumerable __octaneInvocationSite accessor, so Object.keys, for...in and spread listed an internal seventh key that ordinary createElement descriptors carry only when a site exists. A deferred value cannot know whether its record has a site without resolving it, so make the accessor non-enumerable, as the server twin already was. The getter still forwards the resolved record's site to component slots, signal identity and SSR. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 3, 2026 10:25
Contributor
Benchmark report
Compares js-framework: 1k/10k row operations (ms, lower is better)All 20 timed operations (20 within noise)
Application bundle size (bytes)
39 other measured values are unchanged. Public-import reachability bundles (bytes)
97 other measured values are unchanged. |
5 of 8 tasks
6 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
benchmarks/scoped-descriptor-shapespins a scoped descriptor's own enumerable keys to['$$kind', 'type', 'props', 'key', 'ref', 'children'], the same keys an ordinarycreateElementdescriptor has. Since #1069, the client'sscopedValueDescriptorhas defined an enumerable seventh accessor,__octaneInvocationSite. An ordinary descriptor gets that field only when a call site exists. As a result, the client half of the suite failed with+ '__octaneInvocationSite', and the weekly run reports it as a hard error.Contract: a deferred JSX value (
createScopedValue/nativeCreateScopedValue) enumerates exactly the public element keys.__octaneInvocationSitestays an own getter, so every internal read keeps working, but it is non-enumerable. The server twin already made this choice (enumerable: false), andssr-element-utils.test.tsalready pins the six keys there. This PR brings the client into line.Why not the alternatives:
createElementcall and exposes an internal field through every element'sObject.keys.The pinned keys in
run.mjsare unchanged.Changes
runtime.ts: the scoped-value__octaneInvocationSiteaccessor is nowenumerable: false.runtime.tsandruntime.server.tsboth get the same comment explaining the constraint, so the twins stay aligned.scoped-jsx-values.test.ts:Object.keysandfor...inon a client scoped value matchcreateElement, and enumerating doesn't run the resolver.hydration/signal-instance-identity.test.ts: two dynamic JSX values from distinct call sites render the same component. Each holds asignal$and a streamed query, run through prerender andhydrateRoot, in dev and prod compile. This guards the neighbouring behaviour: the call site must still reach signal identity through the now-hidden getter.octane.Validation
pnpm format:check: not run repo-wide.pnpm format:fileson all changed files reported them unchanged, and the changeset passes the check.pnpm typecheck: not run repo-wide.pnpm typecheck:filesis clean for both runtimes and the hydration test.scoped-jsx-values.test.tsreports TS6142 on its.tsxfixture import under the scoped tool, and the file atmainreports the same error, so it predates this change.pnpm test: not run locally; left to CI.octaneproject:scoped-jsx-values.test.ts: 365 passed. The new enumeration test failed before the fix with the extra key.signal-instance-identitycase: passes. I broke the scoped-value getter deliberately and confirmed it goes red each time:left, left.signal$-only fixture missed the client-only break, because the signals-module child binding masks it. That's why the case also includes a streamed query.node benchmarks/scoped-descriptor-shapes/run.mjs 3passes for client and server (48 targets), both before and after rebasing onto currentmain.mainbuild, run alternately (baseline, fix, fix, baseline; 9 samples each, Node, macOS arm64). The baseline fails the key assertion, so both builds ran through one scratch copy of the harness with only that assertion relaxed. The machine's load average was about 30, so treat these as noisy. Adjusted for the plain-element control, scoped-value results at 1,024 items were 0.91–1.05× of baseline, which shows no regression. 47 of 48 output hashes matched across all four runs. The one that changed,client-scoped-value-enumerate-1024, is the intended fix: the baseline'sfor...inalso returned the internal key.Risk / follow-ups
Object.assigns a descriptor.__octaneInvocationSiteinObject.keys, as before. Hiding it there would touch thecreateElementFromConfighot path, so it's left as a separate decision.octane-jsxand the base-ui/radix reachability bundles), while brotli fell 50–70 B on the two Vite reachability bundles. Raw bytes are unchanged: the only emitted change is oneenumerable:!0becoming!1, which breaks a run of identical descriptor literals. Minifying the client runtime locally gives the same picture: +2 B gzip and +107 B brotli forfalse. Omitting the field, which also defaults to non-enumerable, gives −14 B raw but +1 B gzip / +56 B brotli. I kept the explicitfalse, matching the server.HARNESS_FAILURE_ALLOWLISTentry to remove. ci(bench): triage the weekly ratio-guard breaches so new ones show #1641 dropped its temporary waiver for this suite in 0e37411, so the suite stays a hard error in the weekly run until this lands.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Small descriptor-metadata change with targeted tests; main behavioral note is that object spread on the client now omits the invocation site, matching existing server behavior.
Overview
Aligns deferred JSX values (
createScopedValue) on the client with ordinarycreateElementdescriptors for enumeration:Object.keys,for...in, and spread no longer surface the internal__octaneInvocationSitegetter.The client scoped-value descriptor sets that property to
enumerable: false(the server already did), with a shared comment inruntime.tsandruntime.server.ts. Runtime reads of the call site are unchanged; only public key lists match the benchmark contract['$$kind', 'type', 'props', 'key', 'ref', 'children'].Adds a unit test that enumeration matches
createElementwithout running the deferred resolver, plus a hydration test that two dynamic JSX values at distinct call sites still keep signal and streamed-query identity separate through prerender andhydrateRoot.Reviewed by Cursor Bugbot for commit 1c558db. Bugbot is set up for automated code reviews on this repo. Configure here.