Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pass class as this context to custom serializer/deserializer methods#947

Merged
TooTallNate merged 4 commits intomainfrom
fix/serialization-call-context
Feb 5, 2026
Merged

Pass class as this context to custom serializer/deserializer methods#947
TooTallNate merged 4 commits intomainfrom
fix/serialization-call-context

Conversation

@TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Feb 5, 2026

Summary

  • Fixes WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE static method calls to properly pass the class as this context
  • Uses .call(ctor, value) for serialization and .call(cls, data) for deserialization
  • Adds unit test to verify this context is correctly passed to custom serializers/deserializers

Problem

When calling static serializer/deserializer methods, the previous implementation called them directly without setting the this context. This caused issues when the serializer/deserializer methods needed to access static properties or methods via this.

Solution

Changed:

  • serialize(value)serialize.call(ctor, value)
  • deserialize(data)deserialize.call(cls, data)

Test Plan

Added unit test that verifies:

  1. this is correctly bound to the class in WORKFLOW_SERIALIZE
  2. this is correctly bound to the class in WORKFLOW_DESERIALIZE
  3. Static properties are accessible via this in both methods

…hods

When calling WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE static methods,
use .call(ctor, value) and .call(cls, data) respectively to ensure the
class is passed as 'this' context. This is necessary for serializers that
access static properties or methods via 'this'.

Adds test case to verify this behavior.
Copilot AI review requested due to automatic review settings February 5, 2026 07:48
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: bc1dca2

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

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

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

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

@vercel
Copy link
Contributor

vercel bot commented Feb 5, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 479 0 38 517
✅ 💻 Local Development 438 0 32 470
✅ 📦 Local Production 438 0 32 470
✅ 🐘 Local Postgres 438 0 32 470
✅ 🪟 Windows 47 0 0 47
❌ 🌍 Community Worlds 31 169 0 200
✅ 📋 Other 129 0 12 141
Total 2000 169 146 2315

❌ Failed Tests

🌍 Community Worlds (169 failed)

mongodb (42 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
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

redis (42 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
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

starter (43 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
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

turso (42 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
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 43 0 4
✅ example 43 0 4
✅ express 43 0 4
✅ fastify 43 0 4
✅ hono 43 0 4
✅ nextjs-turbopack 46 0 1
✅ nextjs-webpack 46 0 1
✅ nitro 43 0 4
✅ nuxt 43 0 4
✅ sveltekit 43 0 4
✅ vite 43 0 4
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 43 0 4
✅ express-stable 43 0 4
✅ fastify-stable 43 0 4
✅ hono-stable 43 0 4
✅ nextjs-turbopack-stable 47 0 0
✅ nextjs-webpack-stable 47 0 0
✅ nitro-stable 43 0 4
✅ nuxt-stable 43 0 4
✅ sveltekit-stable 43 0 4
✅ vite-stable 43 0 4
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 43 0 4
✅ express-stable 43 0 4
✅ fastify-stable 43 0 4
✅ hono-stable 43 0 4
✅ nextjs-turbopack-stable 47 0 0
✅ nextjs-webpack-stable 47 0 0
✅ nitro-stable 43 0 4
✅ nuxt-stable 43 0 4
✅ sveltekit-stable 43 0 4
✅ vite-stable 43 0 4
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 43 0 4
✅ express-stable 43 0 4
✅ fastify-stable 43 0 4
✅ hono-stable 43 0 4
✅ nextjs-turbopack-stable 47 0 0
✅ nextjs-webpack-stable 47 0 0
✅ nitro-stable 43 0 4
✅ nuxt-stable 43 0 4
✅ sveltekit-stable 43 0 4
✅ vite-stable 43 0 4
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 47 0 0
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 0
❌ mongodb 5 42 0
✅ redis-dev 3 0 0
❌ redis 5 42 0
✅ starter-dev 3 0 0
❌ starter 4 43 0
✅ turso-dev 3 0 0
❌ turso 5 42 0
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 43 0 4
✅ e2e-local-postgres-nest-stable 43 0 4
✅ e2e-local-prod-nest-stable 43 0 4

📋 View full workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 0.030s (-19.9% 🟢) 1.015s (~) 0.984s 10 1.00x
💻 Local Express 0.032s (-28.7% 🟢) 1.008s (~) 0.977s 10 1.04x
💻 Local Nitro 0.044s (+53.8% 🔺) 1.008s (~) 0.964s 10 1.44x
🐘 Postgres Nitro 0.176s (-48.8% 🟢) 1.024s (+0.8%) 0.848s 10 5.76x
🐘 Postgres Express 0.240s (+1.7%) 1.015s (~) 0.775s 10 7.88x
🐘 Postgres Next.js (Turbopack) 0.294s (-12.5% 🟢) 1.020s (-1.3%) 0.726s 10 9.65x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 0.621s (-15.3% 🟢) 1.548s (-11.2% 🟢) 0.927s 10 1.00x
▲ Vercel Next.js (Turbopack) 0.685s (~) 1.707s (+11.4% 🔺) 1.022s 10 1.10x
▲ Vercel Express 0.706s (+7.8% 🔺) 2.121s (+42.9% 🔺) 1.415s 10 1.14x

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

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 1.081s (-1.3%) 2.012s (~) 0.932s 10 1.00x
💻 Local Express 1.082s (-3.4%) 2.008s (~) 0.926s 10 1.00x
💻 Local Nitro 1.121s (+3.8%) 2.008s (~) 0.887s 10 1.04x
🐘 Postgres Next.js (Turbopack) 2.084s (+1.7%) 3.021s (+7.0% 🔺) 0.937s 10 1.93x
🐘 Postgres Express 2.213s (~) 3.016s (~) 0.802s 10 2.05x
🐘 Postgres Nitro 2.453s (+3.3%) 3.015s (~) 0.562s 10 2.27x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 2.734s (-12.3% 🟢) 3.752s (-5.2% 🟢) 1.018s 10 1.00x
▲ Vercel Express 2.798s (-3.0%) 3.715s (+1.5%) 0.917s 10 1.02x
▲ Vercel Next.js (Turbopack) 2.856s (-1.4%) 3.768s (+2.9%) 0.911s 10 1.04x

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

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 10.561s (-1.4%) 11.015s (~) 0.454s 3 1.00x
💻 Local Express 10.571s (-2.6%) 11.020s (~) 0.449s 3 1.00x
💻 Local Nitro 10.858s (+2.8%) 11.017s (~) 0.159s 3 1.03x
🐘 Postgres Next.js (Turbopack) 15.927s (+5.0% 🔺) 16.035s (+3.2%) 0.108s 2 1.51x
🐘 Postgres Express 16.232s (-20.8% 🟢) 16.530s (-21.4% 🟢) 0.298s 2 1.54x
🐘 Postgres Nitro 20.338s (~) 21.043s (~) 0.704s 2 1.93x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 22.960s (+1.2%) 23.729s (+2.9%) 0.769s 2 1.00x
▲ Vercel Nitro 23.598s (+1.1%) 24.511s (+0.9%) 0.913s 2 1.03x
▲ Vercel Next.js (Turbopack) 23.855s (+1.0%) 24.553s (+2.3%) 0.699s 2 1.04x

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

workflow with 25 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 26.757s (-1.8%) 27.027s (-3.6%) 0.271s 3 1.00x
💻 Local Express 26.851s (-2.6%) 27.029s (-3.5%) 0.178s 3 1.00x
💻 Local Nitro 27.525s (+2.8%) 28.026s (+3.7%) 0.501s 3 1.03x
🐘 Postgres Express 37.910s (-24.8% 🟢) 38.065s (-25.5% 🟢) 0.155s 2 1.42x
🐘 Postgres Next.js (Turbopack) 38.131s (+2.1%) 38.568s (+1.3%) 0.437s 2 1.43x
🐘 Postgres Nitro 49.697s (~) 50.582s (~) 0.884s 2 1.86x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 58.162s (~) 59.053s (~) 0.891s 2 1.00x
▲ Vercel Express 58.785s (+2.6%) 59.828s (+2.6%) 1.042s 2 1.01x
▲ Vercel Next.js (Turbopack) 58.913s (+1.9%) 59.426s (+2.0%) 0.513s 2 1.01x

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

workflow with 50 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 55.544s (-1.6%) 56.023s (-1.8%) 0.479s 2 1.00x
💻 Local Express 55.873s (-2.7%) 56.044s (-3.4%) 0.171s 2 1.01x
💻 Local Nitro 57.294s (+3.0%) 58.050s (+3.6%) 0.756s 2 1.03x
🐘 Postgres Express 75.189s (-24.9% 🟢) 76.092s (-24.8% 🟢) 0.903s 2 1.35x
🐘 Postgres Next.js (Turbopack) 77.192s (+2.5%) 77.659s (+2.0%) 0.466s 2 1.39x
🐘 Postgres Nitro 79.032s (-21.3% 🟢) 79.631s (-21.3% 🟢) 0.599s 2 1.42x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 120.690s (-3.3%) 121.254s (-3.1%) 0.564s 1 1.00x
▲ Vercel Next.js (Turbopack) 121.400s (~) 121.822s (-0.7%) 0.422s 1 1.01x
▲ Vercel Express 122.798s (+3.0%) 123.951s (+3.1%) 1.153s 1 1.02x

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

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 1.348s (-1.9%) 2.011s (~) 0.663s 15 1.00x
💻 Local Express 1.390s (-2.7%) 2.008s (~) 0.618s 15 1.03x
💻 Local Nitro 1.420s (+4.8%) 2.007s (~) 0.587s 15 1.05x
🐘 Postgres Nitro 1.921s (-23.1% 🟢) 2.602s (-13.8% 🟢) 0.681s 12 1.42x
🐘 Postgres Express 2.131s (-5.5% 🟢) 2.473s (-18.0% 🟢) 0.342s 13 1.58x
🐘 Postgres Next.js (Turbopack) 2.149s (-8.3% 🟢) 3.030s (+12.1% 🔺) 0.882s 10 1.59x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.829s (-2.0%) 3.727s (-1.5%) 0.899s 9 1.00x
▲ Vercel Next.js (Turbopack) 3.267s (+1.0%) 4.113s (~) 0.846s 8 1.15x
▲ Vercel Nitro 3.304s (+11.5% 🔺) 4.117s (+4.8%) 0.813s 8 1.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 2.296s (-6.9% 🟢) 3.274s (+7.7% 🔺) 0.978s 10 1.00x
💻 Local Express 2.353s (-11.1% 🟢) 3.326s (+10.3% 🔺) 0.973s 10 1.02x
💻 Local Nitro 2.586s (+15.6% 🔺) 3.014s (-6.3% 🟢) 0.428s 10 1.13x
🐘 Postgres Nitro 9.335s (+11.2% 🔺) 9.546s (+5.7% 🔺) 0.212s 4 4.07x
🐘 Postgres Express 11.531s (+30.6% 🔺) 11.718s (+25.9% 🔺) 0.187s 3 5.02x
🐘 Postgres Next.js (Turbopack) 11.531s (-14.7% 🟢) 12.088s (-13.8% 🟢) 0.557s 3 5.02x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 3.049s (-15.4% 🟢) 3.833s (-27.2% 🟢) 0.784s 8 1.00x
▲ Vercel Next.js (Turbopack) 3.356s (-6.8% 🟢) 4.751s (+10.4% 🔺) 1.395s 7 1.10x
▲ Vercel Express 3.432s (+12.9% 🔺) 4.210s (+10.7% 🔺) 0.779s 8 1.13x

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

Promise.all with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 6.252s (-3.4%) 7.078s (-1.1%) 0.826s 5 1.00x
💻 Local Express 6.426s (-17.7% 🟢) 7.431s (-14.8% 🟢) 1.005s 5 1.03x
💻 Local Nitro 7.491s (+22.5% 🔺) 8.500s (+26.1% 🔺) 1.009s 4 1.20x
🐘 Postgres Nitro 49.666s (-3.0%) 50.140s (-3.8%) 0.474s 1 7.94x
🐘 Postgres Express 52.178s (+9.3% 🔺) 53.170s (+10.1% 🔺) 0.992s 1 8.35x
🐘 Postgres Next.js (Turbopack) 56.576s (+1.9%) 57.324s (+1.8%) 0.748s 1 9.05x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.633s (+5.2% 🔺) 5.092s (+24.5% 🔺) 1.459s 6 1.00x
▲ Vercel Nitro 4.103s (+17.5% 🔺) 5.123s (+24.3% 🔺) 1.020s 6 1.13x
▲ Vercel Next.js (Turbopack) 4.340s (+16.3% 🔺) 5.142s (+15.4% 🔺) 0.802s 6 1.19x

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

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 1.383s (-2.0%) 2.009s (~) 0.625s 15 1.00x
💻 Local Express 1.396s (-3.5%) 2.008s (~) 0.611s 15 1.01x
💻 Local Nitro 1.459s (+7.5% 🔺) 2.006s (~) 0.547s 15 1.05x
🐘 Postgres Express 2.204s (+9.8% 🔺) 2.679s (+2.6%) 0.474s 12 1.59x
🐘 Postgres Nitro 2.205s (+4.5%) 2.610s (+3.3%) 0.405s 12 1.59x
🐘 Postgres Next.js (Turbopack) 2.264s (+1.3%) 2.609s (-8.1% 🟢) 0.345s 12 1.64x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.791s (-4.0%) 3.726s (+1.1%) 0.936s 9 1.00x
▲ Vercel Next.js (Turbopack) 2.807s (-0.9%) 3.782s (+3.7%) 0.975s 8 1.01x
▲ Vercel Nitro 3.256s (+15.0% 🔺) 4.311s (+15.4% 🔺) 1.055s 7 1.17x

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

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 2.413s (-8.3% 🟢) 3.168s (+4.7%) 0.755s 10 1.00x
💻 Local Express 2.513s (-12.9% 🟢) 3.102s (+2.1%) 0.589s 10 1.04x
💻 Local Nitro 2.769s (+18.5% 🔺) 3.035s (-8.3% 🟢) 0.266s 10 1.15x
🐘 Postgres Nitro 12.890s (+5.6% 🔺) 13.393s (+8.4% 🔺) 0.503s 3 5.34x
🐘 Postgres Express 12.992s (+7.6% 🔺) 13.369s (+8.1% 🔺) 0.377s 3 5.38x
🐘 Postgres Next.js (Turbopack) 13.080s (-2.6%) 13.764s (~) 0.684s 3 5.42x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 2.975s (~) 3.774s (+1.0%) 0.799s 8 1.00x
▲ Vercel Next.js (Turbopack) 3.063s (+3.1%) 3.820s (~) 0.757s 8 1.03x
▲ Vercel Express 3.199s (+5.4% 🔺) 4.108s (+12.9% 🔺) 0.909s 8 1.08x

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

Promise.race with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 6.944s (+1.5%) 7.997s (-2.9%) 1.053s 4 1.00x
💻 Local Express 7.497s (-7.6% 🟢) 8.503s (+0.5%) 1.007s 4 1.08x
💻 Local Nitro 8.195s (+25.5% 🔺) 8.608s (+14.2% 🔺) 0.413s 4 1.18x
🐘 Postgres Express 54.692s (+4.7%) 55.169s (+3.6%) 0.477s 1 7.88x
🐘 Postgres Nitro 55.978s (+4.9%) 56.107s (+3.6%) 0.129s 1 8.06x
🐘 Postgres Next.js (Turbopack) 56.735s (+1.0%) 57.389s (+2.0%) 0.654s 1 8.17x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.544s (-9.7% 🟢) 4.178s (-7.0% 🟢) 0.634s 8 1.00x
▲ Vercel Nitro 3.629s (+14.3% 🔺) 4.408s (+16.4% 🔺) 0.779s 7 1.02x
▲ Vercel Next.js (Turbopack) 3.795s (+14.1% 🔺) 4.533s (+15.5% 🔺) 0.738s 7 1.07x

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

Stream Benchmarks (includes TTFB metrics)
workflow with stream

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 0.104s (-26.4% 🟢) 1.002s (~) 0.016s (+6.0% 🔺) 1.025s (~) 0.921s 10 1.00x
💻 Local Express 0.129s (-31.8% 🟢) 0.999s (+0.7%) 0.012s (-16.2% 🟢) 1.020s (~) 0.891s 10 1.24x
💻 Local Nitro 0.186s (+60.8% 🔺) 0.994s (-0.5%) 0.017s (+45.7% 🔺) 1.026s (+0.7%) 0.840s 10 1.78x
🐘 Postgres Nitro 1.206s (+5.2% 🔺) 1.841s (-2.9%) 0.000s (~) 2.014s (~) 0.808s 10 11.58x
🐘 Postgres Next.js (Turbopack) 1.322s (+11.0% 🔺) 1.793s (-3.3%) 0.000s (+Infinity% 🔺) 2.022s (~) 0.699s 10 12.70x
🐘 Postgres Express 1.334s (-43.9% 🟢) 1.709s (-35.9% 🟢) 0.000s (~) 2.015s (-33.2% 🟢) 0.681s 10 12.81x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 3.063s (+2.2%) 3.270s (-1.1%) 0.217s (+24.5% 🔺) 4.011s (+0.8%) 0.948s 10 1.00x
▲ Vercel Express 3.069s (+2.2%) 3.514s (+5.5% 🔺) 0.146s (-9.2% 🟢) 4.217s (+6.4% 🔺) 1.148s 10 1.00x
▲ Vercel Nitro 3.142s (+10.1% 🔺) 3.303s (+0.8%) 0.195s (-13.7% 🟢) 4.039s (+1.6%) 0.897s 10 1.03x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Next.js (Turbopack) 12/12
🐘 Postgres Nitro 6/12
▲ Vercel Nitro 6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 💻 Local 10/12
Next.js (Turbopack) 💻 Local 10/12
Nitro 💻 Local 10/12
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

Copy link
Member Author

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a limitation in the custom class serialization system by ensuring that the class constructor is passed as the this context when calling static WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE methods. This enables serializers/deserializers to access static properties or methods via this.

Changes:

  • Modified serialize call to use .call(ctor, value) to pass the constructor as this context
  • Modified deserialize call to use .call(cls, data) to pass the class as this context
  • Added comprehensive test case to verify the this context is correctly passed

Reviewed changes

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

File Description
packages/core/src/serialization.ts Updated serialization and deserialization logic to pass class as this context using .call()
packages/core/src/serialization.test.ts Added test case verifying that static methods receive correct this context during serialization/deserialization

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

@TooTallNate TooTallNate changed the title fix: pass class as this context to custom serializer/deserializer methods Pass class as this context to custom serializer/deserializer methods Feb 5, 2026
- Fix test to actually use `this` instead of `Counter` directly, which
  properly validates the fix
- Standardize variable naming: rename `ctor` to `cls` in the Instance
  reducer for consistency with the reviver
@TooTallNate
Copy link
Member Author

Addressed review feedback in commit 3282f26:

  • Fixed the test to actually use this.serializedCount and this.deserializedCount instead of accessing them via the class name directly. This properly validates that the this context is correctly bound.
  • Also renamed ctor to cls in the Instance reducer for consistency with the reviver code.

The test now properly uses `this.serializedCount` and `this.deserializedCount`
to validate the fix. Added biome-ignore comments to prevent the linter from
auto-fixing `this` back to the class name.
@TooTallNate TooTallNate merged commit efb33b2 into main Feb 5, 2026
98 checks passed
@TooTallNate TooTallNate deleted the fix/serialization-call-context branch February 5, 2026 19:09
pranaygp added a commit that referenced this pull request Feb 6, 2026
…-parallelization

* origin/main:
  Remove "beads" config (#952)
  Upload Next.js server logs as artifact for Windows E2E (#946)
  Pass class as `this` context to custom serializer/deserializer methods (#947)
  [docs] Fix image link in NestJS getting started guide (#941)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants