docs(cookbook): add Upgrading Workflows guide#1874
docs(cookbook): add Upgrading Workflows guide#1874karthikscale3 wants to merge 95 commits intomainfrom
Conversation
New /cookbook/advanced/upgrading-workflows page covering long-running workflows that respawn themselves on the latest deployment instead of migrating in-flight runs. Documents two methods: - Method 1: spawn the successor on every iteration via start() with deploymentId: "latest" wrapped in a "use step" helper. - Method 2: a dedicated upgradeHook raced against the work hook so upgrades are triggered explicitly via a separate endpoint — ideal for rolling out a fix to a fleet of in-flight runs after a deploy. Wires the page into cookbook-tree.ts, advanced/meta.json, and the cookbook index landing page. Made-with: Cursor
|
🧪 E2E Test Results✅ All tests passed Summary
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
📊 Benchmark Results
workflow with no steps💻 Local Development
workflow with 1 step💻 Local Development
workflow with 10 sequential steps💻 Local Development
workflow with 25 sequential steps💻 Local Development
workflow with 50 sequential steps💻 Local Development
Promise.all with 10 concurrent steps💻 Local Development
Promise.all with 25 concurrent steps💻 Local Development
Promise.all with 50 concurrent steps💻 Local Development
Promise.race with 10 concurrent steps💻 Local Development
Promise.race with 25 concurrent steps💻 Local Development
Promise.race with 50 concurrent steps💻 Local Development
workflow with 10 sequential data payload steps (10KB)💻 Local Development
workflow with 25 sequential data payload steps (10KB)💻 Local Development
workflow with 50 sequential data payload steps (10KB)💻 Local Development
workflow with 10 concurrent data payload steps (10KB)💻 Local Development
workflow with 25 concurrent data payload steps (10KB)💻 Local Development
workflow with 50 concurrent data payload steps (10KB)💻 Local Development
Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
stream pipeline with 5 transform steps (1MB)💻 Local Development
10 parallel streams (1MB each)💻 Local Development
fan-out fan-in 10 streams (1MB each)💻 Local Development
SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
❌ Some benchmark jobs failed:
Check the workflow run for details. |
Summary
Adds a new advanced cookbook page —
/cookbook/advanced/upgrading-workflows— for handling long-running workflows that need to pick up shipped fixes without migrating in-flight runs.The guide is built around a single principle: identify a clean upgrade point in the workflow (a moment where state can be checkpointed and a new run started fresh) and call
start()withdeploymentId: "latest"to hand off to whatever deployment is current.It documents two methods:
upgradeHook. A separate endpoint resumes the upgrade hook (e.g. from a control plane after a deploy), at which point the workflow checkpoints state and respawns on the latest deployment. Best when iterations are infrequent/expensive or when "upgrade" should be an explicit operation that can be fanned out across a fleet.Both methods share the same "How it works" section (the
deploymentId: "latest"knob,start()from a step, state-via-argument, per-run hook tokens) and Caveats (backward-compat constraints, stable workflow identity, hook-not-found gap between iterations, plus a Method-2-specific note on tracking active runs).Files changed
docs/content/docs/cookbook/advanced/upgrading-workflows.mdx— new guidedocs/content/docs/cookbook/advanced/meta.json— adds the slug to the Advanced sectiondocs/lib/cookbook-tree.ts— adds the page to the cookbook sidebar (slug → category map andrecipesentry)docs/content/docs/cookbook/index.mdx— adds a link from the cookbook landing pageTest plan
pnpm dev(docs) and visit/cookbook/advanced/upgrading-workflows— page renders with both Method 1 and Method 2 sections, anchor links work/cookbook) lists "Upgrading Workflows" under AdvancedMade with Cursor