[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

@VaguelySerious@TooTallNate@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n 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;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

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

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

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

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

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

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

@VaguelySerious@TooTallNate@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

@VaguelySerious@TooTallNate@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

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

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs - #1359

Merged
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge
Mar 13, 2026
Merged

[vitest] Write vitest workflow data together with other workflow data, fixes observability for test runs#1359
VaguelySerious merged 7 commits into
mainfrom
peter/workflow-vitest-folder-merge

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

Vitest workflow tests write run data to .workflow-vitest/data/{poolId}/, while normal local development writes to .workflow-data/. The observability tools (CLI and web UI) only discover runs in .workflow-data/ (and .next/workflow-data), so vitest-created runs are invisible to observability.

Vitest calls world.clear() before each test file to ensure clean state. The existing clear() does rm -rf on the entire data directory, which is why vitest uses a separate directory: clearing .workflow-data/ would destroy dev server runs.

Goal: Make vitest runs visible to observability without losing the ability to selectively clear test data.

Rejected Approaches

1. Multi-directory discovery

Make findWorkflowDataDir() return multiple directories and aggregate runs across .workflow-data and .workflow-vitest/data/*.

Rejected because: Requires the observability layer to merge paginated queries across multiple directories, adding significant complexity to listing, pagination, and cursor management. Every consumer of the storage API would need to handle multi-source aggregation.

2. Vitest subdirectory inside .workflow-data

Write vitest data to .workflow-data/vitest/{poolId}/ and have observability recurse into subdirectories.

Rejected because: This is essentially the multi-directory problem in disguise. The filesystem storage's flat directory structure (runs/, steps/, events/) doesn't support nested data dirs. Would require significant refactoring of paginatedFileSystemQuery and all storage modules.

3. Run ID prefixes

Give all vitest-created runs a known prefix (e.g., vitest-0-*). Replace world.clear() with a selective delete that removes runs matching the prefix.

Rejected because: Run IDs are generated deep in the runtime as ULIDs. Injecting prefixes would require changes across the entire runtime, and the prefix would leak test infrastructure concerns into production-format IDs.

4a. Timestamp-based clearing

Write to .workflow-data directly. Track a start timestamp and clear all entities created after that timestamp.

Rejected because: Could accidentally delete runs created by a concurrent dev server during the test window. Clearing on setup (before tests) is more reliable than teardown, but the "created after" approach doesn't work for pre-test cleanup since you don't know which runs are from the previous test session.

4b. Manifest-based tracking

Write standard filenames but maintain a side-car manifest file listing which files belong to each vitest pool.

Rejected because: Adds a second source of truth. If a test crashes before the manifest is updated, orphaned files accumulate. The manifest must be kept in sync with every write and delete operation.

Chosen Approach: Tagged Filenames

Concept

When createLocalWorld({ tag: 'vitest-0' }) is called, all files are written with the tag embedded in the filename:

runs/wrun_01ABC123.vitest-0.json (tagged)
runs/wrun_01DEF456.json (untagged, from dev server)
  • Writes use {id}.{tag}.json filenames
  • Reads by ID try the tagged path first (fast path), fall back to untagged
  • Listing returns all .json files naturally, since both tagged and untagged files end in .json
  • clear() only deletes files matching *.{tag}.json, preserving untagged files
  • Untagged worlds behave exactly as before with zero overhead

Why this works

  1. Entity IDs never contain dots (ULIDs are alphanumeric, step IDs are step_N, etc.), so the first dot after the entity ID always marks the tag boundary.

  2. paginatedFileSystemQuery already lists all .json files via listJSONFiles, so tagged files are automatically included in listings. The tag in the filename doesn't affect pagination since the actual entity data (parsed from JSON) contains the real IDs and timestamps.

  3. getObjectCreatedAt strips the tag before ULID extraction, so filename-based cursor optimization works correctly with tagged files.

  4. Vitest pool isolation is achieved by tag uniqueness (vitest-0, vitest-1, etc.). Each pool's clear() only deletes its own tagged files.

Key implementation details

  • taggedPath(basedir, entityDir, fileId, tag?) builds write paths
  • readJSONWithFallback(basedir, entityDir, fileId, schema, tag?) tries tagged path first, falls back to untagged
  • stripTag(fileId) removes the tag suffix using the pattern /\.[a-zA-Z][a-zA-Z0-9-]*$/
  • listTaggedFiles(dirPath, tag) finds files matching *.{tag}.json for clearing
  • Stream chunks use the same pattern: {name}-{chunkId}.{tag}.bin

Changes to vitest integration

// Before: separate directory, nuclear clearworld=createLocalWorld({dataDir: join(outDir,'data',poolId)});// After: shared directory, scoped clearworld=createLocalWorld({dataDir: join(cwd,'.workflow-data'),tag: `vitest-${poolId}`,});

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39b957c

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

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/vitestPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@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 Mar 12, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 12, 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🥇 Express0.027s (-32.6% 🟢)1.005s (~)0.979s101.00x
💻 LocalNitro0.034s (+5.3% 🔺)1.006s (~)0.972s101.26x
💻 LocalNext.js (Turbopack)0.041s1.006s0.965s101.53x
🌐 RedisNext.js (Turbopack)0.045s1.005s0.960s101.67x
🐘 PostgresNext.js (Turbopack)0.048s1.011s0.963s101.78x
🐘 PostgresExpress0.051s (-24.0% 🟢)1.012s (-1.3%)0.961s101.88x
🐘 PostgresNitro0.053s (-2.4%)1.013s (~)0.960s101.97x
🌐 MongoDBNext.js (Turbopack)0.116s1.008s0.892s104.30x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express0.457s (+7.9% 🔺)1.901s (-34.2% 🟢)1.445s101.00x
▲ VercelNext.js (Turbopack)0.516s (-66.7% 🟢)2.240s (-41.4% 🟢)1.724s101.13x
▲ VercelNitro0.533s (-55.6% 🟢)2.496s (-31.0% 🟢)1.963s101.17x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express1.074s (-2.8%)2.005s (~)0.931s101.00x
💻 LocalNext.js (Turbopack)1.100s2.006s0.906s101.02x
💻 LocalNitro1.108s (+0.7%)2.006s (~)0.898s101.03x
🌐 RedisNext.js (Turbopack)1.111s2.007s0.896s101.03x
🐘 PostgresExpress1.123s (-1.1%)2.012s (~)0.889s101.05x
🐘 PostgresNext.js (Turbopack)1.129s2.013s0.884s101.05x
🐘 PostgresNitro1.143s (+1.0%)2.015s (~)0.872s101.06x
🌐 MongoDBNext.js (Turbopack)1.299s2.008s0.709s101.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.960s (-4.7%)3.216s (-13.0% 🟢)1.256s101.00x
▲ VercelNitro2.019s (~)3.760s (+4.3%)1.741s101.03x
▲ VercelNext.js (Turbopack)2.043s (+1.1%)3.706s (-9.3% 🟢)1.664s101.04x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.537s (-2.5%)11.023s (~)0.486s31.00x
🌐 RedisNext.js (Turbopack)10.667s11.025s0.358s31.01x
💻 LocalNext.js (Turbopack)10.671s11.023s0.352s31.01x
🐘 PostgresNext.js (Turbopack)10.801s11.046s0.245s31.03x
💻 LocalNitro10.820s (+0.5%)11.024s (~)0.205s31.03x
🐘 PostgresExpress10.865s (~)11.042s (~)0.177s31.03x
🐘 PostgresNitro10.933s (+1.0%)11.055s (~)0.122s31.04x
🌐 MongoDBNext.js (Turbopack)12.273s13.020s0.746s31.16x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.919s (+3.7%)17.738s (-0.9%)0.819s21.00x
▲ VercelNext.js (Turbopack)17.232s (~)18.519s (-1.7%)1.287s21.02x
▲ VercelNitro17.386s (+1.4%)19.339s (+3.0%)1.953s21.03x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express26.569s (-2.4%)27.053s (-3.6%)0.484s31.00x
🌐 RedisNext.js (Turbopack)26.652s27.054s0.402s31.00x
💻 LocalNext.js (Turbopack)26.853s27.050s0.197s31.01x
🐘 PostgresNext.js (Turbopack)26.881s27.064s0.182s31.01x
🐘 PostgresExpress26.998s (~)27.064s (~)0.066s31.02x
🐘 PostgresNitro27.255s (+1.1%)28.077s (+3.7%)0.822s31.03x
💻 LocalNitro27.306s (+0.7%)28.054s (~)0.747s31.03x
🌐 MongoDBNext.js (Turbopack)30.410s31.039s0.629s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.123s (~)44.577s (-0.5%)1.453s21.00x
▲ VercelNext.js (Turbopack)43.549s (-1.1%)45.023s (-2.0%)1.474s21.01x
▲ VercelNitro43.690s (+1.9%)45.013s (+1.3%)1.324s21.01x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.261s54.102s0.842s21.00x
🐘 PostgresNext.js (Turbopack)53.650s54.107s0.457s21.01x
🐘 PostgresExpress53.817s (~)54.103s (~)0.286s21.01x
🐘 PostgresNitro54.483s (+1.1%)55.125s (+1.9%)0.641s21.02x
💻 LocalExpress54.621s (-2.5%)55.095s (-1.8%)0.474s21.03x
💻 LocalNext.js (Turbopack)55.468s56.099s0.630s21.04x
💻 LocalNitro56.316s (+0.8%)57.106s (+1.8%)0.790s21.06x
🌐 MongoDBNext.js (Turbopack)60.637s61.066s0.429s21.14x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro102.509s (+12.1% 🔺)104.478s (+11.9% 🔺)1.969s11.00x
▲ VercelExpress105.517s (+15.3% 🔺)106.487s (+14.7% 🔺)0.970s11.03x
▲ VercelNext.js (Turbopack)106.817s (+16.7% 🔺)107.886s (+15.8% 🔺)1.069s11.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.286s2.006s0.720s151.00x
💻 LocalExpress1.349s (-3.9%)2.005s (~)0.656s151.05x
🐘 PostgresExpress1.350s (-0.8%)2.012s (~)0.661s151.05x
🐘 PostgresNitro1.367s (+2.1%)2.012s (~)0.645s151.06x
🐘 PostgresNext.js (Turbopack)1.392s2.011s0.618s151.08x
💻 LocalNext.js (Turbopack)1.407s2.006s0.599s151.09x
💻 LocalNitro1.409s (+2.2%)2.006s (~)0.596s151.10x
🌐 MongoDBNext.js (Turbopack)2.159s3.008s0.849s101.68x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.286s (-37.1% 🟢)3.639s (-28.9% 🟢)1.353s91.00x
▲ VercelExpress2.470s (-41.6% 🟢)3.517s (-40.5% 🟢)1.047s91.08x
▲ VercelNitro2.476s (-12.5% 🟢)4.042s (-12.7% 🟢)1.566s81.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.353s (-11.1% 🟢)3.008s (~)0.654s101.00x
🐘 PostgresNitro2.442s (~)3.013s (~)0.570s101.04x
🐘 PostgresExpress2.461s (-0.7%)3.013s (~)0.552s101.05x
🌐 RedisNext.js (Turbopack)2.531s3.008s0.477s101.08x
💻 LocalNext.js (Turbopack)2.551s3.007s0.456s101.08x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.09x
💻 LocalNitro2.686s (+3.1%)3.008s (~)0.322s101.14x
🌐 MongoDBNext.js (Turbopack)4.627s5.177s0.549s61.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.808s (-63.0% 🟢)3.749s (-57.4% 🟢)0.940s91.00x
▲ VercelNext.js (Turbopack)2.916s (-20.0% 🟢)4.356s (-13.0% 🟢)1.441s81.04x
▲ VercelNitro3.376s (-75.3% 🟢)4.615s (-69.2% 🟢)1.239s71.20x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.987s (-1.7%)4.442s (~)0.456s71.00x
🐘 PostgresExpress4.001s (~)4.588s (+6.6% 🔺)0.587s71.00x
🌐 RedisNext.js (Turbopack)4.120s4.725s0.605s71.03x
🐘 PostgresNext.js (Turbopack)4.144s5.017s0.872s61.04x
💻 LocalExpress6.653s (-11.8% 🟢)7.016s (-12.5% 🟢)0.363s51.67x
💻 LocalNext.js (Turbopack)6.984s7.764s0.780s41.75x
💻 LocalNitro7.800s (+6.6% 🔺)8.020s (~)0.220s41.96x
🌐 MongoDBNext.js (Turbopack)9.843s10.351s0.508s32.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.898s (-69.1% 🟢)4.630s (-57.2% 🟢)1.732s71.00x
▲ VercelNext.js (Turbopack)2.898s (-21.1% 🟢)4.685s (-12.1% 🟢)1.786s71.00x
▲ VercelExpress3.048s (-5.1% 🟢)4.504s (-1.2%)1.456s71.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.255s2.007s0.751s151.00x
🐘 PostgresExpress1.336s (-1.5%)2.011s (~)0.675s151.06x
🐘 PostgresNitro1.358s (~)2.012s (~)0.654s151.08x
💻 LocalExpress1.393s (-3.1%)2.006s (~)0.613s151.11x
🐘 PostgresNext.js (Turbopack)1.395s2.011s0.616s151.11x
💻 LocalNext.js (Turbopack)1.427s2.005s0.578s151.14x
💻 LocalNitro1.458s (+3.0%)2.006s (~)0.548s151.16x
🌐 MongoDBNext.js (Turbopack)2.156s3.008s0.852s101.72x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.237s (+2.4%)3.773s (-13.9% 🟢)1.536s81.00x
▲ VercelNext.js (Turbopack)2.442s (+13.7% 🔺)3.812s (-3.9%)1.370s81.09x
▲ VercelExpress2.647s (+23.9% 🔺)3.920s (~)1.273s81.18x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.451s (-8.3% 🟢)3.009s (~)0.557s101.00x
🐘 PostgresExpress2.491s (~)3.012s (~)0.521s101.02x
🐘 PostgresNitro2.515s (+2.2%)3.013s (~)0.498s101.03x
🌐 RedisNext.js (Turbopack)2.548s3.008s0.460s101.04x
🐘 PostgresNext.js (Turbopack)2.563s3.013s0.450s101.05x
💻 LocalNext.js (Turbopack)2.631s3.009s0.378s101.07x
💻 LocalNitro2.807s (+4.3%)3.009s (-3.2%)0.202s101.15x
🌐 MongoDBNext.js (Turbopack)4.683s5.175s0.492s61.91x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.649s (+7.7% 🔺)3.651s (-8.2% 🟢)1.002s91.00x
▲ VercelNitro2.695s (+20.0% 🔺)3.913s (+6.5% 🔺)1.218s91.02x
▲ VercelNext.js (Turbopack)2.902s (+21.8% 🔺)4.152s (-3.8%)1.251s81.10x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.994s (-2.1%)4.447s (-3.1%)0.453s71.00x
🐘 PostgresNitro4.021s (~)4.733s (+3.1%)0.712s71.01x
🌐 RedisNext.js (Turbopack)4.065s5.011s0.946s61.02x
🐘 PostgresNext.js (Turbopack)4.175s4.731s0.556s71.05x
💻 LocalNext.js (Turbopack)7.077s7.768s0.691s41.77x
💻 LocalExpress7.126s (-10.0% 🟢)7.769s (-6.1% 🟢)0.643s41.78x
💻 LocalNitro8.657s (+10.6% 🔺)9.273s (+15.7% 🔺)0.616s42.17x
🌐 MongoDBNext.js (Turbopack)9.946s10.347s0.401s32.49x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.878s (-5.4% 🟢)4.220s (-6.3% 🟢)1.341s81.00x
▲ VercelNext.js (Turbopack)3.032s (-36.7% 🟢)4.629s (-27.1% 🟢)1.597s71.05x
▲ VercelNitro3.097s (+0.9%)4.394s (-15.3% 🟢)1.296s81.08x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express0.113s (-34.8% 🟢)1.002s (~)0.010s (-13.0% 🟢)1.015s (~)0.903s101.00x
💻 LocalNext.js (Turbopack)0.144s1.001s0.012s1.017s0.873s101.28x
🌐 RedisNext.js (Turbopack)0.152s1.000s0.001s1.008s0.856s101.35x
🐘 PostgresNext.js (Turbopack)0.179s1.002s0.002s1.014s0.835s101.59x
💻 LocalNitro0.183s (+9.2% 🔺)1.003s (~)0.011s (-3.4%)1.018s (~)0.835s101.62x
🐘 PostgresExpress0.190s (-1.3%)0.997s (~)0.002s (-15.8% 🟢)1.012s (~)0.822s101.69x
🐘 PostgresNitro0.208s (+5.7% 🔺)0.996s (~)0.002s (+14.3% 🔺)1.015s (~)0.807s101.85x
🌐 MongoDBNext.js (Turbopack)0.473s0.966s0.002s1.008s0.535s104.20x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.554s (-7.7% 🟢)2.550s (+37.8% 🔺)0.005s (+37.5% 🔺)2.962s (+13.0% 🔺)1.408s101.00x
▲ VercelNitro1.611s (+8.6% 🔺)2.599s (+21.4% 🔺)0.010s (+81.1% 🔺)3.152s (+18.6% 🔺)1.542s101.04x
▲ VercelNext.js (Turbopack)1.670s (+2.3%)2.836s (+14.9% 🔺)0.005s (~)3.371s (+11.4% 🔺)1.701s101.07x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalExpress11/12
🐘 PostgresNext.js (Turbopack)5/12
▲ VercelExpress8/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/12
Next.js (Turbopack)🌐 Redis7/12
Nitro🐘 Postgres6/12
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

Comment threadpackages/world-local/src/streamer.ts
…uplicate data in streams when a tag is set.
This commit fixes the issue reported at packages/world-local/src/streamer.ts:316
## Bug Analysis
When `tag` is set (e.g., `vitest-0`), `readFromStream` lists chunk files using both `.bin` and `.{tag}.bin` extensions. The `listFilesByExtension` function strips the extension from filenames and returns the base names.
For a file `stream-chnk_ABC.vitest-0.bin` on disk:
1. `listFilesByExtension(chunksDir, '.bin')` → matches (ends with `.bin`) → returns `stream-chnk_ABC.vitest-0`
2. `listFilesByExtension(chunksDir, '.vitest-0.bin')` → matches (ends with `.vitest-0.bin`) → returns `stream-chnk_ABC`
Both entries are added to `fileExtMap` as separate keys because their stripped names are different:
- `stream-chnk_ABC.vitest-0` → `.bin` - `stream-chnk_ABC` → `.vitest-0.bin`
Both pass the `file.startsWith(`${name}-`)` filter and both appear in `chunkFiles`. When processing:
- Entry 1 (`stream-chnk_ABC.vitest-0`): rawChunkId=`chnk_ABC.vitest-0`, chunkId=`chnk_ABC` (after tag strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues data
- Entry 2 (`stream-chnk_ABC`): rawChunkId=`chnk_ABC`, chunkId=`chnk_ABC` (no tag to strip), reads file `stream-chnk_ABC.vitest-0.bin` and enqueues same data AGAIN
The `deliveredChunkIds` set only tracks event-delivered chunks (populated in the `chunkListener`), not disk-read chunks, so there's no deduplication for the disk reads.
## Fix
When `tag` is set, filter out entries from `binFiles` that end with `.{tag}` since those same physical files will be properly discovered and handled by the tagged listing (`taggedBinFiles`). This is done by checking `if (tag && f.endsWith(tagSuffix)) continue;` when iterating over `binFiles`.
This ensures each physical file appears exactly once in `fileExtMap` — either via the plain `.bin` listing (for untagged files) or via the `.{tag}.bin` listing (for tagged files), but never both.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good PR — the tagged-filename approach is well thought out and the PR description is excellent. One blocking issue around hook token constraint cleanup in clear(), plus a minor comment nit.

Summary of review:

  1. Blocking: Tagged clear() does not clean up hook token constraint files. These files are written untagged ({sha256}.json) into hooks/tokens/, so listTaggedFiles will never match them. Orphaned constraints will cause hook_conflict events in subsequent test runs.

  2. Nit: Misleading comment in deleteAllWaitsForRun — says "strip tag" but doesn't actually call stripTag.

Everything else looks solid: the stripTag regex is correct (entity IDs never contain dots), getObjectCreatedAt correctly strips tags before ULID extraction, the stream dedup fix is well-analyzed and correct, the ENOENT race fix in ensureDataDir is good, and the test coverage is thorough.

Comment threadpackages/world-local/src/index.ts Outdated
'steps',
'events',
'hooks',
'hooks/tokens',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bug (blocking): Token constraint files in hooks/tokens/ are written as {sha256}.json (untagged — see events-storage.ts line 603), so listTaggedFiles(fullDir, tag) here will never match them. After a tagged clear(), orphaned constraint files remain and will block reuse of the same hook tokens in subsequent test runs (writeExclusive will see the old constraint and produce hook_conflict events instead of hook_created).

Two options:

  1. Write constraint files with the tag too (e.g., {hash}.{tag}.json) and update the conflict-detection path to also check the tagged filename.
  2. In the tagged clear() path, read each tagged hook file to extract its token, compute the hash, and explicitly delete the matching constraint file (mirroring what hook_disposed does on line 678-684).


for (const file of files) {
// Strip tag before prefix check — fileIds may contain tags
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: The comment says "strip tag before prefix check" but the code does not actually call stripTag. It works correctly because the tag is a suffix and startsWith only checks the beginning — but the comment is misleading. Consider:

Suggested change
// e.g., "wrun_ABC-corrId.vitest-0" still starts with "wrun_ABC-"
// fileIds may contain tag suffixes (e.g., "wrun_ABC-corrId.vitest-0")
// but startsWith still matches correctly since the tag is a suffix.

@pranaygppranaygp 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.

Good approach overall — the tagged-filename strategy is elegant and avoids the complexity of multi-directory discovery. The PR description is excellent. Agreeing with TooTallNate's changes-requested review, plus a couple additional items below.

Existing issue (agreeing with @TooTallNate):

  • The hooks/tokens/ constraint file cleanup in tagged clear() is a real bug. See my inline comment for a concrete fix suggestion.

Additional findings:

  1. Changeset missing @workflow/vitest — The vitest package has behavioral changes (switched from isolated .workflow-vitest/data/{poolId} to shared .workflow-data with tags, added initDataDir pre-creation). If it's a published package, it should be included in the changeset.
  2. Test coverage gap — The tagged clear() tests don't exercise hooks with token constraints, which is how the constraint file bug went undetected. Consider adding a test that creates a hook, calls clear(), and verifies the constraint file is also removed.

files.map((f) => deleteJSON(path.join(fullDir, f)))
);
})
);

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.

+1 on TooTallNate's blocking comment here. The constraint files in hooks/tokens/ are written untagged at events-storage.ts:603 (${hashToken(hookData.token)}.json), so listTaggedFiles will never match them.

I'd suggest option 2 from his comment (reading tagged hooks to extract tokens) since it keeps the constraint file format stable and doesn't require changes to the conflict-detection path. Something like:

// In the tagged clear() path, after deleting tagged hook files:consthooksDir=path.join(basedir,'hooks');consttaggedHooks=awaitlistTaggedFiles(hooksDir,tag);for(consthookFileoftaggedHooks){consthookPath=path.join(hooksDir,hookFile);consthook=awaitreadJSON(hookPath,HookSchema);if(hook){constconstraintPath=path.join(hooksDir,'tokens',`${hashToken(hook.token)}.json`);awaitdeleteJSON(constraintPath);}}

Note: this read-then-delete needs to happen before the hook files themselves are deleted in the entityDirs loop.

@@ -0,0 +1,5 @@
---
"@workflow/world-local": patch

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.

Should @workflow/vitest also be included here? The vitest package has a behavioral change: it switches from writing to .workflow-vitest/data/{poolId}/ to the shared .workflow-data/ directory with tag-based isolation. The initDataDir pre-creation call is also new. If @workflow/vitest is published, consumers should see this in the changelog.

expect(await fs.readdir(stepsDir)).toHaveLength(0);

await world.close?.();
});

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.

This test suite is thorough for runs/events/steps, but the gap here is that it doesn't test clear() with hooks that have token constraint files. Adding a test that:

  1. Creates a run + hook (which writes a constraint file in hooks/tokens/)
  2. Calls world.clear()
  3. Asserts the constraint file was also deleted

would have caught the bug TooTallNate identified.

- Fix tagged clear() to also delete hook token constraint files by
reading tagged hook files to extract tokens before deletion
- Fix misleading comment in deleteAllWaitsForRun (says "strip tag"
but doesn't call stripTag — the prefix check works because tags
are suffixes)
- Add @workflow/vitest to changeset (behavioral change: switches
from .workflow-vitest/data/{poolId} to shared .workflow-data)
- Add test for clear() with hooks verifying constraint file cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both issues from my previous review are fixed:

  1. Hook token constraint cleanupclear() now reads each tagged hook file to extract its token, computes the hash, and deletes the matching constraint file before deleting the hook files. Correct ordering and the new should clear hook token constraint files test covers it.

  2. Misleading comment — Updated to accurately describe the startsWith behavior with tagged fileIds.

  3. Changeset — Now includes @workflow/vitest alongside @workflow/world-local.

The Windows E2E failure is unrelated (flaky should rebuild on workflow change test timing out).

LGTM.

@ghostghost mentioned this pull request Mar 13, 2026
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.

3 participants

@VaguelySerious@TooTallNate@pranaygp