Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Enable custom class serialization transformations for "client" mode - #860

Merged
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode
Jan 27, 2026
Merged

Enable custom class serialization transformations for "client" mode#860
TooTallNate merged 2 commits into
mainfrom
01-26-enable_custom_class_serialization_transformations_for_client_mode

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
Member

Enable class serialization in client mode to support passing class instances to workflow functions.

What changed?

  • Added support for class serialization transformations in "client" mode
  • The plugin now generates necessary imports and registration calls for classes that need serialization in client mode
  • When classes are detected that need serialization, the plugin:
    • Imports registerSerializationClass from "workflow/internal/class-serialization"
    • Adds registration calls for each class with a unique class ID
  • Updated test outputs to reflect these changes

How to test?

  1. Create a class with serialization methods (using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE symbols)
  2. Use the class in a client-side context where it's passed to a workflow function
  3. Verify that the class is properly serialized and deserialized when passed between client and workflow

Why make this change?

Previously, class serialization was only enabled in workflow mode, which meant that classes couldn't be properly serialized when passed from client code to workflow functions. This change ensures that classes with custom serialization methods work correctly when used as arguments to start(workflow) calls from client code.

@changeset-bot

changeset-botBot commented Jan 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a72c70

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

This PR includes changesets to release 15 packages
NameType
@workflow/swc-pluginPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/example-nestPatch
@workflow/docs-typecheckPatch
@workflow/nuxtPatch
@workflow/aiPatch

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

@github-actions

github-actionsBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production457038495
❌ 💻 Local Development416232450
✅ 📦 Local Production418032450
✅ 🐘 Local Postgres418032450
✅ 🪟 Windows450045
❌ 🌍 Community Worlds311610192
✅ 📋 Other123012135
Total19081631462217

❌ Failed Tests

💻 Local Development (2 failed)

astro-stable (2 failed):

  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
🌍 Community Worlds (161 failed)

mongodb (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (41 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (40 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro4104
✅ example4104
✅ express4104
✅ fastify4104
✅ hono4104
✅ nextjs-turbopack4401
✅ nextjs-webpack4401
✅ nitro4104
✅ nuxt4104
✅ sveltekit4104
✅ vite4104
❌ 💻 Local Development
AppPassedFailedSkipped
❌ astro-stable3924
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4104
✅ express-stable4104
✅ fastify-stable4104
✅ hono-stable4104
✅ nextjs-turbopack-stable4500
✅ nextjs-webpack-stable4500
✅ nitro-stable4104
✅ nuxt-stable4104
✅ sveltekit-stable4104
✅ vite-stable4104
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack4500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb5400
✅ redis-dev300
❌ redis5400
✅ starter-dev300
❌ starter4410
✅ turso-dev300
❌ turso5400
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4104
✅ e2e-local-postgres-nest-stable4104
✅ e2e-local-prod-nest-stable4104

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@vercel

vercelBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentReviewUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-nextjs-workflow-webpackReadyReadyPreview, CommentJan 27, 2026 7:00am
example-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-astro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-express-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-fastify-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-hono-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nitro-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-nuxt-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-sveltekit-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workbench-vite-workflowReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-docsReadyReadyPreview, CommentJan 27, 2026 7:00am
workflow-nestErrorErrorJan 27, 2026 7:00am

@TooTallNateGraphite App

TooTallNate commented Jan 26, 2026

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 2eb0768 to ebe0f20CompareJanuary 26, 2026 22:46
@TooTallNate
TooTallNateforce-pushed the 01-26-enable_custom_class_serialization_transformations_for_client_mode branch from 08e6829 to 4498ca1CompareJanuary 26, 2026 23:58
@TooTallNate
TooTallNate changed the base branch from 01-26-add_discovery_for_custom_classes_with_workflow_serialization to graphite-base/860January 27, 2026 00:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables custom class serialization transformations for "client" mode in the SWC plugin. Previously, class serialization was only handled in workflow and step modes. This change ensures that classes with custom serialization methods can be properly serialized when passed from client code to workflow functions via start(workflow) calls.

Changes:

  • Added import generation for registerSerializationClass in client mode when classes need serialization
  • Added registration call generation for classes in client mode (both Module and Script cases)
  • Updated test fixtures to reflect the new client mode behavior with serialization imports and registration calls

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdded logic to generate serialization imports and registration calls for client mode in both Module and Script cases
packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.jsAdded expected import and registration call for MyService class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.jsAdded expected import and registration call for Point class
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.jsAdded expected import and registration calls for Circle, Rectangle, and Triangle classes
packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.jsAdded expected import and registration calls for Color and Vector classes
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.jsAdded expected import and registration call for TestClass
.changeset/modern-clubs-own.mdAdded changeset documenting this patch change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs

@ijjkijjk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good but the deduplication callout from copilot does seem good as well

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.041s (-16.4% 🟢)1.019s (~)0.978s101.00x
💻 LocalExpress0.043s (-1.6%)1.008s (-1.3%)0.965s101.04x
💻 LocalNitro0.043s (-11.1% 🟢)1.007s (~)0.964s101.06x
🐘 PostgresExpress0.127s (-48.6% 🟢)1.015s (~)0.888s103.10x
🐘 PostgresNitro0.162s (-60.9% 🟢)1.026s (+1.2%)0.864s103.96x
🐘 PostgresNext.js (Turbopack)0.242s (+100.4% 🔺)1.021s (~)0.778s105.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.596s (-11.7% 🟢)1.698s (+12.3% 🔺)1.101s101.00x
▲ VercelExpress0.629s (-18.0% 🟢)1.601s (-5.4% 🟢)0.972s101.05x
▲ VercelNext.js (Turbopack)0.695s (-17.4% 🟢)1.553s (-9.9% 🟢)0.858s101.17x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.103s (~)2.012s (~)0.909s101.00x
💻 LocalExpress1.116s (~)2.008s (~)0.892s101.01x
💻 LocalNitro1.118s (~)2.007s (~)0.889s101.01x
🐘 PostgresNext.js (Turbopack)2.254s (+17.5% 🔺)3.019s (+49.8% 🔺)0.765s102.04x
🐘 PostgresExpress2.472s (+17.8% 🔺)3.013s (~)0.541s102.24x
🐘 PostgresNitro2.473s (+9.2% 🔺)3.014s (~)0.542s102.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.730s (-1.8%)3.744s (+3.0%)1.013s101.00x
▲ VercelNitro2.874s (~)3.779s (+4.6%)0.905s101.05x
▲ VercelNext.js (Turbopack)2.952s (+1.5%)3.663s (-0.7%)0.711s101.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.716s (~)11.018s (~)0.302s51.00x
💻 LocalNitro10.841s (~)11.014s (~)0.173s51.01x
💻 LocalExpress10.852s (~)11.013s (~)0.161s51.01x
🐘 PostgresNitro20.292s (+0.6%)21.041s (~)0.750s51.89x
🐘 PostgresExpress20.310s (+30.5% 🔺)21.037s (+31.2% 🔺)0.726s51.90x
🐘 PostgresNext.js (Turbopack)20.354s (+40.4% 🔺)21.043s (+39.9% 🔺)0.689s51.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro22.236s (-6.6% 🟢)23.066s (-5.8% 🟢)0.830s51.00x
▲ VercelExpress22.515s (-6.9% 🟢)23.414s (-6.1% 🟢)0.898s51.01x
▲ VercelNext.js (Turbopack)22.838s (~)23.452s (-1.4%)0.614s51.03x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.389s (~)2.012s (~)0.622s151.00x
💻 LocalNitro1.413s (~)2.007s (~)0.594s151.02x
💻 LocalExpress1.414s (-0.8%)2.007s (~)0.593s151.02x
🐘 PostgresNext.js (Turbopack)2.200s (+3.3%)2.853s (+5.3% 🔺)0.653s111.58x
🐘 PostgresNitro2.305s (-4.9%)2.678s (-11.0% 🟢)0.373s121.66x
🐘 PostgresExpress2.515s (+21.3% 🔺)3.014s (+16.0% 🔺)0.499s101.81x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.000s (-3.5%)3.773s (-5.5% 🟢)0.773s81.00x
▲ VercelNitro3.406s (+7.1% 🔺)4.360s (+11.9% 🔺)0.954s71.14x
▲ VercelExpress3.551s (+21.7% 🔺)4.414s (+16.5% 🔺)0.863s71.18x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.472s (~)3.066s (-4.3%)0.594s101.00x
💻 LocalExpress2.502s (-2.0%)3.029s (+0.5%)0.527s101.01x
💻 LocalNitro2.510s (-2.1%)3.026s (~)0.515s101.02x
🐘 PostgresExpress7.934s (-20.5% 🟢)8.305s (-20.5% 🟢)0.371s43.21x
🐘 PostgresNitro8.839s (+18.5% 🔺)9.274s (+14.9% 🔺)0.435s43.58x
🐘 PostgresNext.js (Turbopack)11.559s (-0.8%)12.037s (-0.7%)0.478s34.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.235s (-6.5% 🟢)4.052s (-0.7%)0.817s81.00x
▲ VercelExpress3.374s (+2.4%)4.168s (+2.8%)0.795s81.04x
▲ VercelNitro3.535s (+15.7% 🔺)4.228s (+10.6% 🔺)0.694s81.09x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.409s (-2.7%)2.007s (~)0.598s151.00x
💻 LocalNext.js (Turbopack)1.427s (+1.0%)2.013s (~)0.586s151.01x
💻 LocalExpress1.434s (~)2.006s (~)0.572s151.02x
🐘 PostgresNitro1.967s (-8.0% 🟢)2.477s (-4.7%)0.511s131.40x
🐘 PostgresExpress2.061s (+14.5% 🔺)2.528s (+13.3% 🔺)0.467s121.46x
🐘 PostgresNext.js (Turbopack)2.299s (-2.5%)2.746s (-9.2% 🟢)0.447s111.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.838s (+1.0%)3.792s (+3.6%)0.953s81.00x
▲ VercelExpress2.853s (+0.9%)3.886s (+5.3% 🔺)1.033s81.01x
▲ VercelNext.js (Turbopack)3.017s (+5.7% 🔺)4.024s (+9.6% 🔺)1.007s81.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.536s (~)3.102s (+1.6%)0.566s101.00x
💻 LocalExpress2.568s (-2.8%)3.022s (~)0.454s101.01x
💻 LocalNitro2.596s (-0.5%)3.022s (~)0.427s101.02x
🐘 PostgresNitro11.622s (-3.4%)12.050s (-2.8%)0.428s34.58x
🐘 PostgresExpress12.974s (+6.7% 🔺)13.022s (+2.5%)0.048s35.12x
🐘 PostgresNext.js (Turbopack)13.121s (-5.6% 🟢)13.705s (-4.6%)0.584s35.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.089s (-21.8% 🟢)3.948s (-18.8% 🟢)0.859s81.00x
▲ VercelNext.js (Turbopack)3.263s (+4.6%)4.032s (+6.9% 🔺)0.769s81.06x
▲ VercelExpress3.657s (+2.4%)4.312s (-0.8%)0.655s71.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.6%)1.004s (~)0.016s (-12.2% 🟢)1.027s (~)0.884s101.00x
💻 LocalExpress0.184s (-0.7%)0.992s (~)0.018s (+19.9% 🔺)1.024s (~)0.841s101.28x
💻 LocalNitro0.188s (-0.6%)0.993s (~)0.015s (-2.6%)1.022s (~)0.834s101.31x
🐘 PostgresNext.js (Turbopack)1.304s (+107.0% 🔺)2.040s (+109.8% 🔺)0.000s (NaN%)2.120s (+108.6% 🔺)0.816s109.07x
🐘 PostgresNitro1.451s (-41.4% 🟢)2.266s (-11.6% 🟢)0.000s (-100.0% 🟢)2.314s (-23.2% 🟢)0.863s1010.10x
🐘 PostgresExpress2.104s (+65.2% 🔺)2.936s (+66.6% 🔺)0.000s (NaN%)3.016s (+49.7% 🔺)0.911s1014.64x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.932s (-4.8%)3.245s (+2.3%)0.537s (-33.6% 🟢)4.267s (-5.6% 🟢)1.335s101.00x
▲ VercelNitro3.058s (-0.7%)3.228s (+1.8%)0.672s (-35.1% 🟢)4.459s (-7.0% 🟢)1.401s101.04x
▲ VercelExpress3.100s (+2.6%)3.330s (+2.9%)0.518s (-13.5% 🟢)4.388s (+1.7%)1.288s101.06x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)7/8
🐘 PostgresNext.js (Turbopack)3/8
▲ VercelNitro4/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local8/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Address code review feedback from Copilot and ijjk:
- Extract duplicated class serialization registration logic into
create_class_serialization_registration() helper method
- Reduces code duplication across workflow mode, client mode (Module),
and client mode (Script) cases
- Add consistent comment explaining why client mode needs registration
- Update spec.md to document custom serialization in client mode

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 Build Fix:

The OpenAI class is not constructable in the imported module. This is a type error where the code is trying to instantiate the OpenAI class, but the module export doesn't provide a constructor signature.

Fix on Vercel

Sign up for freeto 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.

3 participants

@TooTallNate@ijjk