Skip to content

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966

Open
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race
Open

fix(world-postgres): serialize graphile-worker bootstrap with advisory lock#1966
TooTallNate wants to merge 2 commits into
mainfrom
fix-world-postgres-graphile-bootstrap-race

Conversation

@TooTallNate
Copy link
Copy Markdown
Member

Summary

Fixes the E2E Local Postgres Tests flake on main (example failing job) where the first test (addTenWorkflow) fails with:

error: duplicate key value violates unique constraint "pg_namespace_nspname_index"
❯ installSchema node_modules/.../graphile-worker/dist/migrate.js:23:5
❯ migrate     node_modules/.../graphile-worker/dist/migrate.js:92:17
❯ makeWorkerUtils node_modules/.../graphile-worker/dist/workerUtils.js:12:40
❯ packages/world-postgres/dist/queue.js:212:35
❯ start packages/world-postgres/dist/queue.js:226:9

Root cause

PR #1959 removed instrumentation.ts from the workbenches, which previously pre-warmed world.start() in the Next.js dev server before any HTTP traffic arrived. Without that pre-warm, world.start() is now called lazily on the first workflow request — and in the local-postgres CI matrix, the vitest test process itself also initializes a postgres world (because WORKFLOW_TARGET_WORLD=@workflow/world-postgres is set in the test env). So two independent Node processes (the test runner and the Next.js dev server) race to install the graphile_worker schema on a fresh database.

PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe across concurrent sessions — the existence check happens at one MVCC snapshot but the pg_namespace insert happens at commit, so two sessions can both pass the check and one then fails with duplicate key value violates unique constraint "pg_namespace_nspname_index". graphile-worker's installSchema does no locking around this.

Fix

Wrap the makeWorkerUtils({pgPool}).migrate() call in packages/world-postgres/src/queue.ts with a Postgres advisory lock (pg_advisory_xact_lock) so that concurrent callers across processes are serialized on graphile-worker schema bootstrap. The lock is transaction-scoped, so it is automatically released if the bootstrapping process dies mid-flight.

Verification

  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter @workflow/world-postgres build
  • pnpm --filter @workflow/world-postgres test ✓ (109/109, including the real-Postgres integration tests in test/spec.test.ts that exercise the full world.start() path)

…y lock

Prevents "duplicate key value violates unique constraint
pg_namespace_nspname_index" errors when multiple processes (e.g. dev
server + test runner) call world.start() concurrently against a fresh
database. PostgreSQL's CREATE SCHEMA IF NOT EXISTS is not race-safe
across concurrent sessions, and graphile-worker's installSchema does
not lock its bootstrap path.
Copilot AI review requested due to automatic review settings May 11, 2026 06:06
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment May 11, 2026 6:56pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment May 11, 2026 6:56pm
example-workflow Building Building Preview, Comment May 11, 2026 6:56pm
workbench-astro-workflow Ready Ready Preview, Comment May 11, 2026 6:56pm
workbench-express-workflow Ready Ready Preview, Comment May 11, 2026 6:56pm
workbench-fastify-workflow Building Building Preview, Comment May 11, 2026 6:56pm
workbench-hono-workflow Ready Ready Preview, Comment May 11, 2026 6:56pm
workbench-nitro-workflow Ready Ready Preview, Comment May 11, 2026 6:56pm
workbench-nuxt-workflow Ready Ready Preview, Comment May 11, 2026 6:56pm
workbench-sveltekit-workflow Ready Ready Preview, Comment May 11, 2026 6:56pm
workbench-tanstack-start-workflow Building Building Preview, Comment May 11, 2026 6:56pm
workbench-vite-workflow Ready Ready Preview, Comment May 11, 2026 6:56pm
workflow-docs Ready Ready Preview, Comment, Open in v0 May 11, 2026 6:56pm
workflow-swc-playground Ready Ready Preview, Comment May 11, 2026 6:56pm
workflow-tarballs Ready Ready Preview, Comment May 11, 2026 6:56pm
workflow-web Ready Ready Preview, Comment May 11, 2026 6:56pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

🦋 Changeset detected

Latest commit: f8f2980

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

This PR includes changesets to release 2 packages
Name Type
@workflow/world-postgres Patch
tarballs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

🧪 E2E Test Results

All tests passed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 1200 0 219 1419
✅ 💻 Local Development 1587 0 219 1806
✅ 📦 Local Production 1587 0 219 1806
✅ 🐘 Local Postgres 1587 0 219 1806
✅ 🪟 Windows 129 0 0 129
✅ 📋 Other 727 0 176 903
Total 6817 0 1052 7869

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 103 0 26
✅ example 103 0 26
✅ express 103 0 26
✅ fastify 103 0 26
✅ hono 103 0 26
✅ nextjs-turbopack 127 0 2
✅ nextjs-webpack 127 0 2
✅ nitro 103 0 26
✅ nuxt 103 0 26
✅ sveltekit 122 0 7
✅ vite 103 0 26
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 104 0 25
✅ express-stable 104 0 25
✅ fastify-stable 104 0 25
✅ hono-stable 104 0 25
✅ nextjs-turbopack-canary 110 0 19
✅ nextjs-turbopack-stable-lazy-discovery-disabled 129 0 0
✅ nextjs-turbopack-stable-lazy-discovery-enabled 129 0 0
✅ nextjs-webpack-canary 110 0 19
✅ nextjs-webpack-stable-lazy-discovery-disabled 129 0 0
✅ nextjs-webpack-stable-lazy-discovery-enabled 129 0 0
✅ nitro-stable 104 0 25
✅ nuxt-stable 104 0 25
✅ sveltekit-stable 123 0 6
✅ vite-stable 104 0 25
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 104 0 25
✅ express-stable 104 0 25
✅ fastify-stable 104 0 25
✅ hono-stable 104 0 25
✅ nextjs-turbopack-canary 110 0 19
✅ nextjs-turbopack-stable-lazy-discovery-disabled 129 0 0
✅ nextjs-turbopack-stable-lazy-discovery-enabled 129 0 0
✅ nextjs-webpack-canary 110 0 19
✅ nextjs-webpack-stable-lazy-discovery-disabled 129 0 0
✅ nextjs-webpack-stable-lazy-discovery-enabled 129 0 0
✅ nitro-stable 104 0 25
✅ nuxt-stable 104 0 25
✅ sveltekit-stable 123 0 6
✅ vite-stable 104 0 25
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 104 0 25
✅ express-stable 104 0 25
✅ fastify-stable 104 0 25
✅ hono-stable 104 0 25
✅ nextjs-turbopack-canary 110 0 19
✅ nextjs-turbopack-stable-lazy-discovery-disabled 129 0 0
✅ nextjs-turbopack-stable-lazy-discovery-enabled 129 0 0
✅ nextjs-webpack-canary 110 0 19
✅ nextjs-webpack-stable-lazy-discovery-disabled 129 0 0
✅ nextjs-webpack-stable-lazy-discovery-enabled 129 0 0
✅ nitro-stable 104 0 25
✅ nuxt-stable 104 0 25
✅ sveltekit-stable 123 0 6
✅ vite-stable 104 0 25
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 129 0 0
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 104 0 25
✅ e2e-local-dev-tanstack-start- 104 0 25
✅ e2e-local-postgres-nest-stable 104 0 25
✅ e2e-local-postgres-tanstack-start- 104 0 25
✅ e2e-local-prod-nest-stable 104 0 25
✅ e2e-local-prod-tanstack-start- 104 0 25
✅ e2e-vercel-prod-tanstack-start 103 0 26

📋 View full workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 0.032s (-28.9% 🟢) 1.006s (~) 0.974s 10 1.00x
💻 Local Nitro 0.033s (-22.7% 🟢) 1.006s (~) 0.972s 10 1.06x
💻 Local Next.js (Turbopack) 0.046s 1.005s 0.960s 10 1.46x
🐘 Postgres Express 0.049s (-16.0% 🟢) 1.012s (~) 0.963s 10 1.55x
🐘 Postgres Nitro 0.053s (-44.5% 🟢) 1.013s (-2.9%) 0.960s 10 1.68x
🐘 Postgres Next.js (Turbopack) 0.057s 1.011s 0.954s 10 1.82x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 0.292s (-28.8% 🟢) 2.290s (-8.7% 🟢) 1.998s 10 1.00x
▲ Vercel Express 0.338s (+43.5% 🔺) 2.489s (+16.5% 🔺) 2.151s 10 1.16x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 1.067s (-5.7% 🟢) 2.006s (~) 0.939s 10 1.00x
💻 Local Express 1.069s (-5.0% 🟢) 2.007s (~) 0.938s 10 1.00x
🐘 Postgres Express 1.083s (-5.6% 🟢) 2.008s (~) 0.926s 10 1.01x
🐘 Postgres Nitro 1.089s (-4.5%) 2.010s (~) 0.921s 10 1.02x
💻 Local Next.js (Turbopack) 1.123s 2.006s 0.882s 10 1.05x
🐘 Postgres Next.js (Turbopack) 1.123s 2.009s 0.886s 10 1.05x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 1.634s (-58.0% 🟢) 3.924s (-33.6% 🟢) 2.290s 10 1.00x
▲ Vercel Express 1.652s (-11.9% 🟢) 3.842s (+0.9%) 2.190s 10 1.01x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 10.404s (-5.0%) 11.022s (~) 0.618s 3 1.00x
🐘 Postgres Nitro 10.414s (-4.2%) 11.018s (~) 0.604s 3 1.00x
💻 Local Express 10.423s (-4.6%) 11.022s (~) 0.600s 3 1.00x
🐘 Postgres Express 10.426s (-4.9%) 11.019s (~) 0.593s 3 1.00x
💻 Local Next.js (Turbopack) 10.661s 11.021s 0.360s 3 1.02x
🐘 Postgres Next.js (Turbopack) 10.720s 11.017s 0.296s 3 1.03x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 13.871s (-18.3% 🟢) 16.522s (-17.5% 🟢) 2.651s 2 1.00x
▲ Vercel Nitro 14.235s (-40.0% 🟢) 16.109s (-35.9% 🟢) 1.874s 2 1.03x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

workflow with 25 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 13.443s (-7.8% 🟢) 14.017s (-6.7% 🟢) 0.574s 5 1.00x
💻 Local Nitro 13.449s (-10.7% 🟢) 14.026s (-12.5% 🟢) 0.577s 5 1.00x
💻 Local Express 13.466s (-10.0% 🟢) 14.028s (-6.7% 🟢) 0.562s 5 1.00x
🐘 Postgres Nitro 13.488s (-7.6% 🟢) 14.016s (-6.7% 🟢) 0.529s 5 1.00x
💻 Local Next.js (Turbopack) 14.079s 15.030s 0.951s 4 1.05x
🐘 Postgres Next.js (Turbopack) 14.119s 15.017s 0.898s 4 1.05x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 22.850s (-64.5% 🟢) 24.719s (-62.9% 🟢) 1.869s 3 1.00x
▲ Vercel Express 23.445s (-53.4% 🟢) 25.528s (-51.4% 🟢) 2.083s 3 1.03x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

workflow with 50 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 11.921s (-29.0% 🟢) 12.147s (-28.7% 🟢) 0.226s 8 1.00x
🐘 Postgres Express 11.945s (-14.7% 🟢) 12.266s (-15.9% 🟢) 0.321s 8 1.00x
🐘 Postgres Nitro 11.952s (-14.4% 🟢) 12.143s (-15.1% 🟢) 0.191s 8 1.00x
💻 Local Express 12.038s (-27.5% 🟢) 12.649s (-25.7% 🟢) 0.612s 8 1.01x
💻 Local Next.js (Turbopack) 13.059s 13.451s 0.392s 7 1.10x
🐘 Postgres Next.js (Turbopack) 13.118s 14.017s 0.899s 7 1.10x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 32.773s (-92.3% 🟢) 34.865s (-91.8% 🟢) 2.092s 3 1.00x
▲ Vercel Express 33.214s (-72.6% 🟢) 35.758s (-71.1% 🟢) 2.545s 3 1.01x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.147s (-9.0% 🟢) 2.007s (~) 0.860s 15 1.00x
🐘 Postgres Nitro 1.149s (-9.9% 🟢) 2.007s (~) 0.858s 15 1.00x
💻 Local Express 1.175s (-21.0% 🟢) 2.005s (~) 0.830s 15 1.02x
💻 Local Nitro 1.197s (-26.6% 🟢) 2.006s (-3.3%) 0.809s 15 1.04x
🐘 Postgres Next.js (Turbopack) 1.213s 2.008s 0.795s 15 1.06x
💻 Local Next.js (Turbopack) 1.289s 2.006s 0.717s 15 1.12x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 5.022s (+78.2% 🔺) 6.611s (+53.0% 🔺) 1.590s 5 1.00x
▲ Vercel Express 5.473s (+91.4% 🔺) 7.608s (+64.6% 🔺) 2.135s 4 1.09x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.224s (-48.2% 🟢) 2.006s (-33.3% 🟢) 0.782s 15 1.00x
🐘 Postgres Nitro 1.224s (-47.9% 🟢) 2.006s (-33.3% 🟢) 0.782s 15 1.00x
🐘 Postgres Next.js (Turbopack) 1.376s 2.008s 0.631s 15 1.12x
💻 Local Express 1.743s (-41.0% 🟢) 2.005s (-41.9% 🟢) 0.262s 15 1.42x
💻 Local Nitro 1.755s (-44.2% 🟢) 2.006s (-48.4% 🟢) 0.251s 15 1.43x
💻 Local Next.js (Turbopack) 1.769s 2.149s 0.380s 14 1.45x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 5.028s (+38.9% 🔺) 6.726s (+31.6% 🔺) 1.698s 6 1.00x
▲ Vercel Nitro 5.572s (+37.5% 🔺) 7.208s (+21.7% 🔺) 1.636s 5 1.11x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.369s (-60.7% 🟢) 2.007s (-50.0% 🟢) 0.638s 15 1.00x
🐘 Postgres Nitro 1.370s (-60.6% 🟢) 2.007s (-49.9% 🟢) 0.636s 15 1.00x
🐘 Postgres Next.js (Turbopack) 1.635s 2.007s 0.371s 15 1.19x
💻 Local Next.js (Turbopack) 4.663s 5.154s 0.491s 7 3.41x
💻 Local Nitro 5.177s (-38.0% 🟢) 5.679s (-37.0% 🟢) 0.503s 6 3.78x
💻 Local Express 5.194s (-37.7% 🟢) 5.513s (-38.9% 🟢) 0.319s 6 3.79x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 7.029s (+65.8% 🔺) 8.709s (+42.1% 🔺) 1.679s 4 1.00x
▲ Vercel Nitro 8.935s (+153.4% 🔺) 10.556s (+90.7% 🔺) 1.621s 3 1.27x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 1.148s (-8.7% 🟢) 2.007s (~) 0.859s 15 1.00x
🐘 Postgres Express 1.152s (-8.3% 🟢) 2.007s (~) 0.855s 15 1.00x
🐘 Postgres Next.js (Turbopack) 1.214s 2.006s 0.793s 15 1.06x
💻 Local Next.js (Turbopack) 1.353s 2.005s 0.653s 15 1.18x
💻 Local Nitro 1.433s (-23.2% 🟢) 2.006s (-14.3% 🟢) 0.573s 15 1.25x
💻 Local Express 1.441s (-23.9% 🟢) 2.006s (-15.1% 🟢) 0.564s 15 1.26x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.577s (+38.6% 🔺) 5.207s (+19.7% 🔺) 1.630s 6 1.00x
▲ Vercel Nitro 4.549s (+85.0% 🔺) 6.211s (+49.0% 🔺) 1.662s 6 1.27x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.215s (-48.1% 🟢) 2.009s (-33.3% 🟢) 0.794s 15 1.00x
🐘 Postgres Nitro 1.247s (-46.7% 🟢) 2.009s (-33.3% 🟢) 0.761s 15 1.03x
🐘 Postgres Next.js (Turbopack) 1.363s 2.008s 0.645s 15 1.12x
💻 Local Nitro 1.967s (-35.8% 🟢) 2.469s (-36.5% 🟢) 0.503s 13 1.62x
💻 Local Express 1.979s (-36.8% 🟢) 2.392s (-36.4% 🟢) 0.413s 13 1.63x
💻 Local Next.js (Turbopack) 1.998s 2.675s 0.678s 12 1.64x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 4.851s (+50.0% 🔺) 6.263s (+23.4% 🔺) 1.413s 5 1.00x
▲ Vercel Express 5.603s (+75.5% 🔺) 7.182s (+49.9% 🔺) 1.579s 5 1.16x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.366s (-61.0% 🟢) 2.008s (-49.9% 🟢) 0.641s 15 1.00x
🐘 Postgres Nitro 1.403s (-59.7% 🟢) 2.007s (-49.9% 🟢) 0.604s 15 1.03x
🐘 Postgres Next.js (Turbopack) 1.638s 2.007s 0.369s 15 1.20x
💻 Local Next.js (Turbopack) 4.981s 5.680s 0.699s 6 3.65x
💻 Local Nitro 5.479s (-40.1% 🟢) 6.214s (-38.0% 🟢) 0.734s 5 4.01x
💻 Local Express 5.612s (-36.2% 🟢) 6.214s (-33.0% 🟢) 0.602s 5 4.11x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 7.939s (+23.7% 🔺) 10.418s (+27.4% 🔺) 2.479s 4 1.00x
▲ Vercel Nitro 8.342s (+63.8% 🔺) 9.730s (+42.7% 🔺) 1.389s 4 1.05x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.450s (-46.4% 🟢) 1.006s (-1.6%) 0.557s 60 1.00x
🐘 Postgres Nitro 0.452s (-45.0% 🟢) 1.006s (~) 0.554s 60 1.00x
💻 Local Nitro 0.462s (-52.9% 🟢) 1.004s (-8.2% 🟢) 0.542s 60 1.03x
💻 Local Express 0.467s (-52.5% 🟢) 1.004s (-6.7% 🟢) 0.537s 60 1.04x
🐘 Postgres Next.js (Turbopack) 0.676s 1.007s 0.331s 60 1.50x
💻 Local Next.js (Turbopack) 0.727s 1.004s 0.278s 60 1.62x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 5.163s (-72.8% 🟢) 7.100s (-66.7% 🟢) 1.938s 9 1.00x
▲ Vercel Nitro 6.750s (-69.4% 🟢) 8.352s (-65.2% 🟢) 1.602s 8 1.31x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.045s (-47.1% 🟢) 1.523s (-32.6% 🟢) 0.478s 60 1.00x
🐘 Postgres Nitro 1.082s (-43.8% 🟢) 1.705s (-18.8% 🟢) 0.622s 53 1.04x
💻 Local Nitro 1.183s (-61.0% 🟢) 2.006s (-46.6% 🟢) 0.823s 45 1.13x
💻 Local Express 1.191s (-60.5% 🟢) 2.005s (-44.1% 🟢) 0.814s 45 1.14x
🐘 Postgres Next.js (Turbopack) 1.602s 2.007s 0.405s 45 1.53x
💻 Local Next.js (Turbopack) 1.814s 2.006s 0.192s 45 1.74x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 13.163s (-61.9% 🟢) 15.281s (-58.5% 🟢) 2.117s 6 1.00x
▲ Vercel Nitro 13.845s (-64.9% 🟢) 15.606s (-62.2% 🟢) 1.761s 6 1.05x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 2.041s (-50.3% 🟢) 2.477s (-46.2% 🟢) 0.436s 49 1.00x
🐘 Postgres Express 2.090s (-47.6% 🟢) 2.638s (-39.6% 🟢) 0.548s 46 1.02x
💻 Local Nitro 2.660s (-71.4% 🟢) 3.008s (-70.0% 🟢) 0.348s 40 1.30x
💻 Local Express 2.681s (-70.9% 🟢) 3.032s (-69.7% 🟢) 0.352s 40 1.31x
🐘 Postgres Next.js (Turbopack) 3.154s 4.009s 0.855s 30 1.55x
💻 Local Next.js (Turbopack) 3.855s 4.075s 0.220s 30 1.89x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 40.673s (-68.7% 🟢) 42.850s (-67.6% 🟢) 2.177s 3 1.00x
▲ Vercel Nitro 41.417s (-57.3% 🟢) 43.192s (-56.1% 🟢) 1.776s 3 1.02x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.177s (-37.2% 🟢) 1.007s (~) 0.829s 60 1.00x
🐘 Postgres Nitro 0.189s (-33.3% 🟢) 1.006s (~) 0.817s 60 1.07x
🐘 Postgres Next.js (Turbopack) 0.237s 1.006s 0.770s 60 1.33x
💻 Local Express 0.428s (-23.6% 🟢) 1.004s (~) 0.576s 60 2.41x
💻 Local Nitro 0.456s (-24.6% 🟢) 1.004s (-1.7%) 0.548s 60 2.57x
💻 Local Next.js (Turbopack) 0.568s 1.004s 0.436s 60 3.20x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 2.570s (+54.7% 🔺) 4.071s (+21.5% 🔺) 1.501s 15 1.00x
▲ Vercel Express 2.703s (+38.3% 🔺) 4.438s (+22.0% 🔺) 1.735s 14 1.05x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.303s (-40.5% 🟢) 1.007s (~) 0.703s 90 1.00x
🐘 Postgres Nitro 0.316s (-36.3% 🟢) 1.006s (~) 0.690s 90 1.04x
🐘 Postgres Next.js (Turbopack) 0.459s 1.006s 0.547s 90 1.51x
💻 Local Express 2.171s (-13.6% 🟢) 2.796s (-7.1% 🟢) 0.625s 33 7.16x
💻 Local Next.js (Turbopack) 2.175s 3.010s 0.835s 30 7.17x
💻 Local Nitro 2.239s (-11.8% 🟢) 2.944s (-2.2%) 0.705s 31 7.38x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 8.771s (+171.9% 🔺) 10.519s (+118.2% 🔺) 1.747s 9 1.00x
▲ Vercel Express 9.600s (+215.1% 🔺) 12.351s (+156.9% 🔺) 2.751s 8 1.09x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Nitro | Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.622s (-24.0% 🟢) 1.006s (-1.1%) 0.383s 120 1.00x
🐘 Postgres Nitro 0.640s (-19.0% 🟢) 1.006s (~) 0.365s 120 1.03x
🐘 Postgres Next.js (Turbopack) 0.967s 1.466s 0.499s 83 1.55x
💻 Local Nitro 10.059s (-10.1% 🟢) 10.531s (-9.7% 🟢) 0.472s 12 16.16x
💻 Local Express 10.208s (-8.8% 🟢) 10.696s (-10.4% 🟢) 0.488s 12 16.40x
💻 Local Next.js (Turbopack) 11.327s 11.939s 0.612s 11 18.20x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 22.654s (+205.3% 🔺) 24.859s (+168.9% 🔺) 2.205s 6 1.00x
▲ Vercel Nitro 24.155s (+212.8% 🔺) 26.342s (+180.2% 🔺) 2.187s 5 1.07x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - -

🔍 Observability: Express | Nitro

Stream Benchmarks (includes TTFB metrics)
workflow with stream

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 1.131s (+429.4% 🔺) 2.005s (+99.6% 🔺) 0.012s (-2.4%) 2.019s (+98.2% 🔺) 0.888s 10 1.00x
🐘 Postgres Nitro 1.133s (+452.4% 🔺) 2.001s (+100.1% 🔺) 0.001s (-13.3% 🟢) 2.010s (+98.7% 🔺) 0.877s 10 1.00x
🐘 Postgres Express 1.133s (+452.7% 🔺) 1.998s (+100.1% 🔺) 0.001s (-31.3% 🟢) 2.009s (+98.7% 🔺) 0.876s 10 1.00x
💻 Local Express 1.134s (+469.7% 🔺) 2.005s (+99.6% 🔺) 0.012s (+0.8%) 2.019s (+98.3% 🔺) 0.885s 10 1.00x
💻 Local Next.js (Turbopack) 1.186s 2.003s 0.011s 2.017s 0.831s 10 1.05x
🐘 Postgres Next.js (Turbopack) 1.198s 2.002s 0.002s 2.012s 0.814s 10 1.06x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 2.433s (-36.5% 🟢) 3.428s (-35.0% 🟢) 2.381s (+220.8% 🔺) 6.286s (-3.0%) 3.853s 10 1.00x
▲ Vercel Express 2.493s (~) 3.666s (-10.4% 🟢) 2.778s (+189.1% 🔺) 6.958s (+24.5% 🔺) 4.465s 10 1.02x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - - -

🔍 Observability: Nitro | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.490s (+136.5% 🔺) 2.006s (+99.3% 🔺) 0.004s (+0.9%) 2.028s (+98.2% 🔺) 0.537s 30 1.00x
🐘 Postgres Nitro 1.515s (+142.7% 🔺) 2.004s (+99.0% 🔺) 0.004s (-6.5% 🟢) 2.026s (+98.1% 🔺) 0.511s 30 1.02x
💻 Local Nitro 1.527s (+82.1% 🔺) 2.010s (+98.7% 🔺) 0.010s (+7.8% 🔺) 2.023s (+81.2% 🔺) 0.496s 30 1.02x
🐘 Postgres Next.js (Turbopack) 1.693s 2.010s 0.004s 2.027s 0.334s 30 1.14x
💻 Local Next.js (Turbopack) 1.846s 2.009s 0.011s 2.201s 0.355s 28 1.24x
💻 Local Express 1.926s (+154.4% 🔺) 2.012s (+95.5% 🔺) 0.010s (+4.5%) 2.424s (+133.1% 🔺) 0.498s 25 1.29x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 6.501s (-77.9% 🟢) 7.965s (-74.1% 🟢) 0.254s (+126.5% 🔺) 8.704s (-72.6% 🟢) 2.203s 7 1.00x
▲ Vercel Express 6.740s (+3.6%) 8.086s (+1.0%) 0.308s (-24.6% 🟢) 8.933s (+1.1%) 2.193s 7 1.04x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - - -

🔍 Observability: Nitro | Express

10 parallel streams (1MB each)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 0.657s (-32.2% 🟢) 1.032s (-17.3% 🟢) 0.000s (-17.2% 🟢) 1.050s (-16.5% 🟢) 0.392s 58 1.00x
🐘 Postgres Express 0.660s (-31.3% 🟢) 1.030s (-19.4% 🟢) 0.000s (+19.0% 🔺) 1.049s (-19.7% 🟢) 0.389s 58 1.00x
🐘 Postgres Next.js (Turbopack) 0.794s 1.072s 0.000s 1.079s 0.285s 56 1.21x
💻 Local Nitro 1.361s (+11.3% 🔺) 2.015s (~) 0.000s (+133.3% 🔺) 2.017s (~) 0.656s 30 2.07x
💻 Local Express 1.361s (+11.2% 🔺) 2.016s (~) 0.001s (+60.0% 🔺) 2.018s (~) 0.657s 30 2.07x
💻 Local Next.js (Turbopack) 1.480s 2.014s 0.000s 2.017s 0.537s 30 2.25x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 3.891s (+27.5% 🔺) 5.190s (+18.2% 🔺) 0.000s (+254.5% 🔺) 5.758s (+19.7% 🔺) 1.868s 11 1.00x
▲ Vercel Express 4.219s (+12.8% 🔺) 5.581s (+9.4% 🔺) 0.002s (+1000.0% 🔺) 6.074s (+9.8% 🔺) 1.855s 11 1.08x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - - -

🔍 Observability: Nitro | Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.232s (-30.5% 🟢) 1.998s (-8.3% 🟢) 0.000s (+Infinity% 🔺) 2.015s (-8.4% 🟢) 0.783s 30 1.00x
🐘 Postgres Nitro 1.273s (-28.9% 🟢) 2.029s (-5.3% 🟢) 0.000s (-6.7% 🟢) 2.045s (-6.0% 🟢) 0.771s 30 1.03x
🐘 Postgres Next.js (Turbopack) 1.610s 2.110s 0.000s 2.145s 0.534s 28 1.31x
💻 Local Next.js (Turbopack) 2.878s 3.416s 0.000s 3.424s 0.545s 18 2.34x
💻 Local Nitro 3.083s (-9.0% 🟢) 3.905s (-3.2%) 0.000s (-64.8% 🟢) 3.907s (-3.2%) 0.824s 16 2.50x
💻 Local Express 3.168s (-8.6% 🟢) 3.966s (-1.7%) 0.001s (-6.3% 🟢) 3.968s (-1.7%) 0.800s 16 2.57x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 6.633s (+44.6% 🔺) 8.145s (+35.3% 🔺) 0.001s (+Infinity% 🔺) 8.706s (+34.8% 🔺) 2.073s 7 1.00x
▲ Vercel Nitro 7.121s (+73.9% 🔺) 8.227s (+53.1% 🔺) 0.000s (-47.6% 🟢) 8.712s (+50.4% 🔺) 1.591s 7 1.07x
▲ Vercel Next.js (Turbopack) ⚠️ missing - - - - -

🔍 Observability: Express | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Nitro 12/21
🐘 Postgres Express 16/21
▲ Vercel Nitro 11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 🐘 Postgres 18/21
Next.js (Turbopack) 🐘 Postgres 15/21
Nitro 🐘 Postgres 15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a flaky race during @workflow/world-postgres startup where concurrent processes can both attempt graphile-worker schema installation on a fresh database, triggering duplicate key value violates unique constraint "pg_namespace_nspname_index".

Changes:

  • Serialize graphile-worker bootstrap (makeWorkerUtils + migrate) using a Postgres advisory lock in packages/world-postgres/src/queue.ts.
  • Update unit test pool mocks to include pool.connect() to match the new startup path.
  • Add a changeset documenting the patch release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/world-postgres/src/queue.ts Adds transaction-scoped advisory lock wrapper around graphile-worker bootstrap to avoid concurrent schema install races.
packages/world-postgres/src/queue.test.ts Updates pool mock to include connect() for the new locking code path.
packages/world-postgres/src/reenqueue.test.ts Updates pool mock to include connect() for the new locking code path.
.changeset/fix-world-postgres-graphile-bootstrap-race.md Declares a patch release and describes the race/lock fix.

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

Comment thread packages/world-postgres/src/queue.ts Outdated
Comment thread packages/world-postgres/src/queue.ts Outdated
- Release the locked connection before makeWorkerUtils() so the
  bootstrap can't deadlock against the same pool when maxPoolSize is
  small (Copilot review #1). Achieved by replicating graphile-worker's
  installSchema DDL ourselves under the lock; once the schema exists
  graphile-worker's own installSchema is a no-op.
- Add a unit test that asserts the lock-ordering: pool.connect -> BEGIN
  -> pg_advisory_xact_lock -> CREATE SCHEMA -> COMMIT -> release ->
  makeWorkerUtils (Copilot review #2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants