Revert "Statically inject workflow world target" (#2752) - #3142
Revert "Statically inject workflow world target" (#2752)#3142VaguelySerious wants to merge 1 commit into
Conversation
This reverts the static world-target injection and restores runtime resolution of the world package from `WORKFLOW_TARGET_WORLD`. Because 141 commits have landed on top of #2752, this is a surgical revert rather than a mechanical one. Removed: the `world-target` modules in core/builders/utils, the bundler aliases and `define`s wired through next/nitro/nuxt/astro/sveltekit/rollup/nest, the `@workflow/core/runtime/world-target` export, and the pg-native/node-compat-banner helpers that only existed to support the statically bundled world. Kept (later work that builds on #2752): - `createWorldFromModule` / `WorldFactoryModule` in core (used by world-testing and the nitro dev handler) - `world-init` / `world-init-stub` / `getWorldLazy` and their registration of `getWorld` on globalThis, plus the #3001 isolated route bundle regression test - #2804 (web), #2806 (cli dynamic community backends), #3112 (world factory alias removal), #2988 (nest vercel builder), #2925/#2908 (nitro), #2799 (sveltekit typescript stub is dropped with the injection it existed for), next basePath support, and the windows / canary test timeout tuning Co-Authored-By: Claude Opus 5 <[email protected]>
|
| Name | Type |
|---|---|
| @workflow/builders | Patch |
| @workflow/core | Patch |
| @workflow/nest | Patch |
| @workflow/next | Patch |
| @workflow/nitro | Patch |
| @workflow/nuxt | Patch |
| @workflow/astro | Patch |
| @workflow/rollup | Patch |
| @workflow/sveltekit | Patch |
| @workflow/utils | Patch |
| @workflow/cli | Patch |
| @workflow/world-testing | Patch |
| workflow | Patch |
| @workflow/vite | Patch |
| @workflow/vitest | Patch |
| @workflow/web-shared | Patch |
| @workflow/web | Patch |
| @workflow/errors | Patch |
| @workflow/world-local | Patch |
| @workflow/world-postgres | Patch |
| @workflow/world-vercel | Patch |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
🧪 E2E Test Results✅ All tests passed E2E Test SummarySummary
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
✅ vercel-multi-region
|
📊 Workflow Benchmarkscommit Backend:
ℹ️ Metric definitions & methodologyBest/P75/P90/P99 deltas compare against the most recent benchmark run on Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window) Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost 🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120 All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor ( Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the |
Reverts #2752 ("Statically inject workflow world target"). The world package is once again resolved at runtime from
WORKFLOW_TARGET_WORLDinstead of being aliased into host bundles at build time.Why this is a surgical revert
141 commits have landed on top of #2752, several of which build on it, so
git revertalone leaves the tree unbuildable. This branch removes the static-injection mechanism and restores the pre-#2752 runtime resolution while keeping everything that landed after it.Removed
world-targetmodules in@workflow/core,@workflow/builders, and the Statically inject workflow world target #2752 additions to@workflow/utilsdefines wired through next, nitro, nuxt, astro, sveltekit, rollup, and both nest builders@workflow/core/runtime/world-targetexport, its tsconfig/vitest path aliasespg-nativestub alias and the extracted node-compat banner constants, which only existed because the world package was forced into the SSR bundle (the sveltekittypescriptstub alias from fix(sveltekit): production server crash from bundled TypeScript compiler #2799 goes with them for the same reason)Kept
createWorldFromModule/WorldFactoryModulein core — still used by@workflow/world-testingand the nitro dev virtual handlerworld-init/world-init-stub/getWorldLazyand theglobalThis[GetWorldFnKey] ??= getWorldregistration, plus the test: regression coverage for hook.resume() from isolated route bundles (o2flow beta.26 incident) #3001 isolated-route-bundle regression testcreateWorldfrom the world packages), [nest] Fix NestJS Vercel build output #2988 (nest vercel builder), Fix duplicate transforms of Nitro build artifacts #2925 / Fix Nitro cleanup for React Router and add setup guides #2908 (nitro), nextbasePathsupport, windows/canary test-timeout tuningNote on the o2flow incident that motivated #2752
The o2flow failure (
Cannot find module as expression is too dynamiconsandboxDoneHook.resume()) was caused by the world registration being tree-shaken out of an isolated route bundle, which madegetWorldLazy()fall through to an obfuscatedimport()that Turbopack stubs. That path is fixed by theworld-initside-effect import on every host entrypoint plus the loud "world runtime was not initialized" error — both of which this revert keeps, along with #3001's regression test. o2flow runs on the Vercel world, which core imports statically, so it never reaches the dynamic resolution path this revert restores.A follow-up PR stacked on this one proposes hardening the remaining dynamic path (custom world packages under Turbopack/webpack) without reintroducing build-time injection.
Verification
pnpm build,pnpm typecheckgreen