From 37b1a453169201e577ef6db0bfd0348b08070211 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sun, 13 Sep 2026 02:22:49 -0700 Subject: [PATCH] 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 * 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 --------- Co-authored-by: Cursor Agent