Commit graph

6117 commits

Author SHA1 Message Date
Matt 74e9bfc7ce Return Http and Scripting from Extensions. 2025-05-20 12:38:24 +01:00
Matt 10f92bf16b Return Caching to Core. 2025-05-20 12:11:27 +01:00
Matt c423b324f9 Remove Dropins from Core. 2025-05-20 00:37:03 +01:00
Matt e56826e387 Remove All projects from Core that have moved to Extensions. 2025-05-20 00:33:12 +01:00
Sipke Schoorstra 25e36c3467
Remove unused activities, messages, and dependencies
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.
2025-05-12 14:13:01 +02:00
Sipke Schoorstra 3c15268911
Skip unreliable test causing failures in CLI execution
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.
2025-05-12 11:59:33 +02:00
Sipke Schoorstra bbce6b6747
Merge branch 'develop/3.5.0' 2025-05-12 11:39:50 +02:00
Sipke Schoorstra f6a357ec00
Remove redundant package references from project file
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.
2025-05-12 10:31:48 +02:00
Sipke Schoorstra 913ccb1a4f
Fixes typo in interface method name
Corrects a typographical error in the method name
`LisAsync` to `ListAsync` in the
`IResilienceStrategiesApi` interface, ensuring correct
spelling and consistency.
2025-05-12 10:18:14 +02:00
Sipke Schoorstra 9aa239719d
Add IResilienceStrategy Abstraction with Category Matching and Expression-Based Configuration (#6637)
* 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.
2025-05-12 10:09:04 +02:00
Sipke Schoorstra 3a1ddb650f
Introduce token-centric Flowchart execution model with configurable MergeMode (#6632)
* 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.
2025-05-09 20:07:49 +02:00
Ouail Laamiri a037ab873f
Update README.md (#6629) 2025-05-09 19:55:21 +02:00
Matt cfef5acdac
Remove Sql Activities from Core to the new Integrations Repo. (#6625) 2025-05-09 19:53:31 +02:00
Sipke Schoorstra 81cd6b0d5e
Update package versions and enable MongoDB diagnostics (#6635)
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`.
2025-05-07 12:31:21 +02:00
Sipke Schoorstra 12023999f0
Update ElsaStudioVersion to 3.5.0-preview.998
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.
2025-05-07 11:05:14 +02:00
Sipke Schoorstra f0639cbd42
Refactor OpenTelemetry error handling implementation (#6621)
* 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.
2025-05-07 10:59:44 +02:00
Sipke Schoorstra 07d558f1ae
Update branch reference in packages workflow
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.
2025-04-30 21:16:39 +02:00
Sipke Schoorstra 7a38677f09
Merge branch 'develop/3.5.0' 2025-04-30 21:15:56 +02:00
Sipke Schoorstra 721c3dbe6d
Update base version to 3.6.0
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.
2025-04-29 13:56:48 +02:00
Sipke Schoorstra dacbef13e6
Update workflows to support 'develop' branch conventions
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.
2025-04-28 19:09:43 +02:00
Sipke Schoorstra 72ff0ff70d
Merge branch 'develop/3.5.0' 2025-04-28 19:07:55 +02:00
Sipke Schoorstra f0b84f8090
Add Azurite service to docker-compose.yml
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.
2025-04-28 19:07:24 +02:00
Sipke Schoorstra 5d312a637c
Merge remote-tracking branch 'origin/rc/3.4.0' into develop/3.5.0 2025-04-28 19:06:20 +02:00
Max Brooks d92b82f127
Refactor ActivityRegistry to populate all activities in workflow editor page (#6605)
- 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>
2025-04-28 19:05:05 +02:00
Max Brooks 7120f9f2a0
Add FuncExpressionValueConverter for JSON serialization (#6607)
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>
2025-04-28 19:01:16 +02:00
Michael H. e81b9f58b5
Update CommonTypesDefinitionProvider.cs (#6615) 2025-04-28 18:59:35 +02:00
Nordran 0dac514973
Fix unexpected FlowJoin(WaitAny) behavior in cyclic flow. (#6592)
* 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>
2025-04-28 18:58:58 +02:00
raymonddenhaan b9d4eb8617
Start a new workflow trace when triggered from UI
Start a new workflow trace when triggered from UI
2025-04-23 15:32:37 +02:00
Raymond den Haan 3865228c19 Clarify remarks for dummy parent activity usage. 2025-04-23 15:18:36 +02:00
Raymond den Haan 28a18d1a86 Start a new workflow trace when triggered from UI 2025-04-22 11:46:16 +02:00
Sipke Schoorstra c8ed08cc85
Remove obsolete properties and refactor activity evaluation (#6603)
* 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.
2025-04-18 16:21:25 +02:00
Sipke Schoorstra 476656ccce
Implement internal state activity persistence and logging mechanisms (#6601)
* 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.
2025-04-18 14:29:18 +02:00
Sipke Schoorstra 67f3ceb801
Remove default commit strategy (#6599)
* 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.
2025-04-18 09:26:29 +02:00
Sipke Schoorstra b88d12cdd8
Fixed Log Persistence Mode Evaluation For Activity Execution (#6595)
* 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>
2025-04-17 18:03:06 +02:00
Sipke Schoorstra 3629a2ee69 Refactor ExceptionHandlingMiddleware imports.
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.
2025-04-16 20:43:33 +02:00
Sipke Schoorstra 9c05a4247c
Merge remote-tracking branch 'origin/main' 2025-04-16 08:41:52 +02:00
Sipke Schoorstra 2eec542f50
Merge remote-tracking branch 'origin/rc/3.4.0' 2025-04-16 08:41:04 +02:00
Sipke Schoorstra 83ae0f351e
Add support for connection vertices in flowcharts (#6585)
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.
2025-04-16 08:28:16 +02:00
Sipke Schoorstra 278ed34981
Make input variable names case-insensitive in dictionary (#6590)
* 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.
2025-04-15 09:51:42 +02:00
Sipke Schoorstra e15baa6f44
Refactor variable storage driver mapping logic. (#6588)
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.
2025-04-15 09:51:32 +02:00
Sipke Schoorstra 72370e9271
Remove alteration models and refactor to use JsonObject (#6582)
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.
2025-04-14 11:57:54 +02:00
Sipke Schoorstra e5c397d4fb
Refactor workflow instance creation and execution logic. (#6586)
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.
2025-04-14 11:57:14 +02:00
Sipke Schoorstra d92512f087
Fix Container type (#6584)
Fixes an incorrect type use: IContainer lives in System.ComponentModel and does not represent a container activity. The correct type to use is `Container`.
2025-04-13 20:26:31 +02:00
Sipke Schoorstra 2ce5bbfbf1
Refactor incident creation to include NodeId and remove duplication
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.
2025-04-11 21:17:41 +02:00
Sipke Schoorstra 612fd26388
Enable strict mode for ObjectConverter in unit tests
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.
2025-04-10 19:57:39 +02:00
Sipke Schoorstra 8c52acece5
Fix MessageReceived not setting Result (#6562)
* 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.
2025-04-10 15:02:39 +02:00
Sipke Schoorstra 4266421a4c
Refactor Fault Propagation and Simplify Bookmark Management (#6545)
* 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.
2025-04-10 15:01:49 +02:00
MariusVuscanNx 006ed54a92
Extended the incidents data to include the activityNodeId (#6570) (#6572) 2025-04-10 14:10:56 +02:00
MariusVuscanNx 455f206d36
Extended the incidents data to include the activityNodeId (#6570) 2025-04-10 14:02:38 +02:00
Sipke Schoorstra e2288d0b34
Fix infinitely waiting Alterations Workflow (#6561)
* Refactor TenantId string handling and nullability checks.

Moved `StringExtensions` to a common module for reuse. Updated tenant-related logic to utilize null-safe string extensions, enhancing consistency and simplifying nullability handling across the codebase.

* Set StrictMode to false by default in ObjectConverter

Modified the default value of StrictMode to `false` to enable the original flexible behavior. Developers can opt into strict mode by explicitly setting it to `true`. This change aims to enhance backward compatibility and minimize unexpected strict conversions.

* Add tenant ID retrieval to ElsaDbContextBase constructor

Retrieve the current tenant ID if available using ITenantAccessor and assign it to the TenantId property. This ensures proper handling of multi-tenancy scenarios in the database context initialization.

* Disable DbContext pooling, manual OTEL instrumentation, and strict mode.

DbContext pooling is turned off to prevent potential issues with shared context instances. Manual OpenTelemetry instrumentation is disabled to rely on automatic instrumentation instead. Strict mode is also disabled to allow more flexibility in object conversion.

* Fix infinitely waiting Alterations Workflow

Replaced workflow dispatch logic with BookmarkQueue and StimulusHasher for triggering workflows. This fixes the issue where the Alterations workflow would signal completion while a later step awaits a completion bookmark. The Bookmark Queue now handles this.
2025-04-05 10:37:05 +02:00