Skip to content

Add support for "use step" functions in class instance methods#777

Merged
TooTallNate merged 5 commits intomainfrom
01-13-add_support_for_use_step_functions_in_class_instance_methods
Feb 3, 2026
Merged

Add support for "use step" functions in class instance methods#777
TooTallNate merged 5 commits intomainfrom
01-13-add_support_for_use_step_functions_in_class_instance_methods

Conversation

@TooTallNate
Copy link
Copy Markdown
Member

@TooTallNate TooTallNate commented Jan 14, 2026

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
Copy Markdown

changeset-bot Bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 16dd859

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

This PR includes changesets to release 16 packages
Name Type
@workflow/swc-plugin Patch
@workflow/astro Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/nest Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
workflow Patch
@workflow/vite Patch
@workflow/world-testing Patch
@workflow/docs-typecheck Patch
@workflow/nuxt Patch
@workflow/core Patch
@workflow/web-shared 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
Copy Markdown
Contributor

vercel Bot commented Jan 14, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 14, 2026

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (169 failed)

mongodb (42 failed):

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

redis (42 failed):

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

starter (43 failed):

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

turso (42 failed):

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

Details by Category

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

📋 View full workflow run

Comment thread packages/swc-plugin-workflow/transform/src/lib.rs
Copy link
Copy Markdown
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
Copy Markdown
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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 19, 2026

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 0.044s (-1.8%) 1.008s (~) 0.963s 10 1.00x
🐘 Postgres Express 0.295s (+0.8%) 1.015s (~) 0.720s 10 6.65x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 0.675s (+3.5%) 1.771s (+19.5% 🔺) 1.096s 10 1.00x

🔍 Observability: Express

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 1.120s (~) 2.008s (~) 0.888s 10 1.00x
🐘 Postgres Express 2.131s (~) 3.016s (~) 0.885s 10 1.90x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.776s (+0.6%) 3.943s (+5.2% 🔺) 1.167s 10 1.00x

🔍 Observability: Express

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 10.964s (+1.0%) 11.021s (~) 0.057s 5 1.00x
🐘 Postgres Express 20.458s (~) 21.032s (~) 0.574s 5 1.87x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 23.160s (+1.1%) 24.045s (+1.2%) 0.885s 5 1.00x

🔍 Observability: Express

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 5.537s (+5.0% 🔺) 6.500s (+3.4%) 0.963s 5 1.00x
🐘 Postgres Express 30.927s (+11.6% 🔺) 31.254s (+10.9% 🔺) 0.327s 2 5.59x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.954s (+26.1% 🔺) 4.842s (+33.1% 🔺) 0.888s 7 1.00x

🔍 Observability: Express

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 5.493s (-0.8%) 6.404s (-1.7%) 0.910s 5 1.00x
🐘 Postgres Express 33.888s (-0.6%) 34.154s (-0.6%) 0.266s 1 6.17x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.700s (+13.1% 🔺) 4.594s (+16.9% 🔺) 0.894s 7 1.00x

🔍 Observability: Express

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 6.124s (+8.4% 🔺) 6.601s (~) 0.477s 5 1.00x
🐘 Postgres Express 28.227s (-8.6% 🟢) 28.610s (-8.3% 🟢) 0.383s 2 4.61x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.017s (-11.3% 🟢) 3.786s (-3.6%) 0.770s 8 1.00x

🔍 Observability: Express

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 6.305s (+9.8% 🔺) 7.250s (+8.8% 🔺) 0.945s 5 1.00x
🐘 Postgres Express 35.332s (+8.3% 🔺) 36.085s (+9.1% 🔺) 0.753s 1 5.60x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.375s (+9.7% 🔺) 4.106s (+7.6% 🔺) 0.731s 8 1.00x

🔍 Observability: Express

Stream Benchmarks (includes TTFB metrics)
workflow with stream

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 0.208s (+10.8% 🔺) 0.992s (~) 0.018s (+19.9% 🔺) 1.027s (~) 0.819s 10 1.00x
🐘 Postgres Express 2.243s (-3.0%) 2.800s (+2.6%) 0.000s (+Infinity% 🔺) 3.015s (~) 0.773s 10 10.80x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.029s (+1.8%) 3.294s (+2.7%) 0.794s (-33.9% 🟢) 4.724s (-4.4%) 1.695s 10 1.00x

🔍 Observability: Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Express 8/8
🐘 Postgres Express 8/8
▲ Vercel Express 8/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 💻 Local 4/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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds SWC transform + runtime support so class instance methods can be marked with "use step" and invoked as workflow steps while preserving this via serialization.

Changes:

  • Update SWC transform to detect "use step" in instance methods, generate ClassName.prototype.methodName step registrations, and proxy instance methods in workflow bundles.
  • Register serialization classes so this values can be dehydrated/hydrated across workflow ↔ step boundaries.
  • Add end-to-end coverage plus transform fixtures for instance-method steps (including nested steps), and adjust error fixtures.

Reviewed changes

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

Show a summary per file
File Description
workbench/example/workflows/99_e2e.ts Adds Counter + instanceMethodStepWorkflow e2e workflow demonstrating instance-method steps with custom serialization.
packages/core/e2e/e2e.test.ts Adds e2e test validating instance-method step execution + step list expectations.
packages/swc-plugin-workflow/transform/src/lib.rs Core transform changes: allow "use step" on instance methods, register prototype step functions, and proxy them in workflow mode.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-step/input.js New fixture input for instance-method step transformation.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-step/output-client.js Expected client output for instance-method step fixture.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-step/output-step.js Expected step-bundle output for instance-method step fixture.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-step/output-workflow.js Expected workflow-bundle output for instance-method step fixture.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-nested-step/input.js New fixture input for nested steps inside an instance-method step.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-nested-step/output-client.js Expected client output for nested instance-method step fixture.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-nested-step/output-step.js Expected step-bundle output for nested instance-method step fixture.
packages/swc-plugin-workflow/transform/tests/fixture/instance-method-nested-step/output-workflow.js Expected workflow-bundle output for nested instance-method step fixture.
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/input.js Updates error fixture to allow "use step" on instance methods but still forbid "use workflow".
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.js Expected client output for updated instance-method error fixture.
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.stderr Updated expected stderr for client mode.
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-step.js Expected step output for updated instance-method error fixture.
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-step.stderr Updated expected stderr for step mode.
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-workflow.js Expected workflow output for updated instance-method error fixture.
packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-workflow.stderr Updated expected stderr for workflow mode.
packages/swc-plugin-workflow/transform/tests/errors/forbidden-expressions/output-step.js Updates expected output to treat instance method step as supported.
packages/swc-plugin-workflow/transform/tests/errors/forbidden-expressions/output-step.stderr Adjusted expected stderr (now empty).
packages/swc-plugin-workflow/transform/tests/errors/forbidden-expressions/output-workflow.js Updates expected output to proxy/register the instance method step.
packages/swc-plugin-workflow/transform/tests/errors/forbidden-expressions/output-workflow.stderr Adjusted expected stderr (now empty).
.changeset/legal-parts-happen.md Publishes a patch changeset for @workflow/swc-plugin.

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

Comment thread packages/swc-plugin-workflow/transform/src/lib.rs Outdated
Comment thread packages/swc-plugin-workflow/transform/src/lib.rs Outdated
Comment thread packages/swc-plugin-workflow/transform/src/lib.rs
Comment thread workbench/example/workflows/99_e2e.ts
Comment on lines 6522 to 6531
class_decl.class.body.retain(|member| {
if let ClassMember::Method(method) = member {
if method.is_static {
if let PropName::Ident(ident) = &method.key {
let method_name = ident.sym.to_string();
return !methods_to_strip.contains(&method_name);
if let PropName::Ident(ident) = &method.key {
let method_name = ident.sym.to_string();
if method.is_static {
return !static_methods_to_strip.contains(&method_name);
} else {
return !instance_methods_to_strip.contains(&method_name);
}
}
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

The workflow-mode stripping logic only checks PropName::Ident for class methods. Instance (and static) methods with string keys (e.g. async 'foo-bar'() { 'use step' }) are supported earlier, but won’t be removed here, so the original method body can remain in the workflow bundle instead of being replaced by the step proxy. Extend this retain() filter to also handle PropName::Str (and keep the stripping key representation consistent with how method_name is collected).

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +22
const helper = helper;
const doubled = await helper(input);
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

Callee is not a function: it has type undefined.

Suggested change
const helper = helper;
const doubled = await helper(input);
const localHelper = helper;
const doubled = await localHelper(input);

Copilot uses AI. Check for mistakes.
@@ -1,10 +0,0 @@
x Instance methods cannot be marked with "use step". Only static methods, functions, and object methods are supported.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should these .stderr files be deleted then?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants