Extended test data in `LoopingWorkflow` to include a third item, "Item 3". Updated assertions in `Tests.cs` to validate the new expected output for the additional item.
Refactored ObjectConverter to handle JSON array conversions more robustly, including support for arrays of complex types. Added a `Person` class for unit testing and updated tests to validate the new functionality. Included necessary project reference updates to ensure proper functionality.
Updated all instances of explicitly typed `string` and `JsonElement` to `var` in `JsonElementConverterTests.cs` to improve code readability and maintain consistency with modern C# coding practices. This change does not affect functionality but aligns with better style conventions.
Replaced InputProxy with alternative implementations, adding flexibility to handle inputs. Introduced a JsonElementConverter to deepen JavaScript and JSON element integration. Enhanced testing and object conversion logic, improving type handling and support for complex JSON scenarios.
Refactored TypeJsonConverter to distinguish and properly handle serialization of arrays and generic collections. Updated integration tests to include cases for round-tripping primitive arrays and collections for improved coverage.
Introduce a new integration test to verify workflow serialization functionality, ensuring that newly created workflow definitions can be serialized and deserialized correctly. Adjust default nullability for certain fields in `WorkflowDefinition` to improve consistency and prevent null reference issues. Minor argument update in `New` method of `WorkflowDefinitionPublisher`.
Removed unused workflow event handlers and simplified signal usage. Marked the flaky `DispatchAndWaitWorkflow_ShouldWaitForChildWorkflowToComplete` test for review and fixing. This improves maintainability and prepares for future test stability work.
The test 'DispatchAndWaitWorkflow_ShouldWaitForChildWorkflowToComplete' was marked as flaky and skipped to prevent instability in the suite. It should be revisited and fixed to ensure reliable execution.
Upgraded RabbitMQ from version 3-management to 4-management across tests and the Docker setup. This ensures compatibility with the latest features and improvements in RabbitMQ while maintaining consistency across environments.
Reorganized ProtoActor configuration to be conditionally applied based on runtime settings. Updated test workflows to simplify signal handling and improved test structure by introducing scoped dependencies and removing unused event subscriptions.
* Add synthetic properties to JS engine for exclusion
This fixes an issue where inputs would be declared as new variables, causing a "miss" when trying to read the input.
* Add InputOutput workflows and tests for data exchange
Introduce new Consumer and Provider JSON workflows to facilitate testing of input and output functionalities, ensuring seamless data exchange between processes. Implement corresponding tests to verify the correct reception and transmission of input data within the Provider workflow back to the Consumer, validating the setup with an assertion for expected output. Update the project configuration to include these workflows in the build output.
This was broken by both #5871 and #5682:
1. When a List<Guid> was serialized, it was recognized as a primitive collection and thus plainly written to the JSON without any type information: ["d4d8404c-4357-47ff-a343-649a116539f5"]
2. When this JSON was deserialized, due to lack of type info, it was deserialized as List<object>, containing strings. This is already not good.
3. When this List<object> gets serialized again (e.g. due to multiple workflow suspends causing WorkflowState serialization), this time it fails the primitive collection recognition, because object is not a primitive type. It now gets serialized as {"_items": ["d4d8404c-4357-47ff-a343-649a116539f5"], "_type": "Object[]"}
4. When that JSON gets deserialized, it tries to ReadType() but ReadType() fails to parse Object[] since it lacks the logic from TypeJsonConverter to throw away the [] before looking up Object in the WellKnownTypeRegistry, so it returns null as a type. Without a type but being faced with a json object { ... } it now deserializes into an ExpandoObject
5. Any further serialization / deserializations will now cause the expando object to get nested deeper and deeper every time.
* Fix `variables` handling override values set via `Set{VariableName}()` syntax
* Make `TenantsFeature` a dependency of `Multitenancy` to ensure streamlined initialization
From this point on, all application instances are multi-tenant with a single, default tenant. This streamlines the startup tasks that are designed around multitenancy.
* Add JS variable handling tests
* Ensure ExpandoObjects are correctly processed and synchronized between contexts and engines
Introduced a new helper method to process ExpandoObject conversions to JavaScript objects. Updated various handlers and functions to ensure ExpandoObjects are correctly processed and synchronized between contexts and engines. Added a new workflow test to validate the updated processing logic.
#5682 broke serialization in two ways:
- When a generic type was being serialized, such as List`1, the ` was being escaped by JsonSerializer.Serialize to "\u0060". The PolymorphicObjectConverter would then .Trim('"') without unescaping the `, causing "\\u0060" to be written into the final json.
- When the type is generic with one type parameter, e.g. List<T>, and also IEnumerable<T>, as List<T> is, then it would append "[]" at the end of the type name, resulting in: "System.Collections.Generic.List\\u00601[[Elsa.Workflows.IntegrationTests.Serialization.JsonSerialization.WorkflowAction, Elsa.Workflows.IntegrationTests]], System.Private.CoreLib[]" which is very invalid. It may only do that, if the typename was simplified because the elementType is in the WellKnownTypeRegistry. And even then, this is questionable, as you'd be deserializing an string[] where you've serialized a List<string> for example.
* Add ExecuteWorkflow activity and enable multitenancy
Introduced the ExecuteWorkflow activity to create and execute workflow instances, and updated runtime settings to use ProtoActor for distributed caching transport. Enabled multitenancy for the Elsa Server Web application.
* Namespace renames (#6135)
* Create ExecuteWorkflows tests and workflows
Add unit tests for executing workflows, including MainWorkflow and SubroutineWorkflow. Also, rename ExecutedWorkflowResult to ExecuteWorkflowResult in the runtime module for consistency.
* Add output definitions to WorkflowBuilder
Refactored the `WithInput` method for clarity and added multiple `WithOutput` methods to support different ways of defining workflow outputs. These changes enhance the flexibility and readability of the workflow configuration process by providing a consistent API for input and output definitions.
* Refactor namespaces in component tests
Updated namespaces from Helpers to specific contexts like Fixtures, Abstractions, Consumers, Decorators, etc., to improve code organization and readability. This change affects multiple files across different test scenarios and modules.
* Disable RabbitMQ and multitenancy, rename test class
Commented out RabbitMQ usage in WorkflowServer.cs to focus on other transports. Changed multitenancy flag to false in Program.cs. Renamed DispatchWorkflowsTests to ExecuteWorkflowsTests for clarity.
* Add proper summary tags back
* Apply suggestions from code review
Co-authored-by: Robin Sue <robinsue@live.de>
* 69 more files fixed
---------
Co-authored-by: Robin Sue <robinsue@live.de>
Added a cleanup step in the ReloadWorkflowTests to delete the workflow definition and its versions after the test runs. This ensures that the tests do not leave residual data, maintaining a clean state for subsequent tests.
Eliminated the IWorkflowDefinitionCacheManager dependency from the ReloadWorkflowTests constructor and fields. This cleanup helps streamline the code and maintainability by removing an unnecessary service.
The IWorkflowDefinitionCacheManager has been added to the test class. This ensures proper cache management during workflow definition reload tests. Additionally, a cleanup step to delete the workflow definition and its versions has been included.
Commented out Scope disposal to prevent test runner hangs in component tests. Adjusted Cluster class to use property initializers instead of constructor. Updated workflow server connection strings and added detailed SQL Server configuration in Program.cs.
Changed static signals to instance variables in test classes for better encapsulation. Increased default timeout in `SignalManager` to 60 seconds. Removed unused cancellation token logic in `ActivityExecutionContext`.
Commented out unused service scopes to streamline the DeleteWorkflow tests in Elsa.Workflows. This change includes disabling associated calls and registry checks for scopes 2 and 3, focusing solely on scope1 operations.
* Implement log persistence strategy management
Added interfaces, services, and strategies for log persistence. Introduced new endpoint to list available log persistence strategies. Updated configurations and dependency injections accordingly.
* Refactor log record methods to asynchronous
Updated methods for extracting and persisting log records to be asynchronous, enhancing performance and scalability. This change includes modifying interfaces and implementations for better async support in workflow execution logging.
* Remove commented code
* Support nullable values in ActivityState dictionaries
Update ActivityState to support nullable values by changing type to 'IDictionary<string, object?>'. Enhanced DefaultActivityExecutionMapper to handle multiple persistence strategies for logging inputs and outputs.
* Rename ShouldPersistAsync to GetPersistenceModeAsync
Refactor method names for log persistence strategies to improve readability and consistency. Added summary comments for clarification and removed redundant configurations from appsettings.json. Added implicit uses and updated namespaces for better maintainability.
* Refactor activity payload and output retrieval logic
Extract payload and output retrieval into `GetPayload` and `GetOutputs` methods respectively. This modularizes the code for better readability and maintainability, and allows for potential reusability of these methods in other parts of the codebase.
* Add new project reference and update PostgreSQL provider usage
Added a project reference to Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql in the test project file. Also modified the WorkflowServer setup to specify the assembly in the PostgreSQL provider configuration.
* Add agent persistence to WorkflowServer
Integrated agent support and persistence using PostgreSQL in WorkflowServer. This includes adding necessary project references and configuring agents in the workflow server setup.
Updated workflow creation and dispatching methods to streamline bulk dispatch tests. Modified signal triggering in `TriggerSignal` activity and upgraded `ElsaStudioVersion` for compatibility improvements. Removed unused imports for cleaner code structure.
* Remove outdated sample workflows and activities
Deleted CompositeExample, SampleWorkflow, and SlowActivity classes as they are no longer needed. These deletions help clean up the codebase and maintain relevance in the code structure.
* Handle null WorkflowBuilderType in ClrWorkflowMaterializer
Introduce a fallback NotFoundWorkflowbuilder class when WorkflowBuilderType is null. This ensures the MaterializeAsync method functions even if the provided context lacks a specific workflow builder type.
* Add merging of itemDictionary to input
This change ensures that the itemDictionary's contents are also merged into the input dictionary, preventing possible data loss. It builds on existing logic by adding an additional merge operation to incorporate all necessary data.
* Add new workflows to BulkDispatchWorkflows and modify tests
Introduce `FruitWorkflow` and `MixFruitsWorkflow` for bulk dispatch scenarios. Refactor `BulkDispatchWorkflowsTests` to include new tests and rename signals for clarity. Optimize `BulkDispatchWorkflows` activity by removing redundant dictionary merge.
Deleted obsolete migration files from SQL Server, MySQL, and SQLite projects. This cleanup removes unused schema definitions and indexes, ensuring the repository remains up to date and free of unnecessary files.
This change overrides the version of System.Text.Json due to vulnerabilities found in dependencies referencing older versions. This ensures better security and reliability in performance tests.
* Add tenant awareness to bookmark handling and route resolution
Added tenant ID support across various components, including bookmark updates, route resolution, and middleware processing. This ensures that bookmark and route operations can now appropriately handle tenant-specific data, improving the system's multitenancy capabilities.
* Add Multitenant HTTP Routing feature to Tenants module
Introduced a new MultitenantHttpRoutingFeature class to the Elsa.Tenants.AspNetCore module, enhancing the tenant resolution capabilities. Moved RoutePrefixTenantResolver from Elsa.Http to Elsa.Tenants.AspNetCore and updated relevant project references and namespaces accordingly. This refactor improves modularity and separation of concerns between HTTP and tenancy features.
* Refactor route handling and tenant configuration
Removed redundant `RouteTableExtensions` and replaced with new route providers and updaters, enhancing flexibility and modularity. Introduced tenant-specific HTTP endpoint configurations for better customization and configuration management.
* Rename HttpEndpointBookmarkStimulus to HttpEndpointBookmarkPayload
Refactor various classes and methods to reflect the renaming from `HttpEndpointBookmarkStimulus` to `HttpEndpointBookmarkPayload`. Add and configure new extension methods for tenant route handling, update the route provider to support multi-tenancy, and adjust the tenants provider to bind configuration properly.
* Add HeaderTenantResolver and refactor Http namespace.
Introduce HeaderTenantResolver to resolve tenants via HTTP headers. Refactor multiple classes and interfaces to move from the Elsa.Http.Models namespace directly into Elsa.Http for clarity and consistency.
* Add Host-based tenant resolution
Implemented a HostTenantResolver to resolve tenants based on the request's host and updated tenant configurations with host information. Modified the tenant resolver pipeline and added the new host resolver to the service registrations.
* Add tenant-aware caching and accessor support
Enhanced caching by incorporating tenant identifiers into cache keys for more granular cache management. Introduced ITenantAccessor dependencies in various services to retrieve the current tenant information. This ensures that cache entries are correctly isolated per tenant.
* Reorder tenant resolvers for pipeline setup.
Reordered the tenant resolvers in the pipeline to prioritize HostTenantResolver before RoutePrefixTenantResolver. This ensures that tenant resolution is correctly aligned with host-based resolving before checking the route prefix.
* Remove unused imports
This commit eliminates redundant `using` directives across multiple files to streamline the codebase. This cleanup helps improve code readability and maintainability by removing unnecessary dependencies.
* Remove obsolete tenant-related classes and add ASP.NET Core middleware
Refactored tenant resolution by removing obsolete interfaces and classes, such as `IAmbientTenantAccessor` and `ITenantResolutionStrategy`. Introduced new ASP.NET Core middleware for tenant resolution, encapsulated in the new `Elsa.Tenants.AspNetCore` project. Updated related usage in various parts of the application to align with these changes.
* Remove HttpContextTenantResolver.
Removed HttpContextTenantResolver from the multitenancy pipeline and related service registrations. This simplifies the tenant resolution by relying on remaining resolvers like ClaimsTenantResolver and RoutePrefixTenantResolver.
* Add Elsa solution definition file
This commit introduces the main solution file, Elsa.slnx, defining the folder structure, projects, and configuration for the Elsa repository. This includes folders for Docker, documentation, pipelines, samples, scripts, source code, and tests.
* Refactor DefaultAccessTokenIssuer for clarity and efficiency
Refactored the DefaultAccessTokenIssuer class by simplifying its constructor and utilizing scoped variables for token options. Improved token creation logic by adding a dedicated method to configure token options, enhancing code readability and maintainability.
* Remove Elsa.slnx solution file
No dotnet build support yet.
* Refactor tenant resolver service registrations
Updated the service registrations to use interfaces for DefaultTenantResolver and DefaultTenantResolverPipelineInvoker. This improves the code's flexibility, making it easier to replace or extend these implementations in the future.
* Add multitenancy support and tenant scope management
Introduced ITenantScopeFactory and related implementations for tenant scope management across the application. Enhanced the HTTP workflows middleware to handle tenants and updated relevant configurations and extension methods to support tenant resolution.
* Remove unnecessary folder inclusion
The <Folder> tag for "Modules\Modules\" was redundant and has been removed to clean up the project file. This change will not affect the existing functionality or project structure.
* Rename Create to CreateScope and improve authorization.
Updated the method name from Create to CreateScope for better clarity in the TenantScopeFactory. Fixed a logical error in the authorization process, ensuring proper status code setting for unauthorized requests, and refactored token expiration calculation for clarity.
* Add tenant agnostic filters and remove tenant setup
This commit introduces tenant agnostic filters in AutoUpdateTests to ensure workflows can trigger regardless of tenant. Additionally, it removes tenant configuration from WorkflowServer setup as it is no longer required for the current tests.
Consolidate imports by replacing Elsa.Common.Contracts with Elsa.Common and Elsa.Common.Multitenancy. This update streamlines import statements across various modules, improving code readability and maintainability.
Updated ReadAsJsonAsync method to accept an IServiceProvider parameter for improved JSON deserialization. Modified corresponding tests and helper classes to utilize the service provider for more flexible JSON serialization options.
Implemented synchronous methods for serialization and deserialization while marking the asynchronous methods as obsolete across various storage and serialization services. This includes updates to handle serialization within the Save and Load methods, enhancing performance by avoiding unnecessary Task usage.
* Improve dispatched workflow input handling
Addressed input handling in dispatch messages by adding `SerializedInput` property. Also removed initialization logic and moved input deserialization to a helper method, ensuring compatibility with both new and deprecated input property formats.
* Update workflow Docker images and version tags
Changed Docker image tags from v3-2-0-rc3 to v3-2-1-preview across multiple GitHub workflows. Updated the VERSION environment variable in packages.yml to reflect the new versioning scheme. These changes ensure consistency with the new preview release.
* Update versioning to include 'preview' in package workflow
Modified the workflow to append 'preview' to the version number for non-tagged builds. This ensures clearer differentiation between stable and non-stable versions in the CI pipeline.
* Add WorkflowInstanceStorageDriver for workflow variable storage
Introduced a new storage driver, WorkflowInstanceStorageDriver, to store workflow variables directly in the workflow state. Updated relevant classes and methods to incorporate this new storage driver, ensuring seamless read/write/delete operations and extending support for it throughout the codebase.
* Refactor object conversion and update variable retrieval.
Switched from JsonObject to JsonNode for object conversion and corrected a typo in the summary comment. Changed the return type of GetVariablesDictionary method and updated its implementation to use VariablesDictionary.
* Rename 'input' to 'serializedInput' in DispatchWorkflowDefinition.
This change clarifies that the input provided to the workflow should be serialized. It enhances the readability and accuracy of the code documentation, ensuring that developers understand the expected format of the input parameter.
* Add priority and deprecation attributes to storage drivers
Introduced a priority attribute to the `IStorageDriver` interface and implemented it in various storage drivers. Additionally, marked `WorkflowStorageDriver` as deprecated and reordered storage driver listing based on priority.
* Switch MassTransit broker to in-memory and refactor converter
Changed MassTransit broker from AzureServiceBus to in-memory for improved performance in development environment. Simplified PolymorphicObjectConverterFactory by removing redundant constructor and dependencies. Removed unused folder from the project file.
Changed storage driver types for 'Products' and 'Product' variables to `WorkflowInstanceStorageDriver`. Refactored JavaScript handling to properly process variables and exclude input names from overwriting. Re-enabled a previously skipped array sorting test.
* Add variable support and engine configuration for JavaScript
Implemented handling of workflow variables in JavaScript expressions, including new handlers, notifications, and variable definitions. Enhanced type definition services and providers to include variable definitions, updated dependency injections, and applied modifications for improved backend API configuration.
* Add ObjectConverterHelper for JS object conversion
Implemented ObjectConverterHelper to convert .NET objects to JavaScript objects in EvaluateJavaScript context. Updated ConfigureEngineWithVariables handler to process and convert variables using the new helper utility.
* Add Customer and Order models and update Program.cs
Created new Customer and Order model classes in the Models namespace. Updated Program.cs to include and alias these models for use in the application.
* Add two new activities and integration test
Introduced `Activity1` and `Activity2` under `src/apps/Elsa.Server.Web/Activities`. Additionally, created a new integration test `VariablesInteropTests` to validate JavaScript variable modifications within workflows.
* Refactor to use IBookmarkQueue instead of IBookmarkResumer
Replaced IBookmarkResumer with IBookmarkQueue in various classes for enqueueing bookmark queue items. Added logging for better traceability and included additional helper imports for activity type name generation.
* Add correlationId tag to OpenTelemetry tracing
This change adds a correlationId tag to the tracing for workflow executions if the context contains a correlationId. This enhancement improves traceability and correlation across distributed systems.
* Set Correlation ID header in MassTransit messages
Added logic to set the "X-Correlation-ID" header in MassTransit messages if the CorrelationId is present. This ensures that the messages can be correlated properly across different parts of the system.
* Reduce logging verbosity in appsettings.json
Removed detailed debug logs for various Elsa workflows and middleware components from the appsettings.json. This change aims to streamline the log outputs, focusing on warnings and critical information to improve readability and debug efficiency.
* Add OpenTelemetry.Api package version 1.9.0
Include OpenTelemetry.Api to list of package versions in Directory.Packages.props. This addition aims to enhance application monitoring and observability.
* Add JavaScript variable handling integration test
Introduced integration tests for JavaScript activities to verify they can access and modify native variables. Added classes for data setup, test execution, and workflow definition with corresponding NUnit tests.
* Remove unused activities and models
Deleted several unused activity classes, models, and middleware to simplify the codebase. This cleanup helps reduce code complexity and improves maintainability. Updated Program.cs to reflect these deletions.
* Remove correlation ID header setting from dispatch
Simplified the workflow dispatching process by removing the redundant setting of the X-Correlation-ID header in two places. This change should improve code readability and maintainability.
* Format code block consistently
Corrected the indentation of the code block for better readability and consistency. This ensures all properties in the 'DispatchWorkflowInstance' initialization are properly aligned. No functional changes were made in this commit.
* Remove VariablesInteropTests.cs from integration tests
Deleted the VariablesInteropTests.cs file which contained a single test method testing JavaScript-to-JSON serialization. This cleanup removes unnecessary test code from the repository.