Deleted unused custom activity classes, message types, and related registrations from the codebase. Also cleaned up surplus library references and configurations from Program.cs to streamline and simplify the project.
The test `WorkflowAsActivityInternal_ShouldHonorSettings_WhenExecuting` was marked with `[Fact(Skip...)]` because it fails inconsistently when run via CLI, despite working reliably in the IDE. This change avoids false negatives during automated testing.
Cleaned up duplicate and unused package references in the project file to reduce clutter and maintain consistency. This change ensures there are no overlapping dependencies and improves maintainability.
Corrects a typographical error in the method name
`LisAsync` to `ListAsync` in the
`IResilienceStrategiesApi` interface, ensuring correct
spelling and consistency.
* Add resilience module with core interfaces and services
Introduced a new `Elsa.Resilience` module and its core components to support resilient services and activities. This includes resilience strategies, providers, and attributes, along with integration into the existing HTTP module for enhanced fault tolerance. Added solution and project references for proper dependency management.
* Add resilience strategy framework with HTTP strategy support
Introduced a resilience strategy architecture, including a configurable `HttpResilienceStrategy` with retry capabilities, strategy serialization, and integration with existing modules. Enhanced ResilienceFeature to support registration of strategy types and updated application configuration to enable resilience strategies. This change ensures more robust and fault-tolerant HTTP request handling.
* Add JSON serialization support for resilience configuration
Introduced `ConfigurationExtensions` to enable JSON serialization of configuration sections. Updated resilience strategies to utilize the new extension methods and adjusted JSON serialization logic to support polymorphism with `$type` discriminator. Minor modifications were made to support deserialization and property mutability.
* Add resilience strategy support to workflows and API clients
Introduced resilience strategy configuration, serialization, and execution support across workflows and API clients. Added new APIs, models, and services to enhance fault tolerance capabilities for activities and HTTP interactions.
* Refactor resilience services for improved modularity.
Replaced `IResilienceService` with new modular interfaces (`IResilienceStrategyCatalog`, `IResilienceStrategyConfigEvaluator`, `IResilientActivityInvoker`) and corresponding implementations. Enhanced maintainability by simplifying components and responsibilities, ensuring better separation of concerns.
* Rename methods in ResilienceStrategyCatalog for clarity
Updated method names in `ResilienceStrategyCatalog` and its interfaces for better readability and alignment with naming conventions. Replaced `GetAllStrategiesAsync` with `ListAsync` and `GetStrategyAsync` with `GetAsync` across the codebase.
* Refactor resilience handling in HTTP activities.
Replaced `ResilienceCategory` property with `ResilienceCategoryAttribute` for a cleaner implementation. Updated `IResilientActivity` to simplify its interface and adjusted related modifications accordingly. Introduced `IResilientActivityInvoker` to enhance resilience strategy execution.
* Add support for additional resilience and scripting features
Extended resilience strategy handling with serialization support, added `HttpResilienceStrategy` type in JavaScript handler, and refined object conversion logic for interfaces. Minor adjustments to `Expression` class properties for consistency.
* Remove `UseResilience` call from Program.cs
This call was redundant and no longer necessary for the application. Its removal simplifies the code and ensures only required middleware is used.
* Remove commented-out JSON converter code in serializer setup
Cleaned up unused and commented-out converter initialization code in `ResilienceStrategySerializer`. This improves readability and removes unnecessary clutter from the file.
* Fix typo in method names from 'Resiliency' to 'Resilience'
Renamed methods to maintain consistency in naming conventions across the codebase. This change ensures clarity and alignment with established terminology.
* Refactor namespace for ConfigurationResilienceStrategySource
Updated the namespace of ConfigurationResilienceStrategySource to "StrategySources" for better alignment with naming conventions and structure. Removed an unused namespace reference in ResilienceFeature for cleanup.
* Mark EnableResiliency as obsolete in SendHttpRequestBase.
The EnableResiliency property is now marked with the [Obsolete] attribute. Developers are encouraged to use the common Resilience Strategy setting instead for managing HTTP request resiliency. This change ensures better consistency and alignment with the broader resilience strategy.
* Restrict ResilienceCategoryAttribute to class targets only
Removed support for using ResilienceCategoryAttribute on properties. This change enforces a stricter and more focused usage of the attribute, ensuring it applies only to class-level declarations.
* Add documentation for IResilientActivityInvoker interface
Include summaries and parameter descriptions for the `InvokeAsync` method. This improves code clarity and helps developers understand the functionality and usage of the resilient activity invocation process.
* Fix logical operator precedence in type comparison check
Parentheses were added to ensure correct evaluation of conditions when checking type compatibility. This prevents potential logical errors when determining the target type in object conversions.
* Add support for resilience source identification
Introduce the `ResilienceSourceNameAttribute` to allow naming of resilience sources. Updated `ResilienceStrategyCatalog` to utilize the attribute for prefixing strategy IDs, improving source identification and traceability. Applied the attribute to `ConfigurationResilienceStrategySource` as an example.
* Revert "Add support for resilience source identification"
This reverts commit 19b4e7121d6330b5de4f692b78da4c1e4a2d1f67.
* Reapply "Add support for resilience source identification"
This reverts commit 8bcba9d040c4eb247077aec6d90dc02817adcbd5.
* Revert "Reapply "Add support for resilience source identification""
This reverts commit ee04d35e7930956c752dda3ed150ca34a535e66c.
* Switch Flowchart to partial class and implement token-based logic
Refactored Flowchart to use a partial class structure for better modularity. Introduced a token-based execution option alongside the existing counter-based logic, enabling flexible activity scheduling strategies within the flowchart.
* Add token-based execution logic to Flowchart activities
Introduced token-based workflow execution for Flowcharts, enabling more granular control over activity scheduling. Refactored Start activity resolution and optimized connection handling within FlowGraph. Added extensions for improved activity query and execution management.
* Refactor token-based flowchart logic and add loopback detection
Replaced the legacy token-based flowchart logic with a cleaner, modular implementation. Introduced `LoopbackDetector` for identifying back-edges in workflows, enabling explicit handling of loopback connections for improved execution flow. Minor adjustments were also made for code consistency and clarity.
* Introduce token-centric execution model for Flowchart activity
Replaced the execution-count heuristic in Flowchart with a robust token-centric model, improving handling of loops, joins, and forks. Added join semantics via `JoinKind` and `IJoinHintProvider` to enable flexible configuration. Updated documentation and dependencies to reflect the new model.
* Refactor activity property handling and enhance JSON serialization.
Standardize key names in activity property management for consistency and improve error handling in `GetJoinKind` methods. Add support for enum serialization with `JsonStringEnumConverter` in JSON utilities.
* Refactor flowchart token handling for clarity and efficiency
Revised the flowchart token management logic to improve readability and maintainability. Simplified token creation, consumption, and scheduling while removing redundant code. Updated token structure and streamlined the flow execution process to handle dynamic and static connections effectively.
* Refactor Flowchart activity scheduling logic
Consolidated child activity scheduling into a single method, reducing duplication across token-based and counter-based workflows. Removed unused fields, redundant imports, and legacy logic to improve maintainability and clarity of the codebase.
* Update .gitignore to track Azurite data folder
Added `docker/azurite-data` to the ignore list to exclude local Azurite data files from being included in the repository. Ensures proper handling of temporary files related to Azure storage emulation.
* Refactor flowchart logic and extract activity context utilities
Reorganized flowchart logic by introducing reusable extension methods for activity context operations. Moved "HasPendingWork" and "HasFaultedChildren" methods into extensions to improve readability and maintainability. Updated related flowchart logic to utilize these methods for cleaner and more modular code.
* Refactor join logic and clean up Flowchart activities
Removed obsolete `JoinKind` enum and `IJoinHintProvider` interface, replacing them with the new `JoinMode` concept. Simplified flowchart logic by consolidating flow graph handling and refining activity execution extensions. Updated `FlowJoin` to recommend property-based configuration over explicit usage.
* Avoid invalid test execution when token flow is enabled.
The added check prevents the test from running when `Flowchart.UseTokenFlow` is enabled, as this scenario is incompatible. This ensures test reliability and avoids unnecessary execution.
* Refactor token-based logic in Flowchart activity.
Simplified token handling and introduced clearer logic for WaitAny and WaitAll joins. Improved efficiency by reducing redundant checks and streamlining activity scheduling. This ensures better maintainability and functionality in complex workflows.
* Refactor Token logic into its own model class
Moved the Token logic out of the Flowchart partial class to a standalone `Token` model for better modularity and clarity. Adjusted token consumption behavior to mutate the token in place rather than replacing it.
* Fix ancestor cancellation logic in Flowchart activities
Pass the correct activity to CancelInboundAncestorsAsync to ensure accurate ancestor determination and cancellation. Added validation to confirm the activity context is a flowchart to prevent invalid operations. These changes improve the reliability of flow control in workflows.
* Refactor Token model to add scheduling functionality
Replaced the `consumed` parameter with a `Scheduled` property and added a `Schedule` method for mark scheduling. This enhances the token model's flexibility, improving flowchart activity management.
* WIP on (no branch)
* Remove unused WaitAny guard logic from Flowchart activity.
The WaitAny guard logic and associated key have been commented out and effectively disabled. This cleanup simplifies the code, removing unnecessary operations that were no longer in use. The change ensures better maintainability and focuses on the core functionality.
* Add `MergeMode` enum and refactor flowchart merging logic
Introduced a `MergeMode` enum to define strategies for handling multiple inbound execution paths. Updated flowchart logic to replace the previous `FlowJoinMode` with `MergeMode`, and refactored related extensions to accommodate the new enum. This enhances clarity and flexibility in workflow merging behaviors.
* Mark `FlowJoin` obsolete and enhance merge mode handling
Added the `[Obsolete]` attribute to the `FlowJoin` activity and deprecated properties to encourage using `MergeMode`. Replaced synchronous `GetMergeMode` with an asynchronous `GetMergeModeAsync` to handle legacy `FlowJoin` mappings dynamically. Other minor changes include simplifying variable initialization in `WorkflowExecutionContext`.
* Mark FlowJoin activity as obsolete
The FlowJoin activity is now marked obsolete since all activities support the MergeMode property, eliminating the need for explicit join steps. This change includes an annotation update to clearly communicate its deprecated status.
* Refactor `OnActivityCanceledAsync` method location
Moved the `OnActivityCanceledAsync` method from the `Flowchart.Counters` file to the main `Flowchart` file for improved organization and readability. This ensures the method aligns better with its primary logic and related functionality.
* Refactor flowchart logic to improve cancellation handling
Refactored `OnActivityCanceledAsync` to handle token-based flow and legacy flow separately for better clarity and maintainability. Moved `CompleteIfNoPendingWorkAsync` to a single shared location and updated pending work checks to include unconsumed tokens and faulted activities. Simplified redundant logic and ensured consistency across methods.
* Remove consumed tokens after activity completion
This update ensures that consumed tokens pointing to the completed activity are purged from the token list. This helps maintain a clean state and prevents unnecessary token accumulation during workflow processing.
* Add support for blocking tokens in flowchart activities.
Introduced a `Blocked` property to the `Token` model to prevent scheduling activities prematurely in certain merge modes. Updated token processing logic to handle blocked tokens effectively and ensure proper scheduling or consumption. Simplified token management by removing redundant methods and cleaning up consumed tokens appropriately.
* Refactor Flowchart activity cancellation logic.
Streamlined cancellation logic by separating token and counter flow handling into dedicated methods. Removed redundant properties and logic, improving readability and maintainability. Simplified `OnChildCompletedAsync` and related methods for consistency.
* Refactor token-centric flowchart execution model.
Updated the flowchart ADR to clarify the token-centric approach, including `MergeMode` rules and scheduling logic. Enhanced the model to handle loops, forks, and resumable activities more robustly while improving state management and supporting cancellation. Updated sequence diagram for clarity.
* Remove JoinMode-related methods from ActivityExtensions
The GetJoinMode and SetJoinMode methods were removed as they are no longer needed. This cleanup reduces unused code and improves maintainability of the ActivityExtensions class.
* Remove unused JoinMode enum
The JoinMode enum was determined to be unnecessary and has been deleted to clean up the codebase. This helps reduce redundancy and improve maintainability.
* Remove unused LoopbackDetector class from Flowchart module
The LoopbackDetector class was removed because it is no longer used in the codebase. Its functionality appears to be obsolete or unnecessary for the current requirements of the Flowchart module.
* Update `UseTokenFlow` to be configurable
Made `UseTokenFlow` a static field to allow external configuration. This enables users to switch between the token flow and the old counter-based model as needed. Updated documentation accordingly.
Updated package references to their latest versions in `Directory.Packages.props`, ensuring compatibility and access to the latest features. Enabled `MongoDB.Driver.Core.Extensions.DiagnosticSources` in `Elsa.MongoDb.csproj` and cleaned up unused ElsaStudio version property in `Directory.Build.props`.
Bump the ElsaStudio version from 3.4.0-rc1 to 3.5.0-preview.998 in Directory.Build.props. This prepares the project for using the latest preview features and improvements.
* Refactor OpenTelemetry error handling implementation
Introduce WorkflowErrorSpanHandler interface and context for improved error span handling in workflows. Separate activity and workflow error handling using dedicated abstractions and context models. Update error handling logic in tracing middleware and adjust DI configuration accordingly.
* Rename handler class and improve error tagging logic
Renamed `FaultExceptionActivityErrorSpanHandler` to `FaultExceptionErrorSpanHandler` for consistency and clarity. Updated error attribute tagging to align with Datadog's well-known attributes. Adjusted incident selection logic to use the first incident instead of the last.
* Align .gitignore file with consistent formatting
Standardized comments in the .gitignore file by adding missing spaces and capitalizing as needed. Updated the `/docker/data/` entry to `/docker/azurite-data/` for clarity.
* Fix incorrect selection of activity execution context
Replaced `LastOrDefault` with `FirstOrDefault` to ensure the correct activity execution context is retrieved when handling errors. This change resolves potential inaccuracies in identifying the faulted activity node.
* Exclude docker-compose-datadog.yml from solution file.
Replaced `origin/develop/3.5.0` with `origin/main` to align the workflow with the updated branch structure. This ensures compatibility and avoids referencing deprecated branches.
Updated the base version from 3.5.0 to 3.6.0 in the workflow configuration. Also modified the branch check to look for 'origin/main' instead of 'origin/develop/3.5.0' to align with the main branch structure.
Added 'develop/*' to branch filters and adjusted conditions to accommodate 'develop' branch-related logic, including versioning and filtering updates. Ensures proper handling of 'develop' branch workflows and aligns with project branching strategy.
Integrated Azurite for local Azure Storage emulation, including Blob, Queue, and Table services. Configured ports, volumes, and debug options for development purposes. This addition aims to enhance local testing and reduce dependencies on external Azure services.
- Modify ListAll to return distinct activity descriptors.
- Update RegisterAsync to call Add with correct parameters.
- Refactor RefreshDescriptorsAsync for better collection usage.
- Split Add method into two overloads for clarity.
- Improve logging for replacing existing activity descriptors.
Co-authored-by: Max Brooks <Max@compyl.com>
Implemented FuncExpressionValueConverter to handle serialization
and deserialization of Func<ExpressionExecutionContext,
ValueTask<object>> types, ensuring delegates are not serialized
and cannot be rehydrated from JSON. Updated multiple serializers
including ApiSerializer, BookmarkPayloadSerializer,
JsonActivitySerializer, JsonPayloadSerializer,
JsonWorkflowStateSerializer, and SafeSerializer to utilize
the new converter in their JSON serialization options.
Co-authored-by: Max Brooks <Max@compyl.com>
* Fix unexpected FlowJoin(WaitAny) behavior in cyclic flow.
Visited counting mechanism now applies to canceled branches.
* change FlowJoin to be in pending (instead of running) state if it's not ready to complete
---------
Co-authored-by: n.rulyev <n.rulyev@bars.group>
* Remove obsolete properties and refactor activity evaluation
Refactored activity input and log persistence property evaluation using improved notification handlers. Removed redundant `ActivityState` property and associated serialization logic, ensuring payloads are only serialized when necessary. All changes streamline workflow processing and enhance maintainability.
* Refactor mediator call to inline cancellation token.
Replaced the separate variable for the cancellation token with an inline reference for clarity and reduced redundancy. This simplifies the code without altering functionality.
* Implement internal state activity persistence and logging mechanisms
Updated property handling to support nullable dictionaries and improved persistable states. Adjusted serialization logic to handle optional fields more robustly, ensuring better compatibility with log persistence mappings and internal state evaluations.
* Replace default! with null! for string properties
Updated string properties in various records to use null! instead of default! for consistency and clarity. Additionally, adjusted methods to check collection existence before serialization and streamlined object initializations with simplified syntax where possible.
* Fix nullable types in DeserializeActivityState method
Updated the method's return type and JSON deserialization to properly handle nullable values. This ensures better alignment with the method's behavior and avoids potential null reference issues.
* Fix null reference issues in InputOutputLoggingTests
Replaced forced null dereferences with safe navigation checks to prevent potential null reference exceptions. This ensures more robust and error-free test execution for activity state validations.
* Remove default commit strategy
No commit strategy = default behavior.
* Improved display names of commit strategies for clarity
* Refactor log persistence evaluation order in middleware
Ensure log persistence mode is determined before executing the next middleware to prevent issues with uncommitted changes. This change improves the reliability and predictability of log persistence behavior.
* Refactor log persistence mode evaluation for activity execution
Updated functionality to evaluate and filter log persistence modes during activity execution. Added middleware, interfaces, and supporting methods to manage log configuration, ensuring only persistable inputs and outputs are retained in execution mapping. Updated pipeline to include the new middleware.
* Refactor log persistence mapping and evaluation logic
Updated log persistence evaluation to use separate input/output maps, ensuring a more modular and maintainable structure. Adjusted property key handling and introduced a dedicated helper method for evaluating persistence properties. Added middleware for log persistence mode evaluation to the workflow execution pipeline.
* Refactor log persistence logic and restructure namespaces.
Centralizes log persistence logic under a dedicated `LogPersistence` namespace. Simplifies interfaces and methods to streamline functionality, ensuring clarity and consistency in log persistence evaluations.
* Refactor log persistence methods for encapsulation.
Converted multiple public methods to private to enhance encapsulation and adherence to the principle of least privilege. Introduced a helper method `ResolveFinalLogPersistenceMode` to improve code clarity and maintainability.
* Refactor log persistence with improved type safety and structure
Updated methods and properties related to log persistence to remove nullable types, enhance clarity, and ensure type safety. Simplified configurations and refactored logic for evaluating persistence modes, reducing redundancy and improving maintainability.
* Add XML documentation to IActivityPropertyLogPersistenceEvaluator
This commit introduces XML comments to provide clarity on the purpose and functionality of the interface and its methods, aiding developers in understanding their usage and behavior during workflow execution.
* Refine log persistence logic in activity execution mapping.
Ensure that log persistence modes are correctly handled by adding explicit checks for `LogPersistenceMode.Inherit`. This prevents potential ambiguities and ensures accurate property mapping during workflow execution.
* Refactor state handling and log persistence evaluation.
Updated method signatures for stricter type consistency and improved readability. Introduced additional resolution step in log persistence to handle legacy configurations more effectively. This enhances code maintainability and alignment with expected behavior.
* Update src/modules/Elsa.Workflows.Core/Extensions/ActivityExtensions.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Added missing imports for Workflow Models and State to support enhanced functionality. This ensures proper handling of workflow-related executions and state management within the middleware.
Introduced a `Position` model to represent coordinates. Updated connection models, serializers, and related logic to include vertices, enabling richer flowchart connections. Simplified null initialization and improved collection handling across components.
* Make input variable names case-insensitive in dictionary
Previously, input variable names were case-sensitive when added to the dictionary, which could lead to potential issues with naming mismatches. This change ensures that input names are now treated as case-insensitive by using `StringComparer.OrdinalIgnoreCase`, improving consistency and usability.
Fixes#6598
* Refactor default value assignments and object initialization.
Replaced `default` with explicit `null` for optional parameters to improve clarity. Simplified object instantiation by using target-typed `new` for brevity. These changes enhance code readability and maintainability.
Introduced a new `GetStorageDriverType` method for cleaner and modular handling of storage driver type resolution. Added dependency on `IServiceScopeFactory` to manage backward compatibility with older type namespaces.
Replaced alteration model hierarchy with a simpler JsonObject-based structure for representing alterations. Updated related interfaces, parameters, and API configuration to align with this refactored approach.
Updated `CreateAndRunInstanceAsync` to separate instance creation and execution with locking to handle nested workflow scenarios. Made `RunInstanceAsync` public to facilitate reuse in the distributed workflow client.
Fixes an incorrect type use: IContainer lives in System.ComponentModel and does not represent a container activity. The correct type to use is `Container`.
Replaced `activity.Id` with `activity.NodeId` in incident creation for enhanced context. Removed redundant `LogExceptionAndTransition` method by consolidating logic into existing workflow, reducing duplication and improving maintainability.
Set ObjectConverter.StrictMode to true in the test constructor to enforce stricter conversion rules during tests. This ensures better reliability and consistency in test coverage.
* Fix MessageReceived not setting Result
Fixes#6540
* Add custom equality comparer for VariableDescriptor
Introduced a `VariableDescriptorComparer` to ensure proper equality checks within `HashSet<VariableDescriptor>`. Updated related code to use the comparer and added a new message type `OrderReceived` for MassTransit integration.
* Refactor bookmark management and add new features
Streamlined bookmark handling by eliminating temporary storage in `ActivityExecutionContext` and directly managing bookmarks in `WorkflowExecutionContext`. Documented architectural decisions using ADRs.
* Regenerate EF Core migrations
* Refactor fault tracking to use AggregatedFaultCount property.
Replaces FaultCount with AggregatedFaultCount across the codebase to improve clarity and consistency in fault tracking. Updates related methods, properties, and data mappings to align with the new terminology. Fixes initialization issue with nullable inputs in Fault class.
* Add migration to track fault counts in runtime (V3.5)
This migration adds a new column, "AggregatedFaultCount," to the "ActivityExecutionRecords" table. The column is an integer, non-nullable, with a default value of 0, and enables tracking aggregated fault occurrences. The migration also includes a rollback to remove this column if needed.
* Fix typo in ADR 0004 regarding bookmark management convention
Corrected a spelling mistake in the ADR documentation by changing "determins" to "determines." This ensures clarity and maintains the professionalism of the document. No functional changes were made.
* Refine fault propagation logic for child-parent activities
Replace automatic fault transitions of parent activities with an aggregate fault count for descendant activities. This avoids premature state changes while still indicating child activity faults, improving workflow resilience and accuracy.
* Remove signal-driven fault propagation ADR and renumber bookmarks ADR
The ADR for signal-driven fault propagation was deleted, and the direct bookmark management ADR was renamed and renumbered accordingly. Related references in the table of contents, graph, and solution file were updated to reflect these changes.
* Refactor DeleteBookmarks to improve readability.
Reformatted the BookmarkFilter initialization for better clarity and maintainability. This change ensures the code is more aligned with modern C# conventions and improves overall readability. No behavior or functionality has been altered.
* Refactor naming for "AggregatedFaultCount" to "AggregateFaultCount"
Standardized the terminology across the codebase and migrations by renaming all references of "AggregatedFaultCount" to "AggregateFaultCount" for improved consistency and readability. Updated relevant logic, models, migrations, and database contexts accordingly.