Skip to content

perf: register client warm plans without empty batches - #1028

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/warm-fallback-registration-981
Sep 10, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/warm-fallback-registration-981

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Why

The compiler already uses registerWarmPlan for attached child plans. For client fallbacks that need an in-body closure, useBatch([], thunk) performs the same active-plan stack registration, but creates an array merely to select that branch. Passing void 0 preserves the former stack entry's props value and registration point.

Changes

  • Select the client registration helper only for DOM client units, leaving puBatch([], thunk) on the server and useBatch([], thunk) on universal units.
  • Add dev/prod regressions for independent child requests, rebound props, retry and cleanup, plus post-hydration updates after server DOM adoption. Removing the registration makes both new cases fail before the second independent child request starts.
  • Extend the recursive-context production work gate with parsed compiler output and live browser counters. The own-promise fixture changes from 4 useBatch / 0 registerWarmPlan calls to 3 / 1 across suspension and retry, with one start per resource and identical visible output. A fallback-only parent module drops its sole empty batch call and import; server/universal controls remain unchanged.
  • Add an octane patch changeset.

Validation

  • pnpm typecheck
  • pnpm format:files:check on all six changed files
  • pnpm sync (no additional tracked changes)
  • vitest run packages/octane/tests/parallel-use.test.ts --project octane --project octane-prod (126 passed)
  • Octane core projects: 17,547 passed, 14 expected failures; one Volar typecheck case timed out under parallel load and passed when rerun alone (1 passed).
  • Recursive-context production work gate, paired with merged main on isolated previews; all semantic, client-output, server/universal, context, and warm-adoption guards passed.
  • pnpm test: the local Node 26 run encountered unrelated localStorage availability failures in Jotai and an email preview file-watcher assertion; repository CI uses Node 24. Current-head CI is the full-suite gate.

Risk / follow-ups

The measured result is fewer emitted empty-batch call sites and fewer browser helper calls for the fallback case. No latency, heap-allocation, or bundle-size improvement is claimed. The remaining active-plan and cache work in #981 stays open.

Provenance

  • An agent produced this diff (agent-authored)

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


Note

Medium Risk
Changes compiler output and runtime registration for client suspense/warm-plan paths; behavior is heavily gated but incorrect lowering could break parallel child warming or hydration updates.

Overview
DOM client codegen for complex parallel-use() components now registers fallback warm plans with registerWarmPlan(thunk, void 0) instead of useBatch([], thunk), avoiding a per-render empty array while keeping the same active-plan stack behavior. Server still emits puBatch([], thunk) and universal still uses useBatch([], thunk); direct data batches are unchanged.

parallel-use.test.ts adds coverage for independent child fetches when the parent’s own read is already fulfilled (including rebound props) and for post-hydration updates after server prerender. The recursive-context work gate rebaselines compiler and browser counters (e.g. warm-plan control 3 useBatch / 1 registerWarmPlan, fallback-only parents with zero batch imports, no empty-array batch sites on client controls) and documents before/after counts in the README. An octane patch changeset records the release note.

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

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.

1 participant