elsa-workflows / elsa-workflows/elsa-core

Preserve Workflow Definition Snapshot in Workflow Instances to Ensure Execution Consistency

Open
#6,627 1 comment 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Enhancement Request

### Enhancement Overview
When executing a workflow definition, the resulting workflow instance reflects live changes made to the workflow definition, even after execution. For example, if a workflow definition initially has 3 activities and a workflow instance is created from it, then later a 4th activity is added to the definition, the previously created instance (which should remain immutable) also reflects the 4th activity. This results in inconsistencies, as the workflow instance does not preserve the graph it originally executed.

### Proposed Enhancement
**Describe the enhancement you'd like**
Workflow instances should retain a snapshot of the workflow definition graph at the time of execution. Once a workflow instance is created and execution has begun (or completed), any subsequent modifications to the definition should not impact existing instances.

We also need to consider that when using ScheduleChildActivity, the workflow execution context should resolve and execute based on the persisted graph of the workflow instance, not the latest definition. This would guarantee that child workflows maintain logical consistency and behave as expected even if the parent definition has changed.

### Solutions
Replicate column StringData from the workflow definition table to the workflow instance when executing the workflow
The input, output, and variable also need to be replicated.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how workflow definitions and workflow instances are persisted and how ScheduleChildActivity resolves its execution graph. Review the StringData, input, output, and variable data mentioned in the issue. Done means an instance retains the definition graph and related data from execution time, and later definition changes do not affect it or its child workflows.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.