Skip to content

perf: discover eligible async keyed-list children earlier - #697

Merged
trueadm merged 2 commits into
octanejs:mainfrom
openai-oss-forks:fix/673-early-async-keyed-list-discovery
Aug 10, 2026
Merged

trueadm merged 2 commits into
octanejs:mainfrom
openai-oss-forks:fix/673-early-async-keyed-list-discovery

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Discover independent asynchronous children behind proven-safe keyed lists in the same request wave.
  • Statically unroll bounded list entries into Octane's existing client-side child-warming plans; no runtime, hook-slot, server, universal-renderer, or React-fixture changes are needed.
  • Extend the existing production async-composition dashboard with two keyed asynchronous panels and document the exact safety contract.

Correctness and scope

  • Admit only a private, nonescaping module-level const array of at most 16 distinct string literals, referenced exactly once as an explicitly keyed @for iterable.
  • Require the item itself as the key, statically decidable strict branch conditions, existing independently warmable child components, and literal, identifier, or single-level property-read child props.
  • Reject aliases, exports, mutation, direct eval, non-string values, holes, duplicates, oversized lists, dynamic iterables or keys, @empty, index/destructuring forms, spreads, refs, and effectful prop expressions.
  • Preserve true request dependencies, once-only adoption in the production topology, existing list-first retry behavior, keyed scopes and identity, context, refs, effects, hydration adoption, controlled inputs, and atomic transitions.
  • Leave all server and universal output unchanged; @switch, dynamic lists, and general loop-local hook warming remain outside this conservative slice.

Production work

Same authored keyed-list fixture, production minification, real Chromium, interleaved baseline/candidate samples:

Observation Previous compiler This change
Initial dashboard latency 213.15 ms 108.40 ms
Transition-update latency 211.35 ms 106.00 ms
Request waves per operation 4 2
Independent first-wave requests 3 7
Initial resource-factory calls 18 8
Transition resource-factory calls 9 13
Actual network requests 8 8
Mixed-version committed states 0 0

The 13 transition creators restore and preserve the existing async-composition ceiling; reducing that known creator-reuse residue is the separately tracked next phase. The target production bundle changes by +104 raw bytes / +13 gzip bytes / -48 Brotli bytes. The fixed 16-file compiler corpus, generic static/Suspense/hydration bundles, and production/development server output are byte-identical.

Validation

  • Full Octane development and production suites: 804 files / 11,873 tests passed.
  • Expanded compiler, keyed reconciliation, parallel use, SSR, hydration, Suspense, transition, and universal suites: 198 files / 3,251 tests passed.
  • Real Chromium Suspense/hydration integration: 11 tests passed.
  • New keyed-list consumer behavior: 22 development/production cases passed, including direct-evaluation and effectful-prop RED-to-GREEN regressions.
  • Independent adversarial compiler-shape matrix: 37 cases passed, including the 16/17 fanout boundary.
  • Existing production async-composition Chromium gate: two request waves, seven independent first-wave requests, eight unique requests, preserved 8/13 creator ceilings, and zero mixed transition states.
  • OCTANE_COMPILE_FROZEN_AST=1 and OCTANE_COMPILE_ASSERT_LOC=1 across development/production client and server fixture compiles.
  • Full workspace typecheck: pnpm --config.verify-deps-before-run=false --config.enable-pre-post-scripts=false run typecheck.
  • Final repository synchronization: pnpm --config.verify-deps-before-run=false sync.
  • Scoped Prettier verification and git diff --check.

Refs #673.

Provenance

  • An agent produced this diff (agent-authored)

Note

Medium Risk
Changes suspense/async discovery in the client compiler with a conservative static contract, but incorrect unrolling could start fetches too early or skip warming; mitigated by broad parallel-use and benchmark gates.

Overview
Client compile-time child warming can now statically unroll a narrow class of keyed @for loops into the parent’s existing warm plan so independent async children start in the same discovery wave instead of waiting for the list to mount at runtime.

Eligible lists are private module const arrays of up to 16 distinct string literals, used exactly once as the loop iterable with key = item, plus statically decidable @if / @else if arms and safe child props. The warm path never evaluates the iterable, keys, or effectful expressions; mutated, aliased, eval-touched, dynamic, or dependent-prop lists stay on the old opaque behavior. Server/universal compilation is unchanged.

The async-composition benchmark dashboard now renders ActivityPanel / InsightsPanel through DASHBOARD_PANELS and keyed @for so the gate exercises this path (fewer request waves, same network and transition atomicity expectations). Docs and a large parallel-use keyed-list suite cover hydration, guards, dependencies, and exclusion cases.

Reviewed by Cursor Bugbot for commit 46bada4. 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 perf PR: performance work labels Aug 10, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review August 10, 2026 21:14

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

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 2266e6a. Configure here.

Comment thread packages/octane/src/compiler/compile.js Resolved
Comment thread packages/octane/src/compiler/compile.js Resolved
@trueadm
trueadm merged commit 6daa380 into octanejs:main Aug 10, 2026
34 checks passed
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