feat(core): experimental start-hook admission for start()#2762
feat(core): experimental start-hook admission for start()#2762NathanColosimo wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 8438b93 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
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 |
🧪 E2E Test Results✅ All tests passed Summary
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) 10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
79beb9d to
41bdb5a
Compare
Adds the experimentalStartHook option to start(): Worlds that declare experimentalStartHookAdmission (event-first or queue-first) reserve the hook token atomically with run admission. Duplicate starts throw HookConflictError; queue-first Worlds throw the new WorkflowStartError (runId/stage/retryable) when a run was queued but admission could not be confirmed. Turbo mode is disabled for start-hook runs and a queued run that lost its claim acknowledges without running user code, gated by the experimentalStartHookLoserAck capability. world-vercel's v4 wire routing carries the new run_created / resilient-start eventData field (its compile-time wire-contract guard requires schema fields to be routed in the same change); the Vercel admission behavior itself, and the local/postgres implementations, land in the stacked follow-ups.
41bdb5a to
8438b93
Compare
Stack 1/4 · this PR → #2763 → #2764 → #2765 · Replaces the monolithic #2684
Adds the experimental
experimentalStartHookoption tostart()(refs #2376, gaps 1 and 2): Worlds that declareexperimentalStartHookAdmissionreserve the hook token atomically with run admission, so duplicate starts are rejected before any duplicate workflow code can run.What's in this PR
start()option + validation, and both admission orchestrations:run_created+ claim in one transaction) → queue; queue failure cancels the run, which releases the unmaterialized claim so retry can reuse the token.WorkflowStartError(runId/stage/queued/retryable) since the queued run may still execute.HookConflictErrorpasses through.experimentalStartHookLoserAckcapability (cutoff5.0.0-beta.27).@workflow/world:World.experimentalStartHookAdmissiondeclaration,ExperimentalStartHookschema/type onrun_created/ resilient-startrun_started/ queuerunInput(with a compile-time guard keeping the zod/v4 queue copy in sync).WorkflowStartErrorserialization end-to-end (core reducers/revivers, web-shared + CLI hydration).start()API notes,WorkflowStartErrorreference page.No World in this PR implements admission yet — using the option against an unsupporting World throws a clear error. Implementations land in the stacked follow-ups.
Docs Preview
Preview links will resolve once the docs deployment builds for this branch:
/v5/docs/foundations/idempotency#atomic-start-hook-idempotency,/v5/docs/api-reference/workflow-api/start,/v5/docs/api-reference/workflow-errors/workflow-start-error.