Skip to content

perf(octane): keep compiler fast paths through standard conversion calls - #2268

Merged
domgan-oai merged 7 commits into
mainfrom
perf/for-row-pure-global-calls
Oct 28, 2026
Merged

domgan-oai merged 7 commits into
mainfrom
perf/for-row-pure-global-calls

Conversation

@trueadm

@trueadm trueadm commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • An unshadowed call to a standard conversion global, such as {String(row.id)}, now keeps every compiler fast path the bare value gets. That covers:
    • keyed @for rows: dep-pure survivor skip, whole-list memo region, keyed-selection update, direct host-row mount, and the SSR row path without a per-item identity wrapper;
    • component and call-site memo regions, lite component edges, and the stable-hookful-child skip;
    • cached calculations.
  • Shadowing String with a local, parameter, import, or module binding keeps all of these off.

Why

  • Found while validating @octanejs/codemod (feat(codemod): add @octanejs/codemod, a React to Octane/TSRX migration CLI #2264) on the js-framework React hooks app.
  • With Row inlined into the @for, the migrated app selected 28× slower than the hand-written fixture, and 313× slower for 10,000 rows.
  • The suspected causes were useReducer-destructured state and the useCallback(flushSync(dispatch)) handler. Neither matters: the same app with a bare {item.id} already matched the hand-written fixture.
  • The cause was the text hole {String(item.id)}:
    • containsRenderCall treated the unbound String as an opaque call;
    • every memo free-name proof rejected the String name;
    • so every survivor re-rendered on each parent render (list flags 26 instead of 30, no memo region, no selection helper).
  • The same rejection hit component bodies. A plain function Row with {String(item.id)} got list flags 138 rather than 142, and a child converting its text lost its call-site region.
  • String(value) is the spelling .rulesync/rules/tsrx-authoring.md recommends for an intended text conversion, and the codemod emits it for number-typed text holes.

Changes

  • isConversionGlobalCall(node): a call whose callee carries the existing _octaneUnboundCallee lexical stamp from hook-deps.js and names a SETUP_PURE_GLOBAL_CALLEES global (String, Number, Boolean, parseInt, …). Four gates admit it:
    • containsRenderCall, for every caller. Arguments are still walked, so String(row.read()) fails closed.
    • The warm-potential walk. A conversion starts no async work, so a hookful child that converts its text stays eligible for the stable-hookful-child skip.
    • The lite-edge hookless check. A conversion cannot hide a hook.
    • The call-site dependency collector. It walks only the arguments, so the global itself is never compared.
  • isConversionGlobal(name, ctx): a conversion-global name that no top-level module binding shadows. It joins the immutable names in the six component-side free-name proofs:
    • calculations (autoCalculationOf);
    • stable hookful children;
    • mapped providers;
    • component call-site safety;
    • component bodies (autoMemoSafe);
    • call-site dependencies.
  • isImmutableAmbientGlobal(name, ctx): the @for whole-list and item-memo loops admit unshadowed IMMUTABLE_AMBIENT_GLOBALS.
    • This matches what the dep-pure path's isUnwitnessedAmbientRead already allows in the same function.
    • It is checked after the componentInfo branch, so a component is never treated as a global.
    • A row that reads a value such as undefined or Math.PI therefore also gets the whole-list cache.
  • isPropCreationExpr: a conversion-global call no longer counts as value creation. Its arguments still do, and so does new String(x).
    • const value = String(props.value) therefore stays an ordinary local, exactly like const value = props.value. A primitive gains nothing from a memo cell.
    • Server prop-flow emits the plain conversion instead of a per-pass memo. The only shipped case is recharts Bar's name.
    • A calculation with a real creating call, such as summarize(String(n)), still admits the conversion and is cached.
  • These globals run no user code beyond the coercion that template literals and + already perform, and every proof already admits those.
  • plainCalleeIsMemoizable and moduleHelperIsPureProjection are unchanged. A module helper whose body calls String() still is not a pure projection.
  • docs/differences-from-react.md: the call-admission paragraph now lists conversion globals. The changeset is updated to match.

Validation

  • pnpm format:check (not run repo-wide; pnpm format:files:check on every changed file passes)

  • pnpm typecheck (not run repo-wide; pnpm typecheck:files on the changed tests and fixtures reports only pre-existing errors, none on lines this diff adds)

  • pnpm test (not run locally; left to CI)

  • targeted tests, all passing on the final head:

    • octane-prod: 1,315 tests in 28 files. These are the owning suites (auto-memo, auto-calculation, automemo-render-calls, for) plus every test file whose fixture's compiled output changes (commit functions, event signal owner, hole kinds, nested, provider output, signals local chains and primitive locals, try/catch and its hydration cases, transition flush, typescript text holes, SSR invalid nesting, conformance attribute, matrix, lazy, and multichild suites).
    • octane: compiler/for-item-purity and auto-calculation, 72 tests.
    • Binding suites with changed fixtures: aria parity collections, combobox, and select; select animated; shadcn inputs and ssr/server-tier2; vite-plugin-octane plugin; xstate upstream-useActor. 102 tests.
  • pre-fix failures, checked against main and against this PR's previous head:

    • @for: the three positive cases in the new for-item-purity describe fail on main (PURE, the whole-list cache, and selection dependency index 1 in flags bits 8+).
    • Components: the four auto-memo twin cases fail on the previous head. These are a component body, a call-site prop, a hookful child that publishes its setter, and a mapped row under a provider. Each asserts that the String() source compiles byte-identically to its bare-value twin once component ids are normalized.
    • Calculations: the new auto-calculation identity case (summarize(String(items.length))) fails before the component commits.
    • signals-primitive-local-values ("evaluates conversion once…") caught an intermediate head that cached const value = String(props.value). It passes again in octane-signals, octane-signals-strong, and octane-signals-prod.
    • Shadowing, all mutation-checked:
      • The @for shadowing cases turn red when the lexical stamp is removed.
      • The three component live re-read cases (component-local, module const, and module function String) turn red when the stamp or the module-shadow check is removed.
  • Behavioral coverage:

    • The 24-row fill test (fast host mount, events, selection, edits, removal, reverse) and the SSR→hydrate adoption test also run over String()-converted fixtures.
    • automemo-render-calls gains a live shadow case and a projection case.
    • auto-memo gains live re-read cases for each shadowing form, with the source passed through props so only the String guard decides.
    • auto-calculation checks that an object built with String() keeps its identity across an unrelated render and rebuilds when its input changes.
  • Compile corpus: 5,734 outputs (client and server) across packages/, examples/, the octane-tsrx benchmark fixture, and website/src were compiled on main and on this branch. There are no new compile errors.

    • The first commit changes 25 outputs, all @for lists, plus pagecraft's document list.
    • The component commits change 31 more outputs: 30 client, plus recharts Bar's server prop-flow.
    • Shipped or app sources among them:
      • recharts Scatter;
      • select select;
      • visx BaseAreaSeries, BaseAreaStack, and BaseLineSeries;
      • website EcosystemDirectory and playground Playground;
      • the cartlane, draftboard, and threadline examples.
    • The changes are new component regions and lite edges, plus calculations whose creating call contains a conversion.
    • Admitting every standard global name in the component proofs, rather than conversion globals only, would change 26 more outputs, mostly components reading undefined. That is deliberately out of scope.
  • js-framework harness (benchmarks/js-framework/run.mjs, 8 iterations, all builds from this worktree). Ratios are to the hand-written octane-tsrx:

    variant run update select swap select_lots
    reducer + inlined String(item.id), main 1.11× 2.00× 28.66× 7.85× 312.85×
    same source, this branch 1.01× 1.18× (0.3 vs 0.2 ms, at timer resolution) 0.83× 1.00× 0.87×
    reducer + inlined bare {item.id}, main (control) 1.07× 1.00× 0.79× 1.12× 0.87×
  • PR benchmark report on the first head: all 64 js-framework work counters are unchanged, and every timed operation is within noise.

    • The only byte rows that move are pagecraft's, +135 B gzip (about +0.1%).
    • Pagecraft's document list reads undefined (aria-current={… ? 'page' : undefined}). It now gets the memo-region wrapper any qualifying list gets.
    • The component commit's byte rows will be in the refreshed report.
  • perf-review: node scripts/perf-review-scan.mjs → 0 candidates.

    • No client runtime source changes. The diff is compile-time only: one Set lookup per call or free name.
    • Compiled-output review: affected code gains the existing memo-region, calculation, lite-edge, and selection ABI. There are no new runtime helpers, per-render closures, or bagN arity changes.
    • No must-fix or needs-evidence findings.
  • concise-code: src +67 −16 (runtime +0 −0), all in compile.js.

    • New: three small predicates. isImmutableAmbientGlobal serves the @for loops. isConversionGlobal serves the six component-side free-name proofs. isConversionGlobalCall serves four call gates. The only new file is the changeset.
    • Alternative rejected: admitting the globals inside plainCalleeIsMemoizable, about the same size. It turned module helpers that wrap String() into pure projections everywhere, an untested side effect.
    • Alternative rejected: admitting every IMMUTABLE_AMBIENT_GLOBALS name in the component proofs, the same size. It changes 26 more outputs for names like undefined, a broader policy than the codemod needs.
    • bytes: not applicable (no runtime code). App bytes move only where code gains a memo region.

Risk / follow-ups

  • Follow-up for the codemod (feat(codemod): add @octanejs/codemod, a React to Octane/TSRX migration CLI #2264): its non-inlined memo(Row, customCompare) row compiles to flags 8: no single root, no dep-pure, no list cache. That is the remaining 18× select. Dropping the comparator, or memo entirely, recovers dep-pure and the list cache, and a plain function Row gets flags 142.
  • Not changed: a pure same-module helper or an imported helper used as a call-site callee is still compared as a dependency, and its body still fails the lite-edge check. A conversion global is now strictly cheaper than a helper there.
  • benchmarks/scoped-signals/retry-owner-ancestry.test.mjs now has Leaf read a module let.
    • Its retry-ancestry bound only had work to measure because String(value$.get()) kept every leaf, and so every layer above it, out of the memo proofs.
    • Once conversions became memoizable, the retry reused cached subtrees and the observer saw no retry paths. The previous compiler fails the same way if Leaf reads value$.get() without String().
    • Visible output was identical throughout. With the explicit live read, the measured scope-path entries match the original (21,384 at depth 16, 269,640 at depth 64) on both compilers.
  • vite-void-import-cycles.test.ts: B.tsx renders {String(depth)}, so A now calls it through the lite edge.
    • Lite exports are void exports vouched for by the same reprint-tolerant fingerprint, so the reprint test accepts either proven edge.
    • The fail-closed test now rejects both edges. Before, it would have passed vacuously. Mutation-checked: without its rewrite plugin it fails.
  • Residual: a module that reassigns globalThis.String would be memoized past the reassignment. The setup-checkpoint proof and IMMUTABLE_AMBIENT_GLOBALS already make the same assumption.
  • Symbol(desc) is in the admitted set. A cached calculation or skipped row keeps its earlier symbol, the same identity retention React Compiler gives an allocation with unchanged inputs.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


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


Note

Medium Risk
Compile-time-only, but it widens when regions skip re-render; shadowing and opaque arguments are the intended guardrails, with a residual assumption that runtime globalThis.String is not reassigned.

Overview
Unshadowed calls to standard conversion globals (String, Number, parseInt, etc.) no longer force memo and @for optimizations off. The compiler treats them like bare coercions: containsRenderCall skips them when arguments stay pure, and new isConversionGlobal / isConversionGlobalCall helpers let auto-memo, cached calculations, lite edges, and @for whole-list / item proofs accept the callee the same way they accept imported projections.

@for rows using {String(row.id)} keep dep-pure survivor skips, list memo regions, keyed-selection updates, and fast host paths; unshadowed reads of immutable ambient globals (e.g. undefined, Math.PI) also qualify for the whole-list cache. Shadowing String locally or in the module still fails closed, and String(row.read()) stays live because arguments are walked.

Docs and the changeset describe the React-migration spelling {String(item.id)} and the js-framework benchmark fix (select was ~28× slower on main). Tests cover compile parity with bare values, shadowing, calculation identity with summarize(String(n)), and hydration/list behavior for converted fixtures. The scoped-signals retry benchmark adds a module let on Leaf so memoizable conversions do not collapse the measured retry tree.

Reviewed by Cursor Bugbot for commit bffdbe5. Bugbot is set up for automated code reviews on this repo. Configure here.

A keyed @for row that converted its text with `String(row.id)` lost every
list fast path: containsRenderCall treated the unbound global as an opaque
call, and the whole-list and item-memo free-name loops rejected the `String`
name. Rows re-rendered on every parent render, the whole-list cache and
keyed-selection update were off, the direct host mount was declined, and SSR
kept a per-row identity wrapper.

containsRenderCall now admits a lexically unbound SETUP_PURE_GLOBAL_CALLEES
call for every caller, using hook-deps' _octaneUnboundCallee stamp so any
binding named String stays opaque. Those globals run no user code beyond the
coercion template literals and `+` already perform. The @for whole-list and
item-memo loops admit unshadowed IMMUTABLE_AMBIENT_GLOBALS, matching the
dep-pure path's isUnwitnessedAmbientRead. Component and call-site memo proofs
are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 28, 2026 20:44
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 21 value(s) increased

Compares 722b602ae, the merge commit's first parent with 86acb8723 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

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.658 2.658 ±0.0% ±0.0% … +3.6% ⚪ within noise
octane-tsrx replace 4.700 4.758 +1.0% ±0.0% … +2.2% ⚪ within noise
octane-tsrx add 2.217 2.250 +0.0% −0.0% … +4.5% ⚪ within noise
octane-tsrx update 0.093 0.094 −0.9% −2.9% … +0.2% ⚪ within noise
octane-tsrx select 0.005 0.005 ±0.0% −1.5% … +1.8% ⚪ within noise
octane-tsrx swap 0.016 0.016 −0.6% −2.2% … +0.6% ⚪ within noise
octane-tsrx remove 0.013 0.013 −1.0% −2.0% … +2.0% ⚪ within noise
octane-tsrx runlots 21.000 21.108 +0.0% −2.3% … +4.1% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 −0.5% −1.6% … +1.7% ⚪ within noise
octane-tsrx clear 37.183 38.142 +0.7% −4.9% … +6.5% ⚪ within noise
octane-jsx run 7.600 6.533 −2.5% −16.8% … +5.7% ⚪ within noise
octane-jsx replace 9.142 10.167 +1.7% −13.0% … +22.9% ⚪ within noise
octane-jsx add 3.792 3.500 ±0.0% −4.3% … +3.1% ⚪ within noise
octane-jsx update 0.195 0.208 +10.9% +1.0% … +16.9% ⚪ within noise
octane-jsx select 0.107 0.098 +0.3% −6.6% … +4.8% ⚪ within noise
octane-jsx swap 0.161 0.150 −5.0% −14.4% … +1.4% ⚪ within noise
octane-jsx remove 0.132 0.125 −6.0% −27.3% … +3.1% ⚪ within noise
octane-jsx runlots 29.000 29.083 −0.7% −3.2% … +4.4% ⚪ within noise
octane-jsx select_lots 0.915 0.906 −1.9% −7.6% … +0.5% ⚪ within noise
octane-jsx clear 39.458 41.875 +5.0% +1.2% … +7.5% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx weather_js_raw 119,739 120,826 +1,087 (+0.9%) 🔴
octane-tsrx weather_js_gzip 40,449 40,783 +334 (+0.8%) 🔴
octane-tsrx weather_js_brotli 35,999 36,276 +277 (+0.8%) 🔴
octane-tsrx weather_app_raw 23,983 24,142 +159 (+0.7%) 🔴
octane-tsrx weather_app_gzip 8,384 8,480 +96 (+1.1%) 🔴
octane-tsrx weather_app_brotli 7,125 7,224 +99 (+1.4%) 🔴
octane-tsrx weather_fw_raw 95,756 96,684 +928 (+1.0%) 🔴
octane-tsrx weather_fw_gzip 32,065 32,303 +238 (+0.7%) 🔴
octane-tsrx weather_fw_brotli 28,874 29,052 +178 (+0.6%) 🔴
octane-tsrx threadline_oxc_js_raw 136,404 136,644 +240 (+0.2%) 🔴
octane-tsrx threadline_oxc_js_gzip 45,743 45,808 +65 (+0.1%) 🔴
octane-tsrx threadline_oxc_js_brotli 40,327 40,393 +66 (+0.2%) 🔴
octane-tsrx threadline_esbuild_js_raw 175,341 175,593 +252 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_gzip 59,364 59,424 +60 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_brotli 52,364 52,410 +46 (+0.1%) 🔴
octane-tsrx pagecraft_oxc_js_raw 546,799 547,035 +236 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_gzip 172,466 172,601 +135 (+0.1%) 🔴
octane-tsrx pagecraft_oxc_js_brotli 146,598 146,770 +172 (+0.1%) 🔴
octane-tsrx pagecraft_esbuild_js_raw 582,237 582,486 +249 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_gzip 188,877 189,012 +135 (+0.1%) 🔴
octane-tsrx pagecraft_esbuild_js_brotli 160,672 160,810 +138 (+0.1%) 🔴

90 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
split-shell raw 396,337 396,334 −3 (−0.0%) 🟢
split-shell brotli 112,900 112,899 −1 (−0.0%) 🟢

139 other measured values are unchanged.

…globals

The @for whole-list proof now admits unshadowed standard global names, so a
row that reads `undefined` or `Math.PI` gets the list cache too. pagecraft's
document list (`aria-current={... : undefined}`) is the bench report's +135 B
gzip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp bffdbe5 Commit Preview URL

Branch Preview URL
Oct 28 2026, 10:26 PM

trueadm added a commit that referenced this pull request Oct 28, 2026
A child hole whose type proves it a string becomes `{x as string}`; a
number or bigint becomes `{String(x)}` (a template literal where a local
shadows `String`). Types come from one program over the project under
its tsconfig, so imported types resolve, falling back to the module's
own program, which now loads the ES5 library so array and string members
have types. As with the compiler's typed-text proof, the rule runs only
on TypeScript modules in a project with `strictNullChecks`: otherwise a
`string` may hold null, which React renders as nothing.

The js-framework run measured the casts at about 20% off creates. The
corpus casts 219 holes with no new compile errors and Strong unchanged.

The plan now records the keyed-selection finding: the inlined row's slow
selection was its `String()` call, a compiler gap fixed in #2268, not
the useReducer state; the un-inlined row's cost is memo's comparator, so
dropping a provably safe comparator replaces row inlining as the
candidate rule.

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

`String(value)` was already a call-free projection inside @for rows. Component
bodies, call sites, and calculations still rejected the `String` name, so a
child that converted its text lost its compiler memo region, lite edge, and
stable-hookful-child skip.

isConversionGlobal (a SETUP_PURE_GLOBAL_CALLEES name no module binding
shadows) now joins the immutable names in the six remaining memo free-name
proofs: calculations, stable hookful children, mapped providers, component
call sites, component bodies, and call-site dependencies. Three more gates
admit isConversionGlobalCall, the lexically unbound call:
- warm potential, since a conversion starts no async work, so the hookful
  child skip is reachable;
- the lite-edge hookless check, since it cannot hide a hook;
- the call-site dependency collector, so the global itself is never compared.

Each admitted source now compiles exactly like its bare-value twin. Shadowing
by a local, module const, or module function keeps the region off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm trueadm changed the title perf(octane): keep @for row fast paths through standard conversion calls perf(octane): keep compiler fast paths through standard conversion calls Oct 28, 2026
… String()

The retry ancestry bound only had work to measure because `String(value$.get())`
kept Leaf, and so every Layer above it, out of the compiler memo proofs. With
conversion globals now memoizable, the retry reused cached subtrees and the
observer saw no retry paths. The same failure appears on the previous compiler
if Leaf reads `value$.get()` without String().

Leaf now reads a module `let`, which no memo proof can witness, so the retry
re-renders the whole signal-owner tree. The measured scope-path entries are
unchanged: 21,384 at depth 16 and 269,640 at depth 64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm added a commit that referenced this pull request Oct 28, 2026
…n CLI (#2264)

* feat(codemod): add @octanejs/codemod, a React to Octane/TSRX migration CLI

Add `octane-codemod`, which rewrites React + TSX/JSX modules as Octane +
TSRX: React imports and React libraries move to `octane` and their bindings,
components become `@{ … }` templates with `@if`/`@for`/`@try` where that keeps
React's behavior, and template modules are renamed to `.tsrx` with every
import of them updated. Every migrated module is compiled before it is
written; `--strong` applies the compiler's fixes and keeps each module Strong
where the compiler accepts it.

Names resolve through a single-file TypeScript binding, contexts by
provenance across modules, literals and comments survive rewrites, and a
second run changes nothing. `@octanejs/cli` exports its binding catalog and
fix application for the codemod to reuse.

The Hacker News example gains a codemod lane: `codemod.mjs` respells `jsx/`
with React imports and migrates it, and the shared Playwright journeys run
against the result as a third project.

docs/octane-codemod-plan.md holds the implementation plan and the
third-party corpus results.

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

* refactor(codemod): reuse the CLI's project helpers and simplify the runner

Concise pass over the codemod before review:

- Find the project root and walk its sources with `findRoot` and
  `scanSourceFiles` from `@octanejs/cli` instead of a second walker; dot
  directories such as `.storybook/` are now skipped like other tooling.
- Share the compiler finding shape (`finding`, `thrown`) between the runner
  and the Strong pass.
- Report a module the compiler rejects in every mode as its compile error,
  not as a Strong blocker, with a regression test.
- Collapse duplicated helpers in the transform (binding names, line
  prefixes, whitespace-only children) and flatten `mapReactImport`.
- Count CLI errors from one findings list; `--no-verify` uses `parseArgs`
  `allowNegative`.

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

* docs(changeset): note the CLI root exports the codemod uses

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

* fix(codemod): address review findings on imports, providers, and Strong fallback

- Map `import('react')` and other dynamic imports of React modules to their
  Octane module, as static imports already were.
- Rewrite `.Provider` on the context's tag name, so self-closing providers
  migrate too; this replaces the element-level provider rewrite.
- Remove the `"use strong"` the codemod added wherever it sits in the
  prologue (after `"use client"` too) when a module falls back to
  compatibility mode.
- `test:e2e:dev` in the Hacker News example generates the codemod app first.

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

* fix(codemod): insert Strong directives on their own line and skip out/

- The prologue insertion point only ever falls at a line start (after a
  shebang, blank lines, whole-line comments, and directives), so the Strong
  fallback always finds the directive line it added, including when a comment
  shares the first line with code.
- Project scans skip `out/` build output again, now in the CLI's shared
  walker, so `octane analyze` skips it too.

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

* chore(codemod): list @octanejs/codemod as Node tooling source-publication debt

`@octanejs/codemod` is a Node CLI like `@octanejs/cli`: it validates its
shipped source with Node's types and publishes `.js` without sibling
declarations. List it beside the CLI under both rules, tracked by #2266,
which covers shipping declarations and scoping the Node-types rule for every
Node tooling package.

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

* docs(codemod): record a clean corpus now that #2265 fixed TS2300

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

* fix(codemod): migrate default-imported contexts and import() types

- Only a default import of React or Octane stands for the whole module; any
  other module's default import is its `default` export, so a context
  imported with `import Theme from './theme'` is recognized through the
  project's context index and its `.Provider` migrates.
- `import('react').X` in a type position maps its module, and a React type
  name Octane spells differently, the same way static imports do; renamed
  relative modules are followed there too.

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

* fix(codemod): rewrite inside a remapped import() type

A remapped specifier copied the rest of its node verbatim, so in
`import('./box').Box<import('react').ReactNode>` the nested React import
was never migrated. The rest of the node is now emitted, which visits its
type arguments.

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

* docs(codemod): record the js-framework-benchmark results

Migrated react-hooks is correct and beats React on every op, but trails
the hand-written octane-tsrx target 1.2-169x and ships React-sized
bytes. Record the numbers, the Strong blockers, react-classes, and the
three rule candidates they point to: text-hole casts, render(App), and
row inlining held on the keyed-selection question.

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

* feat(codemod): spell typed text holes as text bindings

A child hole whose type proves it a string becomes `{x as string}`; a
number or bigint becomes `{String(x)}` (a template literal where a local
shadows `String`). Types come from one program over the project under
its tsconfig, so imported types resolve, falling back to the module's
own program, which now loads the ES5 library so array and string members
have types. As with the compiler's typed-text proof, the rule runs only
on TypeScript modules in a project with `strictNullChecks`: otherwise a
`string` may hold null, which React renders as nothing.

The js-framework run measured the casts at about 20% off creates. The
corpus casts 219 holes with no new compile errors and Strong unchanged.

The plan now records the keyed-selection finding: the inlined row's slow
selection was its `String()` call, a compiler gap fixed in #2268, not
the useReducer state; the un-inlined row's cost is memo's comparator, so
dropping a provably safe comparator replaces row inlining as the
candidate rule.

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

* feat(codemod): make every JSX module TSRX and fix the weather/chat defects

Every module with JSX (`.jsx`, `.tsx`, or a `.js` file with JSX) now
becomes `.tsrx`, entries and helpers without a component included, so no
`.tsx` module is left outside Strong mode. A module that was JavaScript
gains `// @ts-nocheck`, so it stays as unchecked as it was. On the corpus
this takes `.tsrx` modules from 414 to 488 and Strong from 316 to 378,
with no compile errors.

Validating on the weather and chat benchmark apps found three defects:

- a `.jsx` entry kept JSX that Octane's Vite plugin does not compile, so
  the build failed (fixed by the TSRX change); root-absolute
  `index.html` script paths now resolve from the page's directory;
- a key on every arm of a conditional row stayed on the arms, leaving
  an unkeyed `@for` of runtime descriptors (+12.8 kB, ~2x streaming);
  a shared key now moves to the header, and differing keys keep `.map()`;
- finding lines named the new file with the old file's lines, and
  Strong blockers kept the directive's lines; notes now name the
  original file, and blockers are shifted to the written one.

The Hacker News server loads a TSRX `entry-server` when the lane has one.
The plan records both apps' results and the compiler follow-ups.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
trueadm and others added 3 commits October 28, 2026 22:03
`const value = String(props.value)` became a cached calculation once
conversion globals joined the calculation proof: isPropCreationExpr counted
the conversion as value creation. A re-render with unchanged props then skipped
the conversion (signals-primitive-local-values expects one per render), and a
primitive gains nothing from a memo cell. The bare twin `const value =
props.value` has no call and was never cached.

A conversion-global call no longer counts as creation; its arguments still do,
and `new String(x)` still does. Calculations with a real creating call keep the
conversion admission. Server prop-flow likewise emits a plain `String(...)`
instead of a per-pass memo (recharts Bar).

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

B.tsx renders `{String(depth)}`, which the lite-edge hookless check now
admits, so A calls B through componentSlotLite instead of componentSlotVoid.
Lite exports are void exports vouched for by the same reprint-tolerant
fingerprint (vite.js), so either proven edge shows the proof survived.

The fail-closed case now rejects both edges. Matching only componentSlotVoid
would have passed vacuously once B went lite. Without its rewrite plugin, that
case now fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website bffdbe5 Commit Preview URL

Branch Preview URL
Oct 28 2026, 10:27 PM

@domgan-oai
domgan-oai merged commit 3163cd8 into main Oct 28, 2026
57 of 60 checks passed
@domgan-oai
domgan-oai deleted the perf/for-row-pure-global-calls branch October 28, 2026 23:24
@github-actions github-actions Bot mentioned this pull request Oct 28, 2026
domgan-oai pushed a commit that referenced this pull request Oct 29, 2026
The test runs the codemod over the whole Hacker News app twice, compiling
every module each time. It takes about 1.3 s locally but passed Vitest's
default 5 s under CI load on #2268's test shard 2.

Co-authored-by: Claude Opus 5.5 <[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 perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants