Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@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

Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@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

Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@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

Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@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

Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@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

Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@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

Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@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

Add support for top-level using declarations inside of step / workflow functions - #866

Merged
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions
Jan 27, 2026
Merged

Add support for top-level using declarations inside of step / workflow functions#866
TooTallNate merged 2 commits into
mainfrom
01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 27, 2026

Copy link
Copy Markdown
Member

Added support for top-level using declarations inside step and workflow functions. Note that the detection code in our SWC plugin is looking for the specific transformation that SWC itself produces when using the using declaration, which is fragile. However because we control the version of SWC being used that makes it not so bad (i.e. our e2e tests would fail if/when we update SWC and if the transformation format changed in an incompatible way).

Fixes#837.

What changed?

This PR adds support for TypeScript's using declarations (disposable resources) within step and workflow functions. When TypeScript transforms using declarations, it wraps the function body in a try-catch-finally block, which previously prevented the plugin from correctly identifying the directive. The implementation:

  1. Adds detection for the TypeScript using transformation pattern
  2. Identifies directives inside the try block of this pattern
  3. Properly removes directives from these blocks during transformation
  4. Updates the plugin documentation with details about this feature
  5. Adds test fixtures for the using declaration in step functions

How to test?

Create a step or workflow function that uses TypeScript's using declarations:

asyncfunctiontestStep(){'use step';
using resource=getResource();awaitdoWork(resource);}

Verify that the function is correctly identified and transformed as a step function.

Why make this change?

TypeScript's using declarations are a useful feature for managing disposable resources. This change ensures that developers can use this feature within step and workflow functions without breaking the plugin's ability to identify and transform these functions correctly.

@changeset-bot

changeset-botBot commented Jan 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9be6d75

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 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🥇 Nitro0.043s (+2.4%)1.007s (~)0.964s101.00x
💻 LocalExpress0.043s (-1.1%)1.007s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.044s (+9.5% 🔺)1.019s (~)0.975s101.02x
🐘 PostgresNitro0.146s (-20.0% 🟢)1.028s (+0.8%)0.881s103.40x
🐘 PostgresNext.js (Turbopack)0.187s (-52.7% 🟢)1.022s (-2.0%)0.834s104.36x
🐘 PostgresExpress0.306s (+16.0% 🔺)1.016s (~)0.710s107.11x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.672s (-1.2%)1.561s (-2.4%)0.888s101.00x
▲ VercelNext.js (Turbopack)0.698s (-29.1% 🟢)1.635s (-7.2% 🟢)0.937s101.04x
▲ VercelExpress0.821s (+3.8%)1.739s (-1.1%)0.918s101.22x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.091s (~)2.012s (~)0.922s101.00x
💻 LocalExpress1.115s (~)2.007s (~)0.892s101.02x
💻 LocalNitro1.117s (~)2.007s (~)0.890s101.02x
🐘 PostgresNext.js (Turbopack)1.876s (+9.3% 🔺)2.016s (~)0.140s101.72x
🐘 PostgresExpress2.131s (-2.7%)3.015s (~)0.883s101.95x
🐘 PostgresNitro2.466s (+3.6%)3.013s (~)0.547s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.937s (+1.9%)3.716s (-1.1%)0.779s101.00x
▲ VercelExpress3.037s (+5.2% 🔺)4.021s (+8.5% 🔺)0.984s101.03x
▲ VercelNext.js (Turbopack)3.178s (+7.1% 🔺)4.265s (+15.4% 🔺)1.087s101.08x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.727s (~)11.018s (~)0.291s51.00x
💻 LocalExpress10.825s (~)11.011s (~)0.186s51.01x
💻 LocalNitro10.838s (~)11.018s (~)0.179s51.01x
🐘 PostgresNext.js (Turbopack)14.794s (-2.9%)15.036s (-5.1% 🟢)0.241s51.38x
🐘 PostgresNitro20.332s (~)21.037s (~)0.704s51.90x
🐘 PostgresExpress20.535s (+0.6%)21.028s (~)0.493s51.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro23.423s (+0.9%)24.281s (+0.5%)0.858s51.00x
▲ VercelExpress23.428s (-1.5%)24.490s (~)1.062s51.00x
▲ VercelNext.js (Turbopack)23.771s (+2.8%)24.667s (+2.9%)0.896s51.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.382s (-1.8%)2.006s (~)0.624s151.00x
💻 LocalNext.js (Turbopack)1.383s (~)2.011s (~)0.628s151.00x
💻 LocalNitro1.410s (+1.5%)2.006s (~)0.597s151.02x
🐘 PostgresNext.js (Turbopack)1.682s (-3.7%)2.014s (-6.7% 🟢)0.332s151.22x
🐘 PostgresExpress2.367s (+15.3% 🔺)3.012s (+9.7% 🔺)0.645s101.71x
🐘 PostgresNitro2.529s (+1.9%)3.014s (~)0.485s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.140s (+11.5% 🔺)3.933s (+4.2%)0.793s81.00x
▲ VercelExpress3.268s (+13.2% 🔺)4.131s (+7.2% 🔺)0.863s81.04x
▲ VercelNext.js (Turbopack)3.357s (+5.4% 🔺)4.170s (+1.2%)0.813s81.07x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.421s (-1.0%)3.296s (+7.4% 🔺)0.875s101.00x
💻 LocalExpress2.445s (-2.6%)3.060s (+1.3%)0.615s101.01x
💻 LocalNitro2.539s (+1.7%)3.016s (~)0.476s101.05x
🐘 PostgresNitro8.348s (+6.4% 🔺)9.043s (+6.0% 🔺)0.695s43.45x
🐘 PostgresExpress8.725s (-9.5% 🟢)9.345s (-10.0% 🟢)0.620s43.60x
🐘 PostgresNext.js (Turbopack)10.855s (-4.7%)11.030s (-8.7% 🟢)0.175s34.48x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.247s (-7.1% 🟢)3.796s (-16.0% 🟢)0.548s91.00x
▲ VercelNext.js (Turbopack)3.258s (-3.6%)3.894s (-2.2%)0.636s91.00x
▲ VercelExpress3.603s (+12.6% 🔺)4.479s (+15.4% 🔺)0.876s71.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.383s (-0.7%)2.010s (~)0.627s151.00x
💻 LocalExpress1.398s (-1.9%)2.006s (~)0.608s151.01x
💻 LocalNitro1.434s (~)2.006s (~)0.572s151.04x
🐘 PostgresNext.js (Turbopack)1.989s (-8.7% 🟢)2.330s (-13.9% 🟢)0.341s131.44x
🐘 PostgresExpress2.063s (-4.1%)2.931s (+16.6% 🔺)0.869s111.49x
🐘 PostgresNitro2.221s (-1.6%)2.685s (~)0.464s121.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.829s (-2.8%)3.760s (-2.4%)0.931s81.00x
▲ VercelNitro2.943s (-30.7% 🟢)3.706s (-26.3% 🟢)0.763s91.04x
▲ VercelExpress3.129s (+10.3% 🔺)4.079s (+10.1% 🔺)0.950s81.11x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.470s (-5.3% 🟢)3.044s (-3.4%)0.574s101.00x
💻 LocalExpress2.509s (-2.3%)3.019s (~)0.511s101.02x
💻 LocalNitro2.631s (+3.7%)3.018s (~)0.387s101.06x
🐘 PostgresExpress10.721s (-7.5% 🟢)11.029s (-8.4% 🟢)0.308s34.34x
🐘 PostgresNext.js (Turbopack)11.337s (-5.3% 🟢)11.691s (-5.4% 🟢)0.354s34.59x
🐘 PostgresNitro13.078s (+9.8% 🔺)13.387s (+8.1% 🔺)0.310s35.29x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.133s (+0.6%)3.931s (+2.8%)0.798s81.00x
▲ VercelNext.js (Turbopack)3.634s (+19.0% 🔺)4.345s (+15.4% 🔺)0.711s81.16x
▲ VercelNitro3.937s (+19.6% 🔺)4.516s (+7.1% 🔺)0.579s71.26x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.144s (+1.5%)1.003s (~)0.017s (+1.2%)1.027s (~)0.883s101.00x
💻 LocalExpress0.176s (-3.4%)0.992s (~)0.014s (-9.1% 🟢)1.021s (~)0.845s101.22x
💻 LocalNitro0.184s (~)0.993s (~)0.016s (-5.4% 🟢)1.023s (~)0.839s101.27x
🐘 PostgresNext.js (Turbopack)0.887s (-32.1% 🟢)1.485s (-14.7% 🟢)0.000s (-100.0% 🟢)1.619s (-19.9% 🟢)0.732s106.14x
🐘 PostgresNitro2.131s (~)2.912s (~)0.000s (+Infinity% 🔺)3.015s (~)0.885s1014.75x
🐘 PostgresExpress2.401s (+24.2% 🔺)2.638s (+4.4%)0.000s (~)3.013s (+11.0% 🔺)0.612s1016.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.970s (-5.2% 🟢)3.293s (-2.7%)0.775s (+1.6%)4.598s (-1.4%)1.629s101.00x
▲ VercelNext.js (Turbopack)3.140s (-1.9%)3.298s (~)0.826s (-15.2% 🟢)4.670s (-2.2%)1.529s101.06x
▲ VercelNitro3.285s (+5.9% 🔺)3.586s (+7.8% 🔺)0.519s (-58.4% 🟢)4.675s (-8.4% 🟢)1.390s101.11x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)6/8
🐘 PostgresNext.js (Turbopack)5/8
▲ VercelNitro5/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

@vercel

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 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-stable4104
✅ 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

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

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

@TooTallNate
TooTallNate marked this pull request as ready for review January 27, 2026 17:22
CopilotAI review requested due to automatic review settings January 27, 2026 17:22

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

Adds support for recognizing step/workflow directives when TypeScript/SWC transforms top-level using declarations by wrapping the function body in a try/catch/finally, which previously hid the directive from the plugin’s directive scanner.

Changes:

  • Detect "use step" / "use workflow" directives inside the try block of the using-transform pattern.
  • Remove directives from inside that try block during transformation.
  • Add a fixture covering using in a step function and document the behavior in the plugin spec.

Reviewed changes

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

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsAdds heuristic detection/removal logic for directives inside using-transformed try blocks.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/input.jsNew fixture input representing using-transformed step function output.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-step.jsExpected step-mode transformation output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.jsExpected client-mode output for the new fixture.
packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-workflow.jsExpected workflow-mode output for the new fixture.
packages/swc-plugin-workflow/spec.mdDocuments support for directives inside using-transformed functions.
.changeset/green-foxes-lose.mdPublishes a patch release note for the plugin 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
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
}
```

The plugin detects this pattern and correctly identifies the directive inside the try block, removing it during transformation while preserving the disposable resource handling.

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.

this behaviour seems flaky no? esp. if you have multiple transforms that are being applied one after the other?

or are you saying that this is not a problem since we control the swc transformation and version, so it's deterministic and won't break because of other transforms?

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.

ah yeah I re-read your PR description. makes sense 👍
maybe good to include that as a comment in the code/spec.md file itself so the context isn't lost

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ya from what I understand the using transformation is done by SWC itself before any plugins are invoked, so that's what we have to check for. The directive check happens before any other transformations so I think we don't need to worry about other transformations, and since we control the version of SWC in the Builders, this seems "fine" to me.

@pranaygppranaygp 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.

lgtm

@TooTallNate
TooTallNate merged commit 244b94a into mainJan 27, 2026
102 checks passed
@TooTallNate
TooTallNate deleted the 01-27-add_support_for_top-level_using_declarations_inside_of_step___workflow_functions branch January 27, 2026 18:21
pranaygp added a commit that referenced this pull request Jan 28, 2026
…s-and-commands
* origin/main:
fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734)
Publish "workflow" and "@workflow/core" package versions in sync (#870)
Add SDK version to workflow run executionContext for observability (#868)
Allow recreateRun to accept an optional deploymentId parameter (#869)
Add support for top-level `using` declarations inside of step / workflow functions (#866)
docs: URL in docs was missing the docs/ prefix, 404 errors (#852)
Add "classes" object to `manifest.json` file (#864)
Fix Nest workbench app build (#865)
Ignore Astro on local dev tests for source map e2e tests (#863)
Enable custom class serialization transformations for "client" mode (#860)
Submit request bodies with CBOR encoding (#844)
[world-vercel] Update queue to use VQS v3 API (#799)
NestJS framework support (#840)
Fix resolve hook theming and token fetching. (#856)
docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
docs: revamp World documentation pages (#763)
Remove unused `getWritable` stub function (#855)
# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml
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.

"Not supported in workflow functions" with using (disposable resources)

4 participants

@TooTallNate@pranaygp@ijjk