elsa-core/test/integration/Elsa.Workflows.IntegrationTests/Scenarios
Sipke Schoorstra 74fc891350
feat(core): let a container withdraw work it scheduled but must not run (#7967)
A container that schedules a child and then decides the child must not run
had no way to withdraw it. `IActivityScheduler` exposed no removal operation,
and `CancelActivityAsync` no-opped on a context whose status was `Pending`,
so a container could tear a branch down and still have an activity from that
branch execute afterwards, side effects and all. Fixes #7943.

- `IActivityScheduler.RemoveWhere` removes work items and keeps the order the
  survivors would have been taken in; implemented in both the FIFO and LIFO
  schedulers.
- `CancelActivityAsync` (both the public extension and the internal one used
  when a container completes) cancels `Pending` contexts as well as running
  ones, and withdraws the work item that would have started the cancelled
  activity plus the items it had scheduled for children with no context yet.

Withdrawal is a real removal rather than a terminal status honoured at dequeue
time, because the scheduler is also read: `Flowchart.HasPendingWork` inspects
it to decide whether it may complete, and the work item list is extracted into
the persisted workflow state — a withdrawn-but-queued item would be persisted
and rehydrated with a fresh context after a suspend/resume.

`StateMachine` had hand-rolled the same operation to drop competing triggers by
clearing the scheduler and re-scheduling everything else; it now calls
`RemoveWhere`. `Elsa.Bpmn` no longer needs to refuse a teardown whose subtree
still has queued work, so `BpmnWorkTeardown` drops the `NotSupportedException`
and records the teardown reason on the torn-down activity's journal instead.

BREAKING: `IActivityScheduler` gains a member; external implementations must
add `RemoveWhere`.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 23:29:46 +02:00
..
ActivityNotificationsMiddleware Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
ActivityOutputs Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00
Blocking Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
BlockingAndBreaking Improves Fork activity and break signal handling (#7104) 2025-11-25 19:29:02 +01:00
BulkDispatchWithInput Fix BulkDispatchWorkflows sharing input dictionary across dispatches (#7284) 2026-04-15 14:20:44 +02:00
CanExecute Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
Composites Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
CompositesAndOutcomes Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
CompositesPassingData Add unit and integration tests for SetOutput activity 2025-10-22 23:43:51 +02:00
DefaultActivityCommitStrategy Refactor commit strategy resolution for improved clarity and efficiency; remove unused example files and add a new CommitTracker helper for testing. 2025-12-16 08:01:49 -05:00
DefaultWorkflowCommitStrategy Clarify commit strategy fallback behavior in documentation; update test method signature for consistency 2025-12-16 08:01:49 -05:00
DependencyWorkflows Add integration tests for WorkflowDefinitionActivity scenarios (#6999) 2025-10-21 15:37:10 +02:00
DependencyWorkflowsPublishing Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
ExplicitJoins Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
FaultSignals fix(core): a throwing FaultSignal handler must not escape the middleware (#7924) 2026-08-12 05:34:19 +02:00
FlowchartCompletion Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
FlowchartNextActivity Configures Flowchart Execution via DI (#7141) 2025-12-15 10:15:39 +01:00
HttpRequestWithLiquid Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
ImportAndExecute Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
ImportAndPublish Add opt-out for publish-on-validation-error failure (3.8) 2026-06-19 23:31:38 +02:00
Incidents Addresses warnings and enforces null safety (#7051) 2025-11-12 16:56:31 +01:00
JavaScriptFunctions Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
JavaScriptListsAndArrays Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
JavaScriptNativeVariables Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
JoinBehaviors Configures Flowchart Execution via DI (#7141) 2025-12-15 10:15:39 +01:00
JsonObjectSerialization Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
JsonObjectToObjectRemainsJsonObject Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
ParentChildCompletion Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
ParentChildInputs Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
ParentChildOutputMapping Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
ProjectedEnumerableToArray Add integration tests for enumerables with projection to arrays (#7290) 2026-02-16 14:09:51 +01:00
RunAsynchronousActivityOutput [codex] Validate distributed runtime lock provider (#7515) 2026-05-21 23:29:14 +02:00
Serialization Addresses warnings and enforces null safety (#7051) 2025-11-12 16:56:31 +01:00
SetGetVariables Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00
SetGetVariablesArray Added IEnumerableTypeConverter (#7020) 2025-11-12 11:07:33 +01:00
SetGetVariablesFromActivities Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00
SmokeTests Adds integration tests for core activities (#7100) 2025-11-24 14:43:42 +01:00
TriggerIndexing fix(runtime): let a trigger index payloads under per-payload stimulus names (#7950) 2026-08-17 23:43:59 +02:00
WithdrawingScheduledWork feat(core): let a container withdraw work it scheduled but must not run (#7967) 2026-08-20 23:29:46 +02:00
WorkflowCancellation Improved support for named workflow instances 2025-03-02 11:17:18 +01:00
WorkflowDefinitionActivities Add integration tests for WorkflowDefinitionActivity scenarios (#6999) 2025-10-21 15:37:10 +02:00
WorkflowDefinitionStorePopulation Fix Multitenancy Support and Normalize Tenant ID Handling (#7217) 2026-01-30 19:54:13 +01:00
WorkflowDispatchNotifications Replace flaky Task.Delay with TaskCompletionSource for deterministic test synchronization 2025-12-24 23:47:55 +00:00
WorkflowInstanceName Improved support for named workflow instances 2025-03-02 11:17:18 +01:00
WorkflowOutputMapping Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
WorkflowResults Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00