Skip to content

Workflow graph manifest misses step nodes when transformed step proxies include @__PURE__ comment #1746

Description

@SXLDEV

Summary

Workflow steps are correctly discovered in manifest.json under steps, but the generated workflow graph is empty (start -> end) even when the workflow clearly awaits step functions.

This appears to be caused by the graph extractor in @workflow/builders being too strict when parsing transformed step declarations.

Expected behavior

Given a workflow that:

  • declares "use workflow"
  • awaits multiple imported step functions in sequence

The generated workflow graph should include nodes for each awaited step.

Actual behavior

  • manifest.json correctly lists all steps under steps
  • but the workflow graph only contains:
    • Start
    • Return

No intermediate step nodes are included.

Reproduction (minimal example)

  1. Create a workflow file:
export async function testWorkflow(input) {
  'use workflow';

  const a = await stepOne(input);
  const b = await stepTwo(a);
  const c = await stepThree(b);

  return c;
}
  1. Define each step in separate files, each starting with:
'use step';
  1. Run the build and inspect the generated manifest.

Evidence

  • steps in the manifest includes all expected step entries
  • but workflows.<workflow>.graph.nodes only includes start and end

Likely cause

In the transformed bundle, step declarations look like:

var stepOne = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("...");

However, the extractor in @workflow/builders/dist/workflows-extractor.js appears to rely on a regex similar to:

/var (\w+) = globalThis\[Symbol\.for\("WORKFLOW_USE_STEP"\)\]\("([^"]+)"\)/

This does not match when the bundler injects /* @__PURE__ */ inside the computed property access.

As a result:

  • step registration succeeds
  • graph extraction fails

Proposed solution

Update the extractor regex to tolerate optional annotations inside the computed access.

For example:

/var (\w+) = globalThis\[(?:\/\*\s*@__PURE__\s*\*\/\s*)?Symbol\.for\("WORKFLOW_USE_STEP"\)\]\("([^"]+)"\)/

This allows the extractor to correctly match both annotated and non-annotated builds.

Environment

  • Workflow SDK: @latest
  • Next.js: 16.16.2.3 (Turbopack)
  • Turbopack (dev)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions