Context
@stackra/workflow ships a changed graph as a new class with the same key and Workflow({ version: n }); a run
resumes on the class of the version it started on, so the older class stays deployed until its runs end. Two classes
then share one key, and 0294 rule R2 names a class from its file, so two files cannot both be <name>.workflow.ts.
Nothing said how the older class is named, how gen derives its key, or when it may be deleted.
Decision
- The current version keeps the plain name.
<name>.workflow.tsexports<Name>Workflow, holds the highest version, and derives its key as any workflow does. - An older version gets a version suffix. A retained version lives beside it as
<name>-v<n>.workflow.ts, exporting<Name>V<n>Workflow, withWorkflow({ key, version: n }). It writes the key explicitly, the same key the current class derives, because its own file name would derive another. - Gen checks the set. For one key: versions are distinct whole numbers; the plain-named class holds the highest;
a
-v<n>class declares exactly versionn; an explicit key matches a plain-named class’s derived key. The manifest locks each key with its deployed versions. - New runs start on the highest version. Only resumes use an older class.
- Deleting an older version. An older class may be removed only when no run pinned to it is open; the workflow
journal answers that (
workflow.runsby key, version and status), andstackra runway deployrefuses a release that drops a version with open runs. - Studio automations are not classes. An automation document carries its version and the run keeps its document (0245 decision 8), so this naming applies to coded workflows only.
- Values. None; this is naming and mechanism. Which automations a product ships is seed data
(
workflow-templaterecords).
Consequences
- A graph change is a copy of the old file to
-v<n>and an edit of the plain file, a pattern a codemod can do. - An old class’s lifetime follows its runs, not a guess.
Enforcement
planned — gen (STA-340):workflow_version_duplicate, workflow_version_not_highest, workflow_version_suffix_mismatch,
workflow_key_mismatch; runway’s deploy check against the journal.
Supersedes and sources
Supersedes: none. Amends, when accepted: 0152 decision 2 and 0294 decision 2 (a version suffix in a workflow file stem). Sources:notes/handover/build-wave10-2026-10-25.md (rules and workflow builder, question 6);
packages/runtime/workflow/README.md (versions).