elsa-core/test/unit
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
..
Elsa.Activities.UnitTests Preserve StateMachine composite transition continuations 2026-08-31 04:51:34 +02:00
Elsa.AI.Abstractions.UnitTests Implement Weaver AI Copilot core (#7523) 2026-06-04 11:35:44 +02:00
Elsa.AI.Copilot.UnitTests Use Copilot SDK for Weaver agent loop (#7700) 2026-06-08 00:35:47 +02:00
Elsa.AI.Host.UnitTests Increase AI host test coverage 2026-06-27 04:04:39 +02:00
Elsa.AI.Persistence.EFCore.UnitTests chore: apply safe dependency upgrades (#7896) 2026-07-26 21:42:27 +02:00
Elsa.Common.UnitTests refactor: update package reference configuration 2026-08-03 13:15:18 +02:00
Elsa.Dashboard.Api.UnitTests [codex] Extract dashboard contributors into companion modules (#7692) 2026-06-05 14:30:52 +02:00
Elsa.Diagnostics.ConsoleLogs.UnitTests [codex] Fix diagnostics live feed regressions (#7548) 2026-05-31 09:40:02 +02:00
Elsa.Diagnostics.OpenTelemetry.UnitTests [codex] Fix console log metadata and type resolution (#7542) 2026-05-30 22:52:01 +02:00
Elsa.Diagnostics.StructuredLogs.Persistence.Relational.UnitTests Fix structured log diagnostics registration 2026-05-17 08:42:23 +02:00
Elsa.Diagnostics.StructuredLogs.UnitTests Add structured log provider tests (#7449) 2026-05-16 09:23:31 +02:00
Elsa.Expressions.UnitTests [codex] Harden C# expression host-code execution (#7519) 2026-05-21 00:50:25 +02:00
Elsa.ExternalAuthentication.UnitTests Harden external identity race compensation 2026-08-02 23:19:49 +02:00
Elsa.Hosting.Management.UnitTests feat: introduce HTTP webhooks module 2026-08-03 02:08:15 +02:00
Elsa.Http.UnitTests Fix scheduling startup backlog catch-up 2026-06-21 19:43:09 +02:00
Elsa.Identity.UnitTests Harden external identity race compensation 2026-08-02 23:19:49 +02:00
Elsa.Mediator.UnitTests [codex] Fix diagnostics live feed regressions (#7548) 2026-05-31 09:40:02 +02:00
Elsa.Persistence.VNext.UnitTests chore: apply safe dependency upgrades (#7896) 2026-07-26 21:42:27 +02:00
Elsa.Platform.Integration.UnitTests Add Platform integration 2026-06-18 18:27:27 +02:00
Elsa.Resilience.Core.UnitTests Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
Elsa.SasTokens.UnitTests [codex] Harden initial security remediation slice (#7495) 2026-05-22 00:45:47 +02:00
Elsa.Scheduling.UnitTests address greptile review feedback (greploop iteration 1) 2026-06-21 19:43:09 +02:00
Elsa.Secrets.UnitTests Implement secret update functionality, add related tests, and update project references. 2026-06-01 23:47:05 +02:00
Elsa.Shells.Api.Tests feat: introduce HTTP webhooks module 2026-08-03 02:08:15 +02:00
Elsa.Tenants.UnitTests fix: restore request services after tenant middleware exceptions 2026-07-30 09:54:00 +03:00
Elsa.Workflows.Api.UnitTests fix: register built-in activation strategy serialization aliases (#8049) 2026-09-11 18:09:51 -07:00
Elsa.Workflows.Core.UnitTests fix: register built-in activation strategy serialization aliases (#8049) 2026-09-11 18:09:51 -07:00
Elsa.Workflows.Management.UnitTests fix: stop requeuing Finished+Interrupted workflow instances (#8052) 2026-09-11 23:05:43 -07:00
Elsa.Workflows.Runtime.UnitTests fix: stop requeuing Finished+Interrupted workflow instances (#8052) 2026-09-11 23:05:43 -07:00
Directory.Build.props Add coverage enforcement for test projects (#6950) 2025-10-07 19:59:53 +02:00