elsa-core/test/unit/Elsa.Workflows.Runtime.UnitTests
Sipke Schoorstra f9580e7472
fix(runtime): let a trigger index payloads under per-payload stimulus names (#7950)
* fix(runtime): let a trigger index payloads under per-payload stimulus names

TriggerIndexingContext.TriggerName is a single field read once after all
payloads have been collected, so one ITrigger could only ever register its
payloads under one stimulus name. An implementation that assigned the name
more than once - which the stimulus extension methods do as a side effect -
had the last write applied to every row, and since Hash derives from the same
name, the earlier payloads were stored under a hash no publisher computes.

Adds an additive, opt-in path: a payload returned from GetTriggerPayloadsAsync
may be wrapped in NamedTriggerPayload, which carries the stimulus name for that
payload alone. The indexer takes name and payload from the same source, so
Hash always matches the Name stored beside it, and the wrapper is unwrapped
before storage so payload consumers (validators, the trigger diff comparer,
the scheduler) see the payload the trigger produced.

TriggerName keeps its existing meaning as the default for payloads that do not
carry their own, so every existing ITrigger indexes identically: same Name,
same Hash, same Payload, same row count. The empty-payload placeholder row is
left alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(runtime): refuse a nested trigger payload wrapper

NamedTriggerPayload documented that its Payload is never itself a
wrapper, but nothing enforced it. Reject a NamedTriggerPayload whose
payload is another NamedTriggerPayload at construction time, matching
the existing guard against a blank name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 23:43:59 +02: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(runtime): let a trigger index payloads under per-payload stimulus names (#7950) 2026-08-17 23:43:59 +02:00
Elsa.Workflows.Runtime.UnitTests.csproj [codex] Validate distributed runtime lock provider (#7515) 2026-05-21 23:29:14 +02:00