Skip to content

fix: use globalThis for step registry to survive module duplication#1373

Open
jcourson-bg wants to merge 2 commits intovercel:mainfrom
jcourson-bg:fix/step-registry-global-singleton
Open

fix: use globalThis for step registry to survive module duplication#1373
jcourson-bg wants to merge 2 commits intovercel:mainfrom
jcourson-bg:fix/step-registry-global-singleton

Conversation

@jcourson-bg
Copy link

Summary

  • Store registeredSteps on globalThis via Symbol.for() so all module instances share a single registry, matching the existing pattern in world.ts

Problem

In Turbopack dev mode, private.js can be instantiated as separate module instances across different chunk contexts. registerStepFunction (called from the generated step route) and getStepFunction (called from the step handler) end up operating on different Map instances, causing "Step not found" errors.

Test plan

  • pnpm build passes
  • pnpm test in packages/core
  • Manual: start Next.js dev server with Turbopack + postgres world, trigger a workflow with steps, confirm no "Step not found" errors

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: 91bb717

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

This PR includes changesets to release 16 packages
Name Type
@workflow/core Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/web-shared Patch
workflow Patch
@workflow/world-testing Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite 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 Mar 13, 2026

@jcourson-bg is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@jcourson-bg jcourson-bg marked this pull request as ready for review March 13, 2026 19:06
@jcourson-bg jcourson-bg requested a review from a team as a code owner March 13, 2026 19:06
@jcourson-bg
Copy link
Author

Fixes #1374

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.

1 participant