Problem/Motivation
When a workflow definition has a bug (a wrong node setting, a bad
notification type or template reference, and so on), fixing it only helps
new instances. A running instance stays pinned to the immutable
version snapshot it started on, so the only way to pick up the fix today is to
restart the process from the beginning. For long-running or partly-completed
processes that is painful and sometimes not acceptable.
Proposed resolution
Add the ability to migrate a running instance onto a newer workflow version.
Because each instance pins an immutable version snapshot by revision id,
migration is a re-point plus a compatibility check, not a state rewrite.
A service method, for example
migrateInstance(instance, target_version, node_map = []):
- Collect the instance's live (parked and active) tokens and their node ids.
- Compatibility check: every live token's node must exist in the target
version, or be covered bynode_mapfor a renamed node. Otherwise
refuse and report the offending nodes. - Re-point the instance's definition version to the target, remapping token
node ids when a map is given. - Audit-log the migration through the existing auditable event.
Expose it as a drush command, a per-instance operation in the UI ("Upgrade to
latest version"), and optionally a bulk action ("migrate all running instances
of workflow X to version N").
Remaining tasks / edge cases
- Node id changes (renaming or removing a node a token currently sits on)
require an explicit mapping; that is the one thing the migration cannot guess. - New required variables the target version reads should be pre-seedable as
part of the migrate call. - Semantic changes to nodes a token has already passed are out of scope:
migration only affects the not-yet-reached part of the graph, which is exactly
the bug-fix sweet spot.
Issue fork orchestra-3607720
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedThe core "migrate a running instance to a newer version" capability already exists from #3604588 (the per-workflow bulk migrate, its version UI, and the
drush orchestra:migrate-versionscommand). This issue is scoped to the per-instance follow-up.MR !258 adds:
migrateInstance()on the version manager, sharing the validate and apply logic with the bulkmigrate().Comment #5
mably commented