How runs match new code
On each call, your workflow runs from its first line, and each step looks for its saved result by type and name, in the order your code reaches it. So what matters is the name of each step, not where it sits in your code:- A step that keeps its name returns its saved result, even if you moved it.
- A step with a new name runs as a new step, even where an old one used to be.
- A saved step your code no longer reaches is ignored.
Changes to runs in progress
Adding a step is often what you want, like an email that every run in progress should still send. When it isn’t, branch on a version.
Version branching
When a change must only apply to new runs, branch on a version saved in the run’s first step. Add the step when you first write the workflow, returning1. When a change comes, return the next number and branch on it:
nelkap/workflows/onboard-user.ts
1, so they keep the old path. New runs save 2 and take the new one.
Rename or remove a workflow
A workflow’s name is how Nelkap tells your app which code to run. Renaming a workflow counts as removing the old name and adding a new one. Removing a workflow cancels its runs that haven’t started yet, and those sleeping or waiting. See Add and remove workflows. To retire a workflow without cutting its runs short:1
Stop new runs
Remove its events and its schedule, and stop starting it from your code.
2
Let the last runs end
Keep it registered, and filter your runs by the workflow until none is in progress.
3
Remove it
Remove it from
registerWorkflows, and deploy.