elsa-core/src/modules/Elsa.Workflows.Core
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
..
Abstractions
ActivationValidators
Activities feat(core): let a container withdraw work it scheduled but must not run (#7967) 2026-08-20 23:29:46 +02:00
Attributes Adds activity host registration support (#7172) 2025-12-27 20:52:52 +01:00
Behaviors [codex] Fix ForEach completion from nested flowchart (#7702) 2026-06-08 12:04:55 +02:00
Builders Add named WithVariable overload (#7701) 2026-06-08 10:42:59 +02:00
CommitStates Clarify commit strategy fallback behavior in documentation; update test method signature for consistency 2025-12-16 08:01:49 -05:00
Constants [codex] Harden C# expression host-code execution (#7519) 2026-05-21 00:50:25 +02:00
Contexts feat(core): let a container withdraw work it scheduled but must not run (#7967) 2026-08-20 23:29:46 +02:00
Contracts feat(core): let a container withdraw work it scheduled but must not run (#7967) 2026-08-20 23:29:46 +02:00
Enums Add output converter support at binding boundaries 2026-07-31 04:10:48 +02:00
Exceptions Add output converter support at binding boundaries 2026-07-31 04:10:48 +02:00
Expressions
Extensions feat(core): let a container withdraw work it scheduled but must not run (#7967) 2026-08-20 23:29:46 +02:00
Features Add output converter support at binding boundaries 2026-07-31 04:10:48 +02:00
Handlers
Helpers
IncidentStrategies
LogPersistence
Memory
Middleware fix(core): a throwing FaultSignal handler must not escape the middleware (#7924) 2026-08-12 05:34:19 +02:00
Models fix(runtime): let a trigger index payloads under per-payload stimulus names (#7950) 2026-08-17 23:43:59 +02:00
Notifications Graceful shutdown for the workflow runtime (drain, pause, recover) (#7424) 2026-05-02 19:27:08 +02:00
Options Adds activity execution call stack support (#7271) 2026-02-24 15:23:59 +01:00
Pipelines Refactors extension methods to instance methods (#7089) 2025-11-25 14:53:18 +01:00
PortResolvers
Serialization Merge release/3.8.0 into main 2026-08-14 11:59:35 +02:00
Services feat(core): let a container withdraw work it scheduled but must not run (#7967) 2026-08-20 23:29:46 +02:00
ShellFeatures Merge release/3.8.0 into main 2026-08-14 11:59:35 +02:00
Signals fix(core): a throwing FaultSignal handler must not escape the middleware (#7924) 2026-08-12 05:34:19 +02:00
State Harden output converter contracts 2026-07-31 13:29:01 +02:00
Telemetry Add OpenTelemetry workflow instrumentation (#7514) 2026-05-22 01:17:05 +02:00
UIHints
VariableStorageDrivers Update multitenancy logic and improve Result handling: (#7281) 2026-02-11 10:11:12 +01:00
Elsa.Workflows.Core.csproj Add output converter support at binding boundaries 2026-07-31 04:10:48 +02:00
Elsa.Workflows.Core.csproj.DotSettings
FodyWeavers.xml