elsa-core/test/unit/Elsa.Workflows.Runtime.UnitTests
Sipke Schoorstra 5ab383ce86
fix: stop requeuing Finished+Interrupted workflow instances (#8052)
* fix: stop requeuing Finished+Interrupted workflow instances

InterruptedRecoveryScanner now requires Status=Running, matching the
sibling crash-recovery task. DrainOrchestrator skips already-terminal
instances so a runner-clobber race cannot stamp Interrupted onto a
Finished row. Fixes #8052.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* fix: conditionally mark Interrupted so drain cannot clobber Finished

PersistInterruptedAsync no longer SaveAsync-es the Find snapshot. The
store now applies Interrupted only when Status is still non-terminal
(EF: ExecuteUpdate WHERE Status != Finished; memory: mutate the live
row). A runner that commits Finished between read and write keeps its
terminal state, so startup recovery cannot requeue completed work.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* test: disambiguate NSubstitute Returns for TryMarkInterruptedAsync

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* fix: make in-memory Interrupted mark atomic against completion

Lock the memory-store check and mutations together, then abort if Status
became Finished in-place so drain cannot record Interrupted on a
completed instance.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* fix: share memory-store lock between Interrupted mark and Save

TryMarkInterruptedAsync now serializes with Save/Update/SaveMany so a
runner's terminal persist cannot land between the non-terminal check
and the Interrupted mutations. A finishing Save therefore cannot leave
Finished+Interrupted.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-09-11 23:05:43 -07:00
..
Comparers Refactor: Overhauls workflow JSON type serialization (#7549) 2026-05-31 11:09:39 +02:00
Distributed [codex] Scope console logs to workflow instances (#7535) 2026-05-25 11:49:51 +02:00
Extensions [codex] Fix console log metadata and type resolution (#7542) 2026-05-30 22:52:01 +02:00
Features fix: register built-in activation strategy serialization aliases (#8049) 2026-09-11 18:09:51 -07:00
Handlers Add workflow dispatch transactional outbox (#7517) 2026-05-22 00:13:16 +02:00
HealthChecks Address health check review feedback 2026-05-21 02:13:19 +02:00
Models Add workflow dispatch transactional outbox (#7517) 2026-05-22 00:13:16 +02:00
Options Graceful shutdown for the workflow runtime (drain, pause, recover) (#7424) 2026-05-02 19:27:08 +02:00
Quiescence fix: stop requeuing Finished+Interrupted workflow instances (#8052) 2026-09-11 23:05:43 -07:00
Recovery fix: stop requeuing Finished+Interrupted workflow instances (#8052) 2026-09-11 23:05:43 -07:00
Serialization fix: register built-in activation strategy serialization aliases (#8049) 2026-09-11 18:09:51 -07:00
Services Merge branch 'codex/auth-refinements' into release/3.8.0 2026-08-02 22:39:54 +02:00
Elsa.Workflows.Runtime.UnitTests.csproj [codex] Validate distributed runtime lock provider (#7515) 2026-05-21 23:29:14 +02:00