elsa-core/test/unit
Sipke Schoorstra 33181ae304
Some checks failed
Packages / Test unit/integration with coverage (push) Has been cancelled
Packages / Test component with coverage (push) Has been cancelled
Packages / Generate coverage report (push) Has been cancelled
Packages / Build packages (push) Has been cancelled
Packages / Publish to feedz.io (push) Has been cancelled
Packages / Publish release to nuget.org (push) Has been cancelled
Packages / Deploy coverage to GitHub Pages (push) Has been cancelled
fix: persist Interrupted after drain force-cancel commits Cancelled (#8069)
* fix: persist Interrupted after drain force-cancel commits Cancelled

Deadline-breach force-cancel makes the runner persist Finished/Cancelled.
#8059 then skipped every Finished row, so Interrupted never landed and
Packages CI failed DeadlineBreachPersistsInterrupted. Treat Cancelled as
interruptible and promote it to Running+Interrupted so recovery can
requeue it, while still refusing naturally completed rows.

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

* fix: do not promote user cancellations to Interrupted on drain

Gate Cancelled→Interrupted on instances that were not already Cancelled
when drain snapshotted live cycles. Deadline-breach force-cancel still
promotes the runner's Finished/Cancelled commit; ordinary client
cancellations stay Cancelled and are not requeued.

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

* fix: confine Cancelled→Interrupted promote to Drain

Restore TryMarkInterruptedAsync to refuse every Finished row by default
(#8052). Drain PersistInterrupted alone may pass allowFinishedCancelled
when the instance is Finished/Cancelled and in this drain's
force-cancelled set. User cancellations stay cancelled.

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

* docs: document TryMarkInterruptedAsync parameters

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

* fix: bound pre-cancel snapshot so stalled Find cannot block Cancel

WaitAsync the instance-store snapshot under a short shutdown budget so
a hang or ignored cancellation token cannot delay handle.Cancel().
Unknown pre-state is not treated as already Cancelled; observed
user cancellations are still preserved.

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

* test: restore Fact on terminal-race drain persist skip

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

* fix: exclude unknown snapshot rows from drain-induced promote

A timed-out or failed pre-cancel Find no longer joins drainInduced.
Only a successful read that is clearly not already Cancelled may be
promoted. Cancel still proceeds without waiting on store latency.

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

* fix: give each pre-cancel snapshot its own timeout

A shared 250ms overallSnapshotCts let a stalled first Find cancel later
Finds before they started, so those instances were excluded from
drainInduced and never persisted as Interrupted after Phase A Cancel.

Each Find now uses an independent CTS linked only to the host token.

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

* fix: snapshot live instances concurrently before Phase A Cancel

Independent per-find 250ms budgets kept recovery, but a serial foreach
still delayed every handle.Cancel by up to N×250ms. Run those bounded
Finds with Task.WhenAll so Cancel waits one timeout window, not N.

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

* fix: give each parallel snapshot Find its own DI scope

Task.WhenAll was sharing one scoped IWorkflowInstanceStore. EF DbContext
is not thread-safe; Phase C already persists sequentially for that reason.
Each snapshot task now CreateScope()s its own store and disposes it.

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-09-12 14:23:47 -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 Add Weaver grounding tools 2026-06-08 15:40:10 +02:00
Elsa.AI.Persistence.EFCore.UnitTests Resolve vulnerable transitive persistence packages 2026-06-22 00:45:06 +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 Resolve vulnerable transitive persistence packages 2026-06-22 00:45:06 +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: persist Interrupted after drain force-cancel commits Cancelled (#8069) 2026-09-12 14:23:47 -07:00
Elsa.Workflows.Runtime.UnitTests fix: persist Interrupted after drain force-cancel commits Cancelled (#8069) 2026-09-12 14:23:47 -07:00
Directory.Build.props Add coverage enforcement for test projects (#6950) 2025-10-07 19:59:53 +02:00