Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
refactor(next): remove step file copy mechanism from deferred builder by TooTallNate · Pull Request #1796 · vercel/workflow · GitHub
Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' refactor(next): remove step file copy mechanism from deferred builder by TooTallNate · Pull Request #1796 · vercel/workflow · GitHub
Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' refactor(next): remove step file copy mechanism from deferred builder by TooTallNate · Pull Request #1796 · vercel/workflow · GitHub
Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' refactor(next): remove step file copy mechanism from deferred builder by TooTallNate · Pull Request #1796 · vercel/workflow · GitHub
Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' refactor(next): remove step file copy mechanism from deferred builder by TooTallNate · Pull Request #1796 · vercel/workflow · GitHub
Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' refactor(next): remove step file copy mechanism from deferred builder by TooTallNate · Pull Request #1796 · vercel/workflow · GitHub
Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); refactor(next): remove step file copy mechanism from deferred builder by TooTallNate · Pull Request #1796 · vercel/workflow · GitHub
Skip to content

refactor(next): remove step file copy mechanism from deferred builder - #1796

Merged
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy
Apr 29, 2026
Merged

refactor(next): remove step file copy mechanism from deferred builder#1796
TooTallNate merged 6 commits into
mainfrom
tootallnate/remove-step-file-copy

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

Follow-up to #1686 (removing client transform mode). Step sources in the Next.js deferred builder are now imported directly into the generated step/route.js instead of being copied into __workflow_step_files__/ per-file with hashed names, metadata comments, and rewritten imports. This mirrors how serde files are already handled in the same builder.

Why this is now possible

The step file copy mechanism was introduced in dc2dc6a with two stated reasons:

  1. Force the loader to run on node_modules step sources — a file imported directly as a package specifier might be externalized or bypassed by the bundler.
  2. Control the SWC relativeFilename for deterministic step IDs — the copy carried metadata so the loader fed SWC the original relative filename.

Both concerns are now moot:

  • Serde files (which include package sources) already use direct imports and the workflow loader transforms them in step mode; the same works for step files.
  • The loader's getRelativeFilenameForSwc (including resolveWorkflowAliasRelativePath) already produces stable IDs from the original path.

Changes

  • packages/next/src/builder-deferred.ts:
    • Remove copyDiscoveredStepFiles, createResponseBuiltinsStepFile, rewriteRelativeImportsForCopiedStep, rewriteCopiedStepImportSpecifier, resolveBareCopiedStepSpecifier, getStepCopyFileName.
    • Rewrite buildStepsFunction so the step route imports originals via getImportPath (package specifier for workspace/node_modules, relative path for app files).
    • Resolve the workflow SDK's built-in response steps file via require.resolve('workflow/internal/builtins') at build time and emit one import.
    • Keep the legacy __workflow_step_files__/ directory rm on boot so upgrades leave no stale artifacts.
  • packages/next/src/loader.ts:
    • Remove all isDeferredStepCopyFilePath branches: metadata parsing, inline-sourcemap chaining, skip-transform bypass, discoveryFilePath indirection, isGeneratedWorkflowFile carve-out.
    • Loader now always uses filename for the SWC relative filename and module specifier.
  • packages/next/src/step-copy-utils.ts: deleted.
  • packages/next/package.json: drop enhanced-resolve dependency.
  • packages/core/e2e/dev.test.ts: rename supportsDeferredStepCopiesusesDeferredBuilder; assert step registration via manifest.json entries and import specifiers in the generated route, not copied file contents.

Diff stats

 packages/core/e2e/dev.test.ts | 144 ++++-------
packages/next/package.json | 1 -
packages/next/src/builder-deferred.ts | 451 ++++-------------------
packages/next/src/loader.ts | 105 +++----
packages/next/src/step-copy-utils.ts | 137 --------
pnpm-lock.yaml | 3 -
6 files changed, 160 insertions(+), 686 deletions(-)

Verification

Local verification against workbench/nextjs-turbopack:

  • pnpm build (all packages): pass
  • pnpm typecheck: pass
  • pnpm -C workbench/nextjs-turbopack build: pass; generated step/route.js contains direct imports (incl. workflow/internal/builtins, @workflow/ai/agent, workspace and app files); __workflow_step_files__/ directory not created; manifest has 27 steps / 16 workflows / 3 classes.
  • E2E (packages/core/e2e/e2e.test.ts against http://localhost:3000): 71/71 pass.
  • Dev tests (packages/core/e2e/dev.test.ts): 6/6 pass against a fresh dev server.

Step sources are now imported directly into the generated `step/route.js`
using the same `getImportPath`-based logic already used for serde files.
This is possible because the SWC plugin's client mode was merged into
step mode (#1686), so the workflow loader always runs in step mode and
transforms every file it sees, including those from packages.
Removed:
- `__workflow_step_files__/` per-file copies with hashed names, metadata
comments, inline source maps, and bare-specifier rewriting via
`enhanced-resolve`
- `createResponseBuiltinsStepFile`; builtins are now imported via
`require.resolve('workflow/internal/builtins')` at build time
- `step-copy-utils.ts` and all copy-specific branches in `loader.ts`
- `enhanced-resolve` dependency
The deferred builder still removes the legacy `__workflow_step_files__/`
directory on boot so upgrades leave no stale artifacts behind.
Dev tests that inspected copied step file contents now inspect the
manifest.json entries (which list every discovered step keyed by source
path).
@TooTallNate
TooTallNate requested review from a team and ijjk as code ownersApril 17, 2026 07:30
CopilotAI review requested due to automatic review settings April 17, 2026 07:30
@changeset-bot

changeset-botBot commented Apr 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c023fef

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

This PR includes changesets to release 17 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

vercelBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.039s1.005s0.966s101.00x
💻 LocalExpress0.042s (-4.3%)1.006s (~)0.963s101.08x
💻 LocalNitro0.046s (+6.7% 🔺)1.005s (~)0.959s101.17x
🐘 PostgresNitro0.058s (-38.8% 🟢)1.010s (-3.2%)0.951s101.48x
🐘 PostgresNext.js (Turbopack)0.061s1.011s0.950s101.55x
🐘 PostgresExpress0.063s (+7.8% 🔺)1.009s (~)0.947s101.59x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.097s2.006s0.908s101.00x
💻 LocalExpress1.127s (~)2.006s (~)0.879s101.03x
💻 LocalNitro1.132s (~)2.006s (~)0.874s101.03x
🐘 PostgresNitro1.146s (+0.6%)2.010s (~)0.863s101.04x
🐘 PostgresExpress1.148s (~)2.010s (~)0.862s101.05x
🐘 PostgresNext.js (Turbopack)1.155s2.011s0.856s101.05x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.632s11.022s0.390s31.00x
🐘 PostgresNitro10.871s (~)11.020s (~)0.149s31.02x
🐘 PostgresNext.js (Turbopack)10.902s11.024s0.122s31.03x
🐘 PostgresExpress10.913s (~)11.020s (~)0.107s31.03x
💻 LocalExpress10.925s (~)11.024s (~)0.099s31.03x
💻 LocalNitro10.944s (~)11.023s (~)0.078s31.03x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)14.144s15.029s0.885s41.00x
🐘 PostgresNitro14.454s (-1.0%)15.026s (~)0.572s41.02x
🐘 PostgresNext.js (Turbopack)14.536s15.024s0.488s41.03x
🐘 PostgresExpress14.591s (~)15.023s (~)0.431s41.03x
💻 LocalNitro14.995s (~)15.280s (-4.7%)0.285s41.06x
💻 LocalExpress15.002s (~)15.280s (+1.7%)0.278s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro13.878s (-0.6%)14.020s (-2.0%)0.142s71.00x
🐘 PostgresNext.js (Turbopack)13.962s14.452s0.491s71.01x
🐘 PostgresExpress14.108s (+0.7%)15.025s (+3.0%)0.917s61.02x
💻 LocalNext.js (Turbopack)15.039s15.361s0.322s61.08x
💻 LocalNitro16.410s (-2.2%)17.030s (~)0.621s61.18x
💻 LocalExpress16.717s (+0.7%)17.030s (~)0.313s61.20x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.230s2.009s0.779s151.00x
🐘 PostgresExpress1.258s (~)2.010s (~)0.752s151.02x
🐘 PostgresNitro1.272s (~)2.011s (~)0.738s151.03x
💻 LocalNext.js (Turbopack)1.457s2.005s0.548s151.18x
💻 LocalNitro1.509s (-7.5% 🟢)2.005s (-3.3%)0.496s151.23x
💻 LocalExpress1.556s (+4.5%)2.006s (~)0.450s151.27x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.344s (~)3.009s (~)0.665s101.00x
🐘 PostgresExpress2.358s (~)3.010s (~)0.652s101.01x
🐘 PostgresNext.js (Turbopack)2.412s3.010s0.598s101.03x
💻 LocalNext.js (Turbopack)2.630s3.007s0.377s101.12x
💻 LocalNitro2.760s (-12.2% 🟢)3.009s (-22.6% 🟢)0.249s101.18x
💻 LocalExpress3.044s (+3.1%)3.760s (+8.9% 🔺)0.716s81.30x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.480s (~)4.010s (~)0.530s81.00x
🐘 PostgresNitro3.491s (~)4.011s (~)0.520s81.00x
🐘 PostgresNext.js (Turbopack)3.642s4.012s0.370s81.05x
💻 LocalNext.js (Turbopack)6.751s7.213s0.462s51.94x
💻 LocalNitro7.528s (-9.8% 🟢)8.018s (-11.1% 🟢)0.490s42.16x
💻 LocalExpress8.532s (+2.3%)9.021s (~)0.489s42.45x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.233s2.009s0.776s151.00x
🐘 PostgresExpress1.261s (~)2.008s (~)0.747s151.02x
🐘 PostgresNitro1.263s (~)2.009s (~)0.746s151.02x
💻 LocalNext.js (Turbopack)1.469s2.005s0.536s151.19x
💻 LocalExpress1.554s (-18.0% 🟢)2.006s (-15.1% 🟢)0.452s151.26x
💻 LocalNitro1.584s (-15.1% 🟢)2.074s (-11.4% 🟢)0.490s151.28x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.009s (~)0.674s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.399s3.010s0.611s101.03x
💻 LocalNext.js (Turbopack)2.887s3.207s0.320s101.24x
💻 LocalNitro2.900s (-5.4% 🟢)3.342s (-14.0% 🟢)0.442s91.24x
💻 LocalExpress2.982s (-4.8%)3.676s (-2.3%)0.694s91.28x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.469s (~)4.011s (~)0.542s81.00x
🐘 PostgresExpress3.491s (~)4.011s (~)0.520s81.01x
🐘 PostgresNext.js (Turbopack)3.748s4.139s0.391s81.08x
💻 LocalNext.js (Turbopack)7.760s8.266s0.506s42.24x
💻 LocalNitro8.584s (-6.1% 🟢)9.272s (-7.5% 🟢)0.688s42.47x
💻 LocalExpress8.764s (~)9.021s (-2.7%)0.258s42.53x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.664s1.004s0.340s601.00x
🐘 PostgresNext.js (Turbopack)0.780s1.006s0.227s601.17x
🐘 PostgresNitro0.795s (-3.1%)1.006s (~)0.211s601.20x
🐘 PostgresExpress0.846s (+0.9%)1.007s (-1.6%)0.160s601.27x
💻 LocalExpress0.994s (+1.0%)1.255s (+16.6% 🔺)0.261s481.50x
💻 LocalNitro1.024s (+4.4%)1.654s (+51.2% 🔺)0.630s371.54x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.890s (-1.9%)2.029s (-3.4%)0.139s451.00x
🐘 PostgresNext.js (Turbopack)1.914s2.100s0.186s431.01x
🐘 PostgresExpress2.026s (+2.5%)2.736s (+21.2% 🔺)0.711s331.07x
💻 LocalNext.js (Turbopack)2.180s3.007s0.826s301.15x
💻 LocalNitro3.022s (~)3.648s (-2.9%)0.627s251.60x
💻 LocalExpress3.029s (~)3.608s (+0.6%)0.579s251.60x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.893s (-5.1% 🟢)4.110s (-10.7% 🟢)0.218s301.00x
🐘 PostgresNext.js (Turbopack)3.935s4.252s0.317s291.01x
🐘 PostgresExpress4.033s (+1.1%)4.566s (+4.5%)0.534s271.04x
💻 LocalNext.js (Turbopack)7.130s7.827s0.697s161.83x
💻 LocalNitro8.982s (-3.4%)9.557s (-4.6%)0.574s132.31x
💻 LocalExpress9.301s (+1.0%)10.019s (~)0.718s122.39x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.253s1.007s0.754s601.00x
🐘 PostgresNitro0.279s (-1.5%)1.007s (~)0.728s601.10x
🐘 PostgresExpress0.287s (+1.8%)1.007s (~)0.720s601.14x
💻 LocalNext.js (Turbopack)0.536s1.004s0.468s602.12x
💻 LocalNitro0.566s (-6.4% 🟢)1.004s (-1.7%)0.438s602.24x
💻 LocalExpress0.589s (+5.0% 🔺)1.005s (~)0.416s602.33x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.496s (-2.6%)1.007s (~)0.510s901.00x
🐘 PostgresNitro0.505s (+1.7%)1.006s (~)0.502s901.02x
🐘 PostgresNext.js (Turbopack)0.509s1.007s0.498s901.03x
💻 LocalNitro2.377s (-6.3% 🟢)3.008s (~)0.631s304.79x
💻 LocalNext.js (Turbopack)2.457s3.008s0.550s304.95x
💻 LocalExpress2.718s (+8.1% 🔺)3.181s (+5.7% 🔺)0.464s295.47x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.786s (-4.0%)1.008s (-1.0%)0.222s1201.00x
🐘 PostgresNitro0.791s (~)1.007s (~)0.217s1201.01x
🐘 PostgresNext.js (Turbopack)0.807s1.016s0.209s1191.03x
💻 LocalNext.js (Turbopack)9.577s10.023s0.446s1212.18x
💻 LocalNitro10.236s (-8.5% 🟢)10.939s (-6.2% 🟢)0.703s1113.02x
💻 LocalExpress11.220s (~)11.939s (~)0.718s1114.28x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.142s1.003s0.009s1.015s0.873s101.00x
🐘 PostgresNitro0.201s (-2.0%)0.997s (~)0.001s (-13.3% 🟢)1.010s (~)0.809s101.41x
💻 LocalExpress0.204s (+2.5%)1.004s (~)0.013s (+7.4% 🔺)1.019s (~)0.815s101.43x
🐘 PostgresExpress0.205s (~)1.000s (~)0.001s (-25.0% 🟢)1.010s (~)0.805s101.44x
🐘 PostgresNext.js (Turbopack)0.205s1.001s0.002s1.010s0.805s101.44x
💻 LocalNitro0.208s (-2.5%)1.004s (~)0.011s (-16.0% 🟢)1.016s (~)0.808s101.47x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.572s1.010s0.009s1.022s0.449s591.00x
🐘 PostgresNitro0.612s (-1.9%)1.022s (+1.5%)0.004s (-6.6% 🟢)1.039s (+1.6%)0.427s581.07x
🐘 PostgresNext.js (Turbopack)0.637s1.009s0.004s1.023s0.386s591.11x
🐘 PostgresExpress0.644s (+2.1%)1.005s (~)0.013s (+230.1% 🔺)1.033s (+0.9%)0.389s591.12x
💻 LocalNitro0.759s (-9.5% 🟢)1.013s (~)0.009s (-2.5%)1.024s (-8.3% 🟢)0.264s591.33x
💻 LocalExpress0.953s (+25.8% 🔺)1.011s (-1.7%)0.010s (+3.8%)1.227s (+18.0% 🔺)0.275s491.66x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.925s1.133s0.000s1.149s0.224s531.00x
🐘 PostgresExpress0.940s (-2.2%)1.170s (-8.4% 🟢)0.000s (+260.8% 🔺)1.189s (-9.0% 🟢)0.249s511.02x
🐘 PostgresNitro0.957s (-1.2%)1.124s (-9.9% 🟢)0.000s (+126.4% 🔺)1.146s (-8.9% 🟢)0.188s531.03x
💻 LocalNext.js (Turbopack)1.216s2.018s0.000s2.021s0.805s301.31x
💻 LocalExpress1.234s (+0.8%)2.020s (~)0.001s (+50.0% 🔺)2.022s (~)0.788s301.33x
💻 LocalNitro1.392s (+13.8% 🔺)2.020s (~)0.000s (+185.7% 🔺)2.201s (+8.9% 🔺)0.809s281.50x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.760s (-0.7%)2.222s (+2.1%)0.000s (+Infinity% 🔺)2.231s (+1.5%)0.471s271.00x
🐘 PostgresNitro1.786s (~)2.139s (~)0.000s (~)2.164s (~)0.379s281.01x
🐘 PostgresNext.js (Turbopack)1.856s2.145s0.000s2.151s0.295s281.05x
💻 LocalNitro3.264s (-3.6%)3.971s (-1.5%)0.001s (-6.2% 🟢)3.974s (-1.5%)0.710s161.85x
💻 LocalExpress3.518s (+1.5%)4.099s (+1.6%)0.001s (-16.7% 🟢)4.101s (+1.6%)0.583s152.00x
💻 LocalNext.js (Turbopack)3.664s4.165s0.001s4.169s0.504s152.08x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)19/21
🐘 PostgresNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres18/21
Next.js (Turbopack)🐘 Postgres14/21
Nitro🐘 Postgres19/21
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
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9890671056
✅ 💻 Local Development10660861152
✅ 📦 Local Production10660861152
✅ 🐘 Local Postgres10660861152
✅ 🪟 Windows960096
✅ 📋 Other270018288
Total455303434896

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8907
✅ example8907
✅ express8907
✅ fastify8907
✅ hono8907
✅ nextjs-turbopack9402
✅ nextjs-webpack9402
✅ nitro8907
✅ nuxt8907
✅ sveltekit8907
✅ vite8907
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9006
✅ express-stable9006
✅ fastify-stable9006
✅ hono-stable9006
✅ nextjs-turbopack-canary77019
✅ nextjs-turbopack-stable9600
✅ nextjs-webpack-canary77019
✅ nextjs-webpack-stable9600
✅ nitro-stable9006
✅ nuxt-stable9006
✅ sveltekit-stable9006
✅ vite-stable9006
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9600
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9006
✅ e2e-local-postgres-nest-stable9006
✅ e2e-local-prod-nest-stable9006

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Next.js deferred builder to stop copying step source files into a generated directory, instead importing step/serde sources directly from their original locations (mirroring existing serde handling) and simplifying the loader accordingly.

Changes:

  • Remove deferred step copy utilities and copy/rewrite logic; generate step/route.js with direct imports (including workflow response builtins).
  • Simplify the Next loader by removing step-copy-file special casing and always using the actual filename/module specifier inputs.
  • Update dev E2E assertions to validate manifest/route imports (rather than copied file contents) and drop the unused dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
packages/next/src/builder-deferred.tsRemoves step-copy pipeline and switches step route generation to direct imports + legacy cleanup.
packages/next/src/loader.tsDeletes deferred step-copy branches and unifies transform/discovery behavior.
packages/next/src/step-copy-utils.tsDeleted (no longer needed).
packages/next/package.jsonDrops enhanced-resolve dependency.
pnpm-lock.yamlRemoves enhanced-resolve from @workflow/next importer.
packages/core/e2e/dev.test.tsUpdates dev E2E checks to assert via manifest + route import specifiers.
.changeset/remove-step-file-copy.mdAdds release note for the behavioral change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines +1768 to +1775
} | null {
let resolved: string;
try {
resolved = require.resolve('workflow/internal/builtins', {
paths: [this.config.workingDir],
});
} catch {
return null;

CopilotAIApr 17, 2026

Copy link

Choose a reason for hiding this comment

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

resolveResponseBuiltinsStepSource() silently returns null when workflow/internal/builtins cannot be resolved. If the app has an incompatible workflow version (or resolution differs under pnpm), this will build a step route without registering the builtin response steps, likely causing runtime failures when Request/Response builtins are invoked. Consider failing fast with a clear error (e.g., instruct to upgrade workflow) or at least logging a warning and keeping the previous in-repo fallback behavior so builtins are always present.

Suggested change
}|null{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch{
returnnull;
}{
letresolved: string;
try{
resolved=require.resolve('workflow/internal/builtins',{
paths: [this.config.workingDir],
});
}catch(error){
constmessage=
errorinstanceofError ? ` ${error.message}` : '';
thrownewError(
`Unable to resolve "workflow/internal/builtins" from working directory `+
`"${this.config.workingDir}". Builtin Request/Response workflow steps `+
`require a compatible "workflow" package to be installed and resolvable `+
`from the application. Please ensure the app depends on a compatible `+
`"workflow" version and upgrade it if necessary.${message}`
);

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

4 participants

@TooTallNate@ijjk@VaguelySerious