From d35fea0898978943ca661d7167957054ff0028d6 Mon Sep 17 00:00:00 2001 From: Peter Wielander Date: Fri, 3 Apr 2026 13:59:43 -0700 Subject: [PATCH 1/2] [core] Make registeredSteps a global singleton to protect against module duplication Signed-off-by: Peter Wielander --- .changeset/six-peas-make.md | 5 +++++ packages/core/src/private.ts | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .changeset/six-peas-make.md diff --git a/.changeset/six-peas-make.md b/.changeset/six-peas-make.md new file mode 100644 index 0000000000..23f2fe2756 --- /dev/null +++ b/.changeset/six-peas-make.md @@ -0,0 +1,5 @@ +--- +"@workflow/core": patch +--- + +Make registeredSteps a global singleton to protect against module duplication and caching issues diff --git a/packages/core/src/private.ts b/packages/core/src/private.ts index 97b028b018..a4f459135c 100644 --- a/packages/core/src/private.ts +++ b/packages/core/src/private.ts @@ -15,8 +15,19 @@ export type StepFunction< stepId?: string; }; -const registeredSteps = new Map(); -const BUILTIN_RESPONSE_STEP_NAMES = new Set([ +const RegisteredStepsKey = Symbol.for('@workflow/core//registeredSteps'); + +const globalSymbols: typeof globalThis & { + [RegisteredStepsKey]?: Map; +} = globalThis; + +// biome-ignore lint/suspicious/noAssignInExpressions: / +const registeredSteps = (globalSymbols[RegisteredStepsKey] ??= new Map< + string, + StepFunction +>()); + +const BUILTIN_STEP_NAMES = new Set([ '__builtin_response_array_buffer', '__builtin_response_json', '__builtin_response_text', From 48ca289d8dc91d06770ac0d53b662d4255ffa1d8 Mon Sep 17 00:00:00 2001 From: Vercel Date: Fri, 3 Apr 2026 21:08:50 +0000 Subject: [PATCH 2/2] Fix: Incomplete rename of `BUILTIN_RESPONSE_STEP_NAMES` to `BUILTIN_STEP_NAMES` leaves a stale reference on line 73, causing TypeScript compilation errors TS6133 and TS2552 that break all builds. This commit fixes the issue reported at packages/core/src/private.ts:73 **Bug:** The constant `BUILTIN_RESPONSE_STEP_NAMES` was renamed to `BUILTIN_STEP_NAMES` on line 30 of `packages/core/src/private.ts`, but the reference to it in `getBuiltinResponseStepAlias` on line 73 was not updated. This causes two TypeScript errors: - TS6133: `BUILTIN_STEP_NAMES` is declared but never read (since nothing references the new name) - TS2552: Cannot find name `BUILTIN_RESPONSE_STEP_NAMES` (since the old name no longer exists) This is confirmed by the Vercel build log at lines 1136-1137, which shows these exact errors from the `@workflow/core:build` step. All 13 Vercel deployments fail because of this. **Fix:** Changed the reference on line 73 from `BUILTIN_RESPONSE_STEP_NAMES` to `BUILTIN_STEP_NAMES`, completing the rename that was started on line 30. Co-authored-by: Vercel Co-authored-by: VaguelySerious --- packages/core/src/private.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/private.ts b/packages/core/src/private.ts index a4f459135c..3ccaadd1e0 100644 --- a/packages/core/src/private.ts +++ b/packages/core/src/private.ts @@ -70,7 +70,7 @@ function getStepIdAliasCandidates(stepId: string): string[] { } function getBuiltinResponseStepAlias(stepId: string): StepFunction | undefined { - if (!BUILTIN_RESPONSE_STEP_NAMES.has(stepId)) { + if (!BUILTIN_STEP_NAMES.has(stepId)) { return undefined; }