elsa-core/test/unit/Elsa.Workflows.Runtime.UnitTests
Sipke Schoorstra d2d3109024
fix(runtime): enforce MemoryTriggerStore logical uniqueness (#8098)
* fix(runtime): enforce MemoryTriggerStore logical uniqueness

MemoryTriggerStore upserted only by Id, so two records with different Ids
but the same (WorkflowDefinitionId, Hash, ActivityId, TenantId) were
accepted in memory and rejected under EF. Mirror EFCoreTriggerStore:
distinct-by-logical-key, skip already-present keys on ReplaceAsync,
reject Save* collisions, and stamp the current tenant when unset.

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

* fix(runtime): keep FindAsync first-match and use a structural trigger key

FindAsync must return the first matching trigger. SingleOrDefault threw
when a valid filter (for example WorkflowDefinitionId) matched several
distinct logical keys. Restore FirstOrDefault to match ITriggerStore and
EF. Represent the logical key as a record so fields that contain U+001F
cannot collide.

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-09-13 02:20:28 -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 Refactor: Overhauls workflow JSON type serialization (#7549) 2026-05-31 11:09:39 +02: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 Harden EF trigger persistence 2026-05-16 13:50:34 +02:00
Recovery Graceful shutdown for the workflow runtime (drain, pause, recover) (#7424) 2026-05-02 19:27:08 +02:00
Services fix(bpmn): let a process with only a plain start event publish (#8081) 2026-09-12 11:07:59 -07:00
Stores fix(runtime): enforce MemoryTriggerStore logical uniqueness (#8098) 2026-09-13 02:20:28 -07:00
Elsa.Workflows.Runtime.UnitTests.csproj [codex] Validate distributed runtime lock provider (#7515) 2026-05-21 23:29:14 +02:00