elsa-core/src/modules/Elsa.Alterations
Rostislav Statko 54c8fda65f
fix(alterations): preserve tenant context for background alteration jobs (#7962)
* Fix tenant context propagation for alteration jobs

Capture the current tenant when dispatching a background alteration job
and restore it while executing the queued callback.

Add regression coverage verifying that the dispatch-time tenant is used
and the worker's previous tenant context is restored.

Fixes #7961

* test(alterations): cover tenant restore on failure and concurrent tenant isolation

Add coverage for the spec lines that were previously untested: the
worker's tenant context is restored after execution even when the
job runner throws, and concurrent jobs dispatched under different
tenants do not exchange tenant context. Extract the shared service
provider / job queue / recording runner arrange logic into
constructor-initialized fields so the three tests stay DRY.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test(alterations): cover default-tenant dispatch and share dispatcher test setup

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 20:07:36 -07:00
..
Activities Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
AlterationHandlers Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
AlterationTypes Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Bookmarks Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Constants Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Endpoints feat(auth)!: structured authorization model, phases 1-6 (#7980) 2026-08-24 23:44:55 +02:00
Extensions Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Features Refactor: Overhauls workflow JSON type serialization (#7549) 2026-05-31 11:09:39 +02:00
Handlers Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Middleware/Workflows Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Permissions feat(auth)!: structured authorization model, phases 1-6 (#7980) 2026-08-24 23:44:55 +02:00
Services fix(alterations): preserve tenant context for background alteration jobs (#7962) 2026-09-06 20:07:36 -07:00
ShellFeatures Remove PackageManifestCategories and update feature categories to inline strings 2026-06-08 09:48:55 +02:00
Workflows Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Elsa.Alterations.csproj Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00
Elsa.Alterations.csproj.DotSettings Restore EF Core persistence layer (#6931) 2025-09-27 20:39:18 +02:00