Skip to content

[workflow] Share isolated serializer registries across replay bundles - #3639

Draft
NathanColosimo wants to merge 1 commit into
codex/replay-lazy-source-bundlesfrom
codex/replay-shared-serializer-bootstrap
Draft

[workflow] Share isolated serializer registries across replay bundles#3639
NathanColosimo wants to merge 1 commit into
codex/replay-lazy-source-bundlesfrom
codex/replay-shared-serializer-bootstrap

Conversation

@NathanColosimo

@NathanColosimo NathanColosimo commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract only dependency-isolated custom serializer modules into one content-hashed shared registry for multi-source production builds
  • retain hybrid, workflow-imported, dependency-bearing, order-sensitive, and watch-mode serializers inside each selected workflow bundle to preserve module identity and top-level effects
  • validate step-boundary candidates against transformed esbuild inputs so hybrid step modules cannot create a second serializer constructor
  • load the selected workflow and registry concurrently, compile them independently, then evaluate workflow followed by registry before hydration in Node and QuickJS
  • key QuickJS baseline snapshots on both selected workflow code and registry code, and preserve source-map remapping for both scripts

Measured shape

The current Next.js/Turbopack workbench emits 19 selected workflow bundles plus one shared registry. The registry module is 2.2 KB encoded (1,652 bytes decoded). This saves roughly 40 KB of aggregate generated artifacts for that fixture; the larger remaining duplication is hybrid/general shared runtime code and is intentionally outside this PR.

This optimization is conservative by design. If the builder cannot prove a serializer is dependency-isolated and order-safe, it keeps the previous self-contained bundle behavior.

Verification

  • pnpm --filter @workflow/builders test (227 tests)
  • pnpm --filter @workflow/core test (2,192 passed; 3 expected failures; 1 skipped)
  • pnpm --filter @workflow/builders typecheck
  • pnpm --filter @workflow/core typecheck
  • pnpm --filter @workflow/builders build
  • pnpm --filter @workflow/core build
  • pnpm --dir workbench/nextjs-turbopack build
  • final autoreview: clean, no P0-P2 findings (0.94 confidence)

The workbench build still reports its two existing warnings for dynamic world resolution and the Next config NFT trace.

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, v0 Aug 21, 2026 10:07pm
example-nextjs-workflow-webpack Ready Ready Preview, v0 Aug 21, 2026 10:07pm
example-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-astro-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-express-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-fastify-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-hono-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-nestjs-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-nitro-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-nuxt-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-python-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-sveltekit-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-tanstack-start-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workbench-vite-workflow Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workflow-docs Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workflow-swc-playground Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workflow-tarballs Ready Ready Preview, v0 Aug 21, 2026 10:07pm
workflow-web Ready Ready Preview, v0 Aug 21, 2026 10:07pm

@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 89052a4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@workflow/builders Patch
@workflow/core Patch
@workflow/astro Patch
@workflow/cli Patch
@workflow/nest Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/vitest Patch
@workflow/web-shared Patch
@workflow/web Patch
workflow Patch
@workflow/world-testing Patch
@workflow/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@NathanColosimo
NathanColosimo changed the base branch from codex/replay-lazy-source-bundles to codex/retain-vm-with-hooks August 18, 2026 22:46
@NathanColosimo
NathanColosimo changed the base branch from codex/retain-vm-with-hooks to codex/replay-lazy-source-bundles August 18, 2026 22:47
@NathanColosimo
NathanColosimo force-pushed the codex/replay-shared-serializer-bootstrap branch from 1e522d7 to c35a60b Compare August 18, 2026 22:51
@NathanColosimo
NathanColosimo force-pushed the codex/replay-shared-serializer-bootstrap branch from a968482 to de2e860 Compare August 20, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant