⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Jan 14, 2026

TL;DR

Added support for "use step" directive in class instance methods, allowing instance methods to be used as workflow steps.

What changed?

  • Modified the SWC plugin to recognize and transform instance methods with the "use step" directive
  • Added registration logic for instance method steps using ClassName.prototype.methodName
  • Implemented proper serialization of class instances to preserve the this context across workflow/step boundaries
  • Added comprehensive end-to-end tests for instance method steps
  • Updated error handling to allow "use step" in instance methods while still preventing "use workflow" in instance methods

How to test?

The PR includes a new end-to-end test instanceMethodStepWorkflow that demonstrates the functionality:

  1. Run the e2e tests to verify the new instance method step functionality
  2. The test creates a Counter class with instance methods marked as steps
  3. It verifies that the instance methods can be called as steps with proper serialization of the this context
  4. It also verifies that multiple instances of the same class can be used independently

Why make this change?

This change enables a more natural object-oriented programming model when working with workflows. Previously, only static methods, standalone functions, and object methods could be marked as steps. Now, developers can create classes with instance methods that are steps, allowing for better encapsulation and more intuitive code organization. This is particularly useful for complex workflows that need to maintain state across multiple step invocations.

@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: cae9a83

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

This PR includes changesets to release 13 packages
Name Type
@workflow/swc-plugin Patch
@workflow/astro Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
workflow Patch
@workflow/world-testing Patch
@workflow/docs-typecheck Patch
@workflow/nuxt Patch
@workflow/ai Patch

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

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

@vercel
Copy link
Contributor

vercel bot commented Jan 14, 2026

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

Project Deployment Review Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jan 14, 2026 10:28pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jan 14, 2026 10:28pm
example-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-astro-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-express-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-fastify-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-hono-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-nitro-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workbench-vite-workflow Ready Ready Preview, Comment Jan 14, 2026 10:28pm
workflow-docs Ready Ready Preview, Comment Jan 14, 2026 10:28pm

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 440 0 11 451
✅ 💻 Local Development 402 0 8 410
✅ 📦 Local Production 402 0 8 410
✅ 🐘 Local Postgres 402 0 8 410
❌ 🪟 Windows 40 1 0 41
❌ 🌍 Community Worlds 153 23 0 176
Total 1839 24 35 1898

❌ Failed Tests

🪟 Windows (1 failed)

nextjs-turbopack (1 failed):

  • webhookWorkflow
🌍 Community Worlds (23 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (20 failed):

  • addTenWorkflow
  • addTenWorkflow
  • 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 catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 40 0 1
✅ example 40 0 1
✅ express 40 0 1
✅ fastify 40 0 1
✅ hono 40 0 1
✅ nextjs-turbopack 40 0 1
✅ nextjs-webpack 40 0 1
✅ nitro 40 0 1
✅ nuxt 40 0 1
✅ sveltekit 40 0 1
✅ vite 40 0 1
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 40 0 1
✅ express-stable 40 0 1
✅ fastify-stable 40 0 1
✅ hono-stable 40 0 1
✅ nextjs-turbopack-stable 41 0 0
✅ nextjs-webpack-stable 41 0 0
✅ nitro-stable 40 0 1
✅ nuxt-stable 40 0 1
✅ sveltekit-stable 40 0 1
✅ vite-stable 40 0 1
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 40 0 1
✅ express-stable 40 0 1
✅ fastify-stable 40 0 1
✅ hono-stable 40 0 1
✅ nextjs-turbopack-stable 41 0 0
✅ nextjs-webpack-stable 41 0 0
✅ nitro-stable 40 0 1
✅ nuxt-stable 40 0 1
✅ sveltekit-stable 40 0 1
✅ vite-stable 40 0 1
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 40 0 1
✅ express-stable 40 0 1
✅ fastify-stable 40 0 1
✅ hono-stable 40 0 1
✅ nextjs-turbopack-stable 41 0 0
✅ nextjs-webpack-stable 41 0 0
✅ nitro-stable 40 0 1
✅ nuxt-stable 40 0 1
✅ sveltekit-stable 40 0 1
✅ vite-stable 40 0 1
❌ 🪟 Windows
App Passed Failed Skipped
❌ nextjs-turbopack 40 1 0
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 0
❌ mongodb 40 1 0
✅ redis-dev 3 0 0
❌ redis 40 1 0
✅ starter-dev 3 0 0
❌ starter 21 20 0
✅ turso-dev 3 0 0
❌ turso 40 1 0

📋 View full workflow run


Some E2E test jobs failed:

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

Check the workflow run for details.

Copy link
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

MDX syntax error: unexpected ! character on line 29. This appears to be invalid MDX code that should use {/* text */} for comments instead.

Fix on Vercel

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestion:

Invalid MDX syntax: Vitepress-specific [!code highlight] comments cause MDX parsing errors and are not compatible with MDX rendering.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants