* Introduce `IWorkflowResumer` and `ActivityInputEvaluatorContext`, refactor endpoint handling, extend logging, and improve bookmark queue processing.
* Remove deprecated WorkflowContexts module and optimize project.
Deleted the Elsa.Studio.WorkflowContexts module and references from solution files. Corrected minor errors in remaining code and updated project configurations to align with the new structure.```
* Update GitHub workflows to track `develop/3.6.0` branch instead of `patch/3.5.1`.
* Fix inconsistent formatting in `InputDescriptor` constructor and properties.
* Add XML documentation for `DictionaryValueEvaluator` in `UIHints/Dictionary` module
* Refactor `DictionaryValueEvaluator` to improve readability and simplify dictionary evaluation logic.
* Parse `VariableTestValues` more robustly, leveraging `ExpandoObject` and type conversion logic.
* Clean up unused imports in `JavaScriptAndNetTypeTest`.
* Exclude blacklisted types (`string`, `object`, `Array`, `DateTime`) from workflow variable registration logic.
* Add integration tests for JavaScript evaluation and update type blacklist in `ConfigureEngineWithVariableTypes`
* Disable central package transitive pinning and update Elsa Studio version to `3.5.0`.
* Update Microsoft version to 9.0.8 in Directory.Packages.props
* Enable central package transitive pinning in `Directory.Packages.props`.
* Refactor `ObjectConverter` to improve readability and add backward-compatible default value handling in non-strict mode.
* Add `StrictMode` option to `ObjectConverterOptions` and update related tests
Introduced a `StrictMode` option to `ObjectConverterOptions` to control strict type conversion behavior. Updated the `ObjectConverter` logic to utilize this new option and refactored unit tests to include `ObjectConverterOptions` where necessary, ensuring comprehensive test coverage for strict and non-strict mode scenarios.
* Fix ObjectConverter default value handling and update unit tests
Standardize usage of `targetType` for default values in `ObjectConverter`. Refactor and consolidate unit tests to improve coverage and clarity, addressing various conversion and exception scenarios.
* Introduce `TenantDeleted` event to handle tenant cleanup
Added a `TenantDeleted` event to differentiate between tenant deactivation and deletion. Updated event handlers and services to support unregistering resources only during tenant deletion, ensuring clearer separation of responsibilities. Included ADR documentation for the new event.
* Remove unnecessary blank line in tenant deactivation logic
- Updated `Directory.Packages.props` with new package versions, including `ElsaStudioVersion`, `MicrosoftVersion`, and others.
- Changed `System.Formats.Asn1` version in `_build.csproj`.
- Re-factored `Endpoint.cs` to use new `Send` methods for updated FastEndpoints packages.
* Fix `CancellationToken` usage in `BackgroundCommandSenderHostedService`
Corrected the `CancellationToken` parameter to use `commandContext.CancellationToken` instead of the method's cancellation token, ensuring proper propagation and handling within the command sender.
Fixes#6449
* Refactor notifications system to use `NotificationContext` across channels and middleware
* Update src/common/Elsa.Mediator/Extensions/HandlerExtensions.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Simplify `InvokeAsync` method call by replacing braces with brackets in argument array.
* Refactor `NotificationContext` usage in mediator strategies and handler extensions
Replaced direct references to `Notification` and `CancellationToken` with `NotificationContext` across mediator strategies to align with updated context structure. Simplified handler invocations by passing `CommandContext` and `NotificationContext` where applicable.
* Refactor notification extraction in publishing strategies
Standardize notification retrieval by introducing `notificationContext.Notification` in `SequentialProcessingStrategy` and `ParallelProcessingStrategy` for improved clarity and consistency.
* Refactor hosted services to improve worker channel management and cancellation handling
Implemented better round-robin distribution and added linked cancellation token sources in `BackgroundCommandSender`, `JobRunner`, and `BackgroundEventPublisher` hosted services. Enhanced logging and comments for clarity.
* Update src/common/Elsa.Mediator/HostedServices/BackgroundCommandSenderHostedService.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Introduce `MigrationOptions` for configurable EF Core migration execution
Added `MigrationOptions` to control migration execution on a per-DbContext basis. Updated `RunMigrationsStartupTask` to respect these options, and refactored configurations in `PersistenceFeatureBase`.
This fixes an issue where the `RunMigrations` setting is not properly propagated to dependency features.
Fixes#6912
* Propagate `DbContextOptionsBuilder`, `UseContextPooling`, and `RunMigrations` settings to dependency features in `WorkflowManagementPersistenceFeature`.
* Update src/modules/Elsa.EntityFrameworkCore.Common/RunMigrationsStartupTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Frans van Ek <frans@fransvanek.nl>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Document architecture decision to capture `ActivityExecutionContext` snapshots at execution time. Updated TOC and dependency graph to reference the new ADR.
Replaced `CaptureActivityExecutionRecordMiddleware` with a notification-based approach using `ActivityCompleted` and `CaptureActivityExecutionState`. Removed obsolete middleware setup and extensions for better maintainability.
Fixed code indentation in WorkflowStateExtractor, adjusted output handling in LocalWorkflowClient, and replaced project references in Elsa.Api and Elsa.Http. Reactivated JavaScript engine configuration in Elsa.Server.Web for enhanced script execution capabilities.
Replaced `CaptureActivityExecutionRecordMiddleware` with a notification-based approach using `ActivityCompleted` and `CaptureActivityExecutionState`. Removed obsolete middleware setup and extensions for better maintainability.
Refactor the extension method to merge existing serialized snapshots with updated activity execution properties, ensuring the latest context state is retained without overwriting prior data.
* Add cancellation handling for executing scheduled tasks
Enhanced `ScheduledRecurringTask`, `ScheduledCronTask`, and `ScheduledSpecificInstantTask` to properly handle cancellation scenarios when tasks are executing. Introduced `_executing` and `_cancellationRequested` flags to ensure clean cancellation processes.
* Refactor `ScheduledRecurringTask` to improve readability and fix formatting issues.
* Add `SemaphoreSlim` for concurrent task execution control in scheduled tasks
Introduce `SemaphoreSlim` to manage and safeguard concurrent executions in `ScheduledRecurringTask`, `ScheduledCronTask`, and `ScheduledSpecificInstantTask`. Enhances thread safety and prevents overlapping executions. Added exception handling and proper semaphore release to ensure robustness.
* Add ILogger to scheduled tasks and improve error logging
Integrated `ILogger` into `ScheduledRecurringTask` to enhance logging capabilities and replaced the generic comment-based error handling with proper logging for better traceability. Cleaned up and formatted `ScheduledCronTask` for improved code readability.
* Dispose of semaphore fields in scheduled task classes to ensure proper resource cleanup.
* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledRecurringTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Set `_executing` to `false` in task `finally` blocks to ensure state reset after execution.
* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledSpecificInstantTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Remove redundant `_executing` assignment after `SendAsync` in scheduled task classes.
* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledRecurringTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledRecurringTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledCronTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledSpecificInstantTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update semaphore logic to prevent blocked tasks when cancellation is requested
Refactored `_executionSemaphore.WaitAsync` usage in `ScheduledRecurringTask`, `ScheduledCronTask`, and `ScheduledSpecificInstantTask` to use non-blocking semaphore acquisition with cancellation token support. This ensures graceful handling of pending tasks during cancellation scenarios.
* Refactor delay condition checks to use `TimeSpan.Zero` for improved readability and precision.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Deleted unused metadata properties to simplify `ActivityExecutionRecordSnapshot`. Updated `GetOrMapCapturedActivityExecutionRecordAsync` to maintain serialized snapshots when mapping, ensuring consistency in activity execution records.
Revised method parameters, simplified object initializations in `DefaultWorkflowInstanceVariableReader`, and enhanced hierarchy reconstruction in `WorkflowStateExtractor` with logging for missing parent contexts.
Updates the Elsa Studio version to the latest preview.
This ensures that the project uses the most recent features and fixes available in the Elsa Studio development environment.
Eliminated the TestRun endpoint and related functionality from the API. Enhanced activity execution by leveraging pre-serialized snapshots and refactored mapping operations to use asynchronous methods. Also updated package versions to align with the latest dependencies.