Versioning, patched() and hotfixes
Every run keeps its own code
Each push creates a new version of every workflow whose definition changed, and a version that carries code stores the exact bundle it was built from. A run always continues on the version, and the bundle, it started with. Deploying new code therefore never breaks a run that is already in flight: old runs finish on old code, new runs start on the active version.
Because of this, a version that has a code bundle cannot be edited in place. Saving changes always creates a new version.
The usual version tools apply: Activate this version, environments and promotions, the version diff, and Git push. For a version with code, the version diff also shows changed exports, interface changes, the build id and a source diff.
Hotfixes
Sometimes runs that are already in flight need the fix: a bug that makes a workflow task fail, or a step that must change for everyone. A hotfix replaces the code of an existing version:
fluidgrids push --hotfix v3 --replay-sample 20
- The CLI replays the 20 most recent durable runs of
v3against your new code locally. - The service replays up to 50 in-flight and 50 recently completed runs of that version against the new code.
- If every replay matches, the version's code is replaced (REPLACED) and waiting runs pick it up at their next workflow task. If any replay diverges, nothing is replaced (REJECTED) and the runs that would have broken are listed.
A hotfix may change the code only: the graph, the exported functions and their interfaces must stay the same. Hotfixes need permission to publish the workflow, are recorded in the version's history, and are not allowed on versions bound for production when the workspace requires production changes to go through promotions.
Making a change replay-safe with patched()
A replay diverges when new code makes different calls than the old code did at the same point in a history. ctx.patched lets old and new histories take different paths through the same code:
if (ctx.patched('add-fraud-check')) {
await ctx.run(n.sift.score, { args: { orderId: order.id } }); // new behaviour
}
await ctx.run(n.stripe.createCharge, { args: { amount: order.amountCents } });
- On a new run,
ctx.patched('add-fraud-check')records a marker and returnstrue. - On a replay of a run that started before the patch, there is no marker at that point, so it returns
falseand the run keeps its original path.
Once no run that predates the patch is still open, replace the call with ctx.deprecatePatch('add-fraud-check') and keep only the new branch. In a later version, remove the deprecation as well.
What a version contains
| Part | Identified by |
|---|---|
| The definition | Its IR hash |
| The code bundle (one JavaScript module built from the whole project) | Its build id, the SHA-256 of the bundle |
| The source archive (the project files, lockfile and vendored dependencies) | Its source hash |
One push builds the project once, so every workflow it creates a version for shares the same bundle. Pushing unchanged code again uploads nothing.