doc/adr/0004-activity-execution-snapshots.md
Date: 2025-08-04
Status: Accepted
Today the ActivityExecutionContext is persisted only at commit points.
If an activity references a workflow variable that changes after it has run—but before the next commit—the value saved is the later value, not the one that existed when the activity executed.
As a result, the Workflow Instance Viewer shows misleading data: users expect to see the variable values at execution time, not at commit time.
Capture a snapshot of the ActivityExecutionContext immediately when an activity executes.
The snapshot must include:
The snapshot is created by serializing the ActivityExecutionRecord to JSON and storing it in the database.
The persistence layer will be updated to handle this new snapshot field, ensuring it is stored alongside the activity execution record.