elsa-core/src/modules/Elsa.Workflows.Runtime/Contracts
Sipke Schoorstra aee09bb06f
Improves workflow deletion and task scheduling (#7088)
* Refactor workflow instance deletion to use `IWorkflowRuntime` for enhanced coordination and separation of concerns.

* Remove `EnumerableTypeConverter` and update related usages for serialization.

- Deleted the `EnumerableTypeConverter` class and its JSON serialization logic.
- Removed associated type descriptor attribute in `DefaultFormattersFeature`.
- Updated `ObjectFormatter` to handle collection serialization directly with JSON.

* Remove `EnumerableTypeConverter` tests and consolidate serialization logic into `ObjectFormatter`.

- Deleted `EnumerableTypeConverterTests` as the related functionality was removed.
- Added comprehensive tests in `ObjectFormatterTests` to handle serialization of collections and arrays with JSON.

* Add integration tests for `TriggerIndexer` to handle workflows with failing materialization

- Introduced comprehensive test scenarios verifying `DeleteTriggersAsync` behavior when workflows fail to load or partially succeed.
- Enhanced error handling in `TriggerIndexer` to skip failed workflows while ensuring remaining workflows are processed.

* Add exception handling in `TriggerIndexer.DeleteTriggersAsync` and integration tests

- Enhanced `DeleteTriggersAsync` with exception handling to skip failed workflows while processing others.
- Logged warnings for failed workflows without halting execution.
- Added comprehensive integration tests to verify behavior across success, failure, and mixed scenarios.
- Refactored tests for improved clarity, maintainability, and consistency.

* Add exception handling for `ResumeWorkflowTask` to skip deleted workflow instances

- Enhanced `ResumeWorkflowTask.ExecuteAsync` to handle `WorkflowInstanceNotFoundException` gracefully when a scheduled workflow instance is missing.
- Logged warnings for skipped executions to improve observability.
- Ensured remaining workflows and scheduled tasks are processed seamlessly without disruption.

* Add thread safety to `LocalScheduler` to prevent race conditions during concurrent scheduling

- Introduced a `lock` object to synchronize access to internal dictionaries.
- Resolved `IndexOutOfRangeException` caused by concurrent modifications during startup.
- Ensured thread-safe operations in `ScheduleAsync`, `ClearScheduleAsync`, and related methods.
- Improved reliability and stability of scheduling under concurrent workloads.

* Improve exception handling, thread safety, and workflow instance deletion

- Added exception handling in `TriggerIndexer.DeleteTriggersAsync` to skip failed workflows while continuing processing.
- Enhanced `ResumeWorkflowTask` to handle missing workflow instances gracefully and log warnings.
- Introduced thread synchronization in `LocalScheduler` with `lock` to prevent concurrent access issues.
- Implemented and refactored tests to ensure behavior consistency and improve maintainability.
- Added component tests for workflow deletion scenarios, covering running, completed, and non-existent workflows.

* Add component tests for workflow instance deletion and refactor bulk delete logic

- Added comprehensive component tests for workflow instance deletion scenarios (running, completed, bulk, and non-existent instances).
- Refactored `BulkDelete` API to use `IWorkflowInstanceManager` for proper cleanup of related records (execution logs, activity executions, bookmarks).

* Add integration tests and fakes for `TriggerIndexer` to verify behavior with failing and successful workflows

- Introduced `FailingMaterializer` and `WorkingMaterializer` for simulating failing and successful workflow materializations.
- Added `TriggerDeletionTestScenario`, `TriggerTestDataBuilder`, and related test data classes to define comprehensive test cases.
- Updated `DeleteTriggersAsync` tests with scenarios for materialization failures and mixed success.
- Improved test coverage and maintainability with reusable test data builders and utilities.
2025-11-21 20:58:38 +01:00
..
IActivityExecutionManager.cs
IActivityExecutionStatsService.cs
IActivityExecutionStore.cs
IActivityExecutonMapper.cs Introduce activity execution record capturing and serialization improvements (#6800) 2025-07-16 18:05:32 +02:00
IBackgroundActivityInvoker.cs
IBackgroundActivityScheduler.cs Introduce job unscheduling functionality 2024-12-05 19:25:16 +01:00
IBookmarkBoundWorkflowService.cs Merge 3.5.1 into 3.6.0 (#6907) 2025-09-13 13:05:52 +02:00
IBookmarkManager.cs Fix all broken summary xml docs (#6123) 2024-11-18 13:41:27 +01:00
IBookmarkPersister.cs
IBookmarkQueue.cs
IBookmarkQueueProcessor.cs
IBookmarkQueuePurger.cs Add bookmark queue purger functionality (#6080) 2024-10-31 09:09:05 +01:00
IBookmarkQueueSignaler.cs Fix race condition and add rate limiting to bookmark queue processing (#6187) 2024-12-07 17:34:10 +01:00
IBookmarkQueueStore.cs Fix all broken summary xml docs (#6123) 2024-11-18 13:41:27 +01:00
IBookmarkQueueWorker.cs
IBookmarkResumer.cs Merge 3.5.1 into 3.6.0 (#6907) 2025-09-13 13:05:52 +02:00
IBookmarksPersistedHandler.cs
IBookmarkStore.cs
IBookmarkUpdater.cs
IEventPublisher.cs Fix race condition in Distributed Workflow Runtime during same-workflow event publishing (#6538) 2025-03-31 18:11:27 +02:00
ILogRecordExtractor.cs Fix all broken summary xml docs (#6123) 2024-11-18 13:41:27 +01:00
ILogRecordSink.cs Fix all broken summary xml docs (#6123) 2024-11-18 13:41:27 +01:00
ILogRecordStore.cs Add AddManyAsync method to activity execution stores 2025-02-17 11:32:34 +01:00
IRegistriesPopulator.cs Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
IStimulusDispatcher.cs Fix race condition in Distributed Workflow Runtime during same-workflow event publishing (#6538) 2025-03-31 18:11:27 +02:00
IStimulusSender.cs
ITaskDispatcher.cs
ITaskReporter.cs
ITriggerBoundWorkflowService.cs
ITriggerIndexer.cs
ITriggerInvoker.cs Add Elsa.Kafka Module for Kafka Integration with Message Sending and Receiving Activities (#6108) 2024-11-18 13:42:54 +01:00
ITriggerPayloadValidator.cs Create trigger payload validation, refacto HttpEndpoint validator and create Cron validator (#6641) 2025-05-20 19:52:43 +02:00
ITriggerStore.cs Add support for ordered and paginated trigger retrieval 2025-05-26 21:15:54 +02:00
IWorkflowActivationStrategyEvaluator.cs Add workflow activation and startup services. (#6076) 2024-10-30 22:51:14 +01:00
IWorkflowCanceler.cs
IWorkflowCancellationDispatcher.cs
IWorkflowCancellationService.cs Add workflow cancellation notifications (#6075) 2024-10-30 19:46:36 +01:00
IWorkflowClient.cs Improves workflow deletion and task scheduling (#7088) 2025-11-21 20:58:38 +01:00
IWorkflowDefinitionRefresher.cs Fix all broken summary xml docs (#6123) 2024-11-18 13:41:27 +01:00
IWorkflowDefinitionsReloader.cs Fix all broken summary xml docs (#6123) 2024-11-18 13:41:27 +01:00
IWorkflowDefinitionStorePopulator.cs Addresses warnings and enforces null safety (#7050) 2025-11-12 15:53:23 +01:00
IWorkflowDispatcher.cs Addresses warnings and enforces null safety (#7051) 2025-11-12 16:56:31 +01:00
IWorkflowExecutionLogStore.cs Addresses warnings and enforces null safety (#7051) 2025-11-12 16:56:31 +01:00
IWorkflowHost.cs
IWorkflowHostFactory.cs
IWorkflowInbox.cs
IWorkflowInvoker.cs
IWorkflowMatcher.cs
IWorkflowRegister.cs
IWorkflowRestarter.cs Add workflow restart functionality for handling interruptions 2025-02-22 15:10:52 +01:00
IWorkflowResumer.cs Merge 3.5.1 into 3.6.0 (#6907) 2025-09-13 13:05:52 +02:00
IWorkflowRuntime.cs Incremental work on restoring previous workflow runtime API surface for backward compatibility 2025-01-28 00:11:25 +01:00
IWorkflowsProvider.cs
IWorkflowStarter.cs Add workflow restart functionality for handling interruptions 2025-02-22 15:10:52 +01:00