Repository navigation
fix(compiler): preserve map observations for source-visible proxies - #3051
Conversation
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 111 measured values. Public-import reachability bundles (bytes)No changes across 141 measured values. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
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 0826d7b. Configure here.

Summary
The compiler's keyed map eligibility check adds observable prototype and descriptor traps when the receiver is a Proxy. Keep an explicit
new Proxy(...)receiver, or a localconstbound to that construction, on the authored map callback path in both client and SSR. Reuse lexical scope analysis so a shadowed constructor continues to follow the ordinary list path.Refs #2567. Proxies received through props, state, imports, or other external values remain unresolved. Browser JavaScript cannot distinguish them from ordinary arrays without observable operations, and sending all dynamic receivers through the authored callback conflicts with existing mount/coercion ordering and materially regresses mapped-list performance. A block-bodied JSX callback remains an escape for those receivers.
Validation
pnpm format:checkpnpm typecheckpnpm testgit diff --check,pnpm sync.5e0c376602c4). Explicit Proxy output changes from 2,566 to 1,094 bytes and uses the authored callback path.bc5031f1f, including the benchmark report.Perf review: #3051 (a632714..bc5031f)
Scan:
git diff d69609368..HEAD -- packages/octane/src/compiler/compile.js | node scripts/perf-review-scan.mjs --diff - --json packages/octane/src/compiler/→ 0 candidates. The change runs during compilation, caches the source-token check, and builds the lexical Proxy binding index at most once for a module containingProxy. Ordinary dynamic-list code generation, runtime imports, per-row work, DOM insertion, shapes, and scheduling remain unchanged. Source-visible Proxy lists deliberately allocate authored callback descriptors for correctness; no performance claim is made for that exceptional path.concise-code: compiler source +51/−0, client runtime +0/−0, regression tests +79/−0, one patch changeset; no new runtime modules, exports, fields, or public API. The source proof extends the existing lowering owner and reuses lexical analysis.Risk / follow-ups
Live main currently contains a known codemod regression from the stale-head merge of #3052. Base integration is held for repair #3066; CI on this PR's current head does not validate that broken-main combination.
This is a partial fix and does not close #2567. Source classification assumes the realm's unshadowed global
Proxyis the standard intrinsic; replacing that global remains outside this proof. The unknown external-receiver tradeoff needs an explicit framework semantics decision rather than a reflective Proxy heuristic.Provenance
agent-authored)Codex task · Host
com-79386Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Touches JSX list lowering in the compiler with nuanced Proxy/source classification; behavior change is scoped to explicit Proxy receivers but could affect compiled output size and map semantics for those cases.
Overview
The compiler now skips keyed JSX
.map→@forfusion when the list receiver is a source-visibleProxy—eithernew Proxy(...)in place or a localconstbound to that construction—so eligibility checks don’t run reflective guards that would observe Proxy traps before native.map.Classification reuses module lexical analysis (
isProxyConstruction/isSourceProxyMapReceiver): only the realm’s globalProxycounts; shadowed constructors and unrelated values keep the ordinary fused list path.Tests compare client/SSR Probe vs Control trap sequences for inline and aliased Proxy receivers, plus a control that ordinary list fusion still runs with a shadowed
Proxyand sparse arrays. Patch changeset for Octane.Reviewed by Cursor Bugbot for commit bc5031f. Bugbot is set up for automated code reviews on this repo. Configure here.