Commit graph

488 commits

Author SHA1 Message Date
Sipke Schoorstra bdfbd0886f
Add ForEach tests, introduce asynchronous workflow runner and enhance workflow events. (#6926)
* Introduce asynchronous workflow runner and enhance workflow events.

- Added `AsyncWorkflowRunner` to enable asynchronous workflow execution and result tracking.
- Introduced new event arguments, such as `ActivityExecutedEventArgs` and `WorkflowStateCommittedEventArgs`.
- Expanded `WorkflowEvents` class to include `ActivityExecuted`, `ActivityExecutedLogUpdated`, and `WorkflowStateCommitted` events.
- Refactored event arguments into the `Elsa.Testing.Shared.EventArgs` namespace.
- Enhanced tests with `AsyncWorkflowRunner` and new event-driven workflow scenarios.

* Refactor event argument classes to unify namespace and simplify inheritance

* Add shared component DotSettings file to support namespace exclusions
2025-09-24 20:06:00 +02:00
Sipke Schoorstra 67fb43e0ba
Remove TlsSmoke project and related solution references
- Deleted `TlsSmoke` project files (`Program.cs` and `TlsSmoke.csproj`).
- Removed `TlsSmoke` project reference from the solution file (`Elsa.sln`).
2025-09-19 12:07:13 +02:00
Sipke Schoorstra 42ac08c575
Ensure Docker images ship CA trust and add TLS smoke tests (#6918) 2025-09-19 11:57:30 +02:00
Sipke Schoorstra b613ff6b61
Addresses workflow identity reload conflict (#6909)
* Refactor `IndexTriggersAsync` to use `WorkflowDefinition` and update null assignment for serialization logic.

* Change default parameter value from `default` to `null` in `UseFluentStorageProvider` method signature.

* Add in-memory workflows provider and materializer for integration tests

Introduced `InMemoryWorkflowsProvider` and `InMemoryWorkflowMaterializer` to support integration testing scenarios for workflow definition population. Enhanced workflow handling with fluent method `WithId` for `WorkflowBuilder`. Updated event publishing and dependency injection logic.

* Remove extraneous whitespace in DefaultWorkflowDefinitionStorePopulator.

* Refine test class documentation for `WorkflowDefinitionStorePopulation` scenario.
2025-09-15 11:56:01 +02:00
Sipke Schoorstra 9739aebb82
Update component tests to expect NotFound for missing DefinitionId and fix BaseAddress inconsistency (#6885) 2025-09-02 09:33:27 +02:00
Sipke Schoorstra 3702fcfc7c
Restore ability to send no body and no content type to Execute endpoint (#6882)
* Refactor workflow execution endpoints and introduce helper utility

Replaced `EndpointBase` class with lighter `WorkflowExecutionHelper` for handling workflow execution logic. Simplified Get & Post endpoints and added comprehensive component tests for enhanced validation.

* Update GetTests to expect NotFound instead of BadRequest
2025-09-01 09:49:07 +02:00
Sipke Schoorstra 6764d4acc4
Fix log string template argument processing (#6880)
* Refactor logging system and replace JsonDestructuringConsoleFormatter.

Removed `JsonDestructuringConsoleFormatter` in favor of native JSON console formatting. Introduced `LogArgumentHelper` to process log arguments efficiently and added comprehensive unit tests. Updated `ConsoleLogSinkOptions` to use extensible `JsonFormatterOptions`.

* Refactor `LogArgumentHelper` methods for clarity and remove redundant string handling logic.

* Update src/modules/Elsa.Logging.Core/Helpers/LogArgumentHelper.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Logging.Core/Helpers/LogArgumentHelper.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Logging.Core/Helpers/LogArgumentHelper.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor `LogArgumentHelper` to improve type handling and dictionary conversion

Introduced a temporary list in `ConvertDictionaryToPairs` for better handling of dictionary entries. Updated property-to-pair conversion to cast results as objects, ensuring type consistency.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-28 21:10:32 +02:00
Sipke Schoorstra ca85fe0f6d
Improve Logger With Destructuring of ExpandoObject (#6877)
* Initial implementation of log activity + base sink

* Refactor logging implementation: replace `Elsa.ProcessLogging` with a new modular `Elsa.Logging` framework, introducing support for configurable log sinks, enhanced logging extensibility, and updated dependencies in consuming projects.

* Enhance logging framework: introduce custom `NullableBoolConverter` and update JSON serialization/deserialization logic for log sink handling.

* Update description for `Log` activity input: clarify target sinks configuration

* Set default value of `SinkNames` input in `Log` activity to non-nullable collection

* Set `DisplayName` for `Sinks` input in `Log` activity

* Refactor logging framework: update `ILogSink` and `ILogSinkRouter` to support arguments and attributes, enhance `Log` activity to use updated interfaces, and add default category handling.

* Refactor logging framework: simplify argument handling in `ILogSink` and `ILogSinkRouter`, update `Log` activity inputs, and improve message formatting in `MelLogSink`.

* Update logging framework to simplify log sink creation, enhance category filtering, and refactor `ILogSink`/`ILogSinkRouter` interface methods.

* Introduce modular logging framework enhancements: add `Console` and `Serilog` logging features, refactor `ILogSink` framework, and update projects to align with a modular architecture.

* Refactor logging framework: introduce `AddCategoryFilters` extension, replace `DefaultCategory` handling with enhanced category filters, and update sink creation logic for consistency.

* Refactor logging framework: rename `SinkOptions` to `LogSinkOptions`, standardize naming across log sink types, and update configuration and sink factory logic for consistency.

* Enhance logging framework: add `ConfigureDefaults` methods, update `ILogSinkCatalog` to use `IServiceScopeFactory`, and improve logging configuration handling and defaults setup.

* Introduce asynchronous log entry processing: add `ILogEntryQueue`, `LogEntryBackgroundWorker`, and related models to enable queue-based logging and background processing. Update `Log` activity to enqueue log entries for processing.

* Add unit and integration tests for `Elsa.Logging.Core` library, refactor logger setup in `Elsa.Server.Web`, enhance logging configuration, and standardize `Directory.Packages.props` file.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add documentation comments to logging framework classes, interfaces, methods, and factories to enhance code readability and maintainability. Remove unused `CustomPurpleConsoleFormatter` class and `logs` folder from server project.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Make `LogEntryInstruction` and `LogEntryQueue` classes public and simplify return statement in `LogSinkCatalog.ListAsync` method.

* Standardize terminology in `ILogSink` interface and `LoggerSink` implementation: rename `properties` to `attributes`. Update project files and solution structure to reflect integration test additions.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update documentation comments in `LoggingFeature` and `LogEntryInstruction` to clarify functionality and improve precision.

* Add README for `Elsa.Logging` module with configuration examples, usage details, and extension guidance.

* Add `Dictionary` UI hint to `InputUIHints` and update `Attributes` in `Log` activity to use it.

* Update `Log` activity default category to "Process", add integration tests for logging, and enhance null safety in `ConfigurationLogSinkProvider`.

* Remove `UseLoggingFramework` middleware from `Program.cs` to streamline workflow initialization.

* Refactor `LoggerSink` to simplify logging logic and remove unused `FormatMessage` method. Enhance `Log` activity argument handling by introducing JSON parsing for string inputs.

* Refactor logging tests to improve consistency and update variable initialization in `WorkflowExecutionContext` for cleaner syntax.

* Replace mocked logger dependencies in tests with `TestLogger` and `TestLoggerFactory` for improved readability and maintainability.

* Add `JsonDestructuringConsoleFormatter` for structured JSON logging and update logging configuration to support new formatter.

* Refactor JSON converters: replace `NullableBoolConverter` with `NullableBooleanConverter` and `BooleanConverter` for improved readability and consistency.

* Add error handling and logging to `LogEntryBackgroundWorker`

Introduce exception handling with logging in `LogEntryBackgroundWorker` to capture and log errors during log entry processing. Added `ILogger` dependency for structured error reporting.

---------

Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-28 08:53:15 +02:00
Sipke Schoorstra 8645493b04
Introduces modular logging framework (#6872)
* Initial implementation of log activity + base sink

* Refactor logging implementation: replace `Elsa.ProcessLogging` with a new modular `Elsa.Logging` framework, introducing support for configurable log sinks, enhanced logging extensibility, and updated dependencies in consuming projects.

* Enhance logging framework: introduce custom `NullableBoolConverter` and update JSON serialization/deserialization logic for log sink handling.

* Update description for `Log` activity input: clarify target sinks configuration

* Set default value of `SinkNames` input in `Log` activity to non-nullable collection

* Set `DisplayName` for `Sinks` input in `Log` activity

* Refactor logging framework: update `ILogSink` and `ILogSinkRouter` to support arguments and attributes, enhance `Log` activity to use updated interfaces, and add default category handling.

* Refactor logging framework: simplify argument handling in `ILogSink` and `ILogSinkRouter`, update `Log` activity inputs, and improve message formatting in `MelLogSink`.

* Update logging framework to simplify log sink creation, enhance category filtering, and refactor `ILogSink`/`ILogSinkRouter` interface methods.

* Introduce modular logging framework enhancements: add `Console` and `Serilog` logging features, refactor `ILogSink` framework, and update projects to align with a modular architecture.

* Refactor logging framework: introduce `AddCategoryFilters` extension, replace `DefaultCategory` handling with enhanced category filters, and update sink creation logic for consistency.

* Refactor logging framework: rename `SinkOptions` to `LogSinkOptions`, standardize naming across log sink types, and update configuration and sink factory logic for consistency.

* Enhance logging framework: add `ConfigureDefaults` methods, update `ILogSinkCatalog` to use `IServiceScopeFactory`, and improve logging configuration handling and defaults setup.

* Introduce asynchronous log entry processing: add `ILogEntryQueue`, `LogEntryBackgroundWorker`, and related models to enable queue-based logging and background processing. Update `Log` activity to enqueue log entries for processing.

* Add unit and integration tests for `Elsa.Logging.Core` library, refactor logger setup in `Elsa.Server.Web`, enhance logging configuration, and standardize `Directory.Packages.props` file.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add documentation comments to logging framework classes, interfaces, methods, and factories to enhance code readability and maintainability. Remove unused `CustomPurpleConsoleFormatter` class and `logs` folder from server project.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Make `LogEntryInstruction` and `LogEntryQueue` classes public and simplify return statement in `LogSinkCatalog.ListAsync` method.

* Standardize terminology in `ILogSink` interface and `LoggerSink` implementation: rename `properties` to `attributes`. Update project files and solution structure to reflect integration test additions.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update documentation comments in `LoggingFeature` and `LogEntryInstruction` to clarify functionality and improve precision.

* Add README for `Elsa.Logging` module with configuration examples, usage details, and extension guidance.

* Add `Dictionary` UI hint to `InputUIHints` and update `Attributes` in `Log` activity to use it.

* Update `Log` activity default category to "Process", add integration tests for logging, and enhance null safety in `ConfigurationLogSinkProvider`.

* Remove `UseLoggingFramework` middleware from `Program.cs` to streamline workflow initialization.

---------

Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-25 09:55:27 +02:00
Sipke Schoorstra 2175a3470a
Refactors JavaScript type handling (#6858)
* Exclude blacklisted types (`string`, `object`, `Array`, `DateTime`) from workflow variable registration logic.

* Add integration tests for JavaScript evaluation and update type blacklist in `ConfigureEngineWithVariableTypes`

* Disable central package transitive pinning and update Elsa Studio version to `3.5.0`.

* Update Microsoft version to 9.0.8 in Directory.Packages.props

* Enable central package transitive pinning in `Directory.Packages.props`.
2025-08-20 14:10:16 +02:00
Sipke Schoorstra d72c4974d2
Refactor ObjectConverter to improve readability and add backward-compatible default value handling in non-strict mode. (#6852)
* Refactor `ObjectConverter` to improve readability and add backward-compatible default value handling in non-strict mode.

* Add `StrictMode` option to `ObjectConverterOptions` and update related tests

Introduced a `StrictMode` option to `ObjectConverterOptions` to control strict type conversion behavior. Updated the `ObjectConverter` logic to utilize this new option and refactored unit tests to include `ObjectConverterOptions` where necessary, ensuring comprehensive test coverage for strict and non-strict mode scenarios.

* Fix ObjectConverter default value handling and update unit tests

Standardize usage of `targetType` for default values in `ObjectConverter`. Refactor and consolidate unit tests to improve coverage and clarity, addressing various conversion and exception scenarios.
2025-08-11 08:50:45 +02:00
Sipke Schoorstra 7b75f0c89f
Implement retry attempt capturing (#6674)
* Update default initializations and input parameters to `null`

Replaced `default!` with explicit `null` for input parameters and properties throughout various classes. Adjusted constructors' default values for consistency and readability. This change ensures better clarity and alignment with nullable reference types.

* Add Polly-based resilience integration for retry tracking

Introduce Polly diagnostics to log retry events in the execution context. Updated resilience strategy interfaces and implementations to support Polly's context and retry event tracking.

* Refactor resilience and retry handling, add flaky endpoint.

Removed custom Polly-based diagnostic listeners and observers in favor of a transient status code utility class. Introduced a mock "flaky" endpoint for testing failure scenarios and updated configuration for resilience strategies. Minor namespace fixes

* Add retry attempt recording to resilience feature

Introduce `IRetryAttemptRecorder` and its implementations to enable recording of retry attempts during activity execution. Updated `ResilientActivityInvoker` to persist retry attempts and modified `ResilienceFeature` to support configurable retry attempt recorders.

* Add retry attempt tracking and retrieval functionality

Introduced mechanisms to track and fetch retry attempts, including new interfaces, reader implementations, API endpoints, and related models. These enhancements improve resilience tracking and data access for activity execution across workflows.

* Add GetOutcome method to RetryAttempt model

Introduce a GetOutcome method to encapsulate logic for determining the retry attempt's outcome. It prioritizes the Result, falls back to the Exception message, or defaults to "Unknown" if neither is available. This improves clarity and reusability of the outcome evaluation.

* Add scoped registration for _retryAttemptReader

This change ensures that _retryAttemptReader is registered in the DI container as a scoped service.

* Refactor retry mechanism to support detailed retry metadata

Introduced a `CollectRetryDetails` method to `IResilientActivity` for enhanced retry data collection. Updated `RetryAttemptRecord` to include a `Details` dictionary for capturing metadata, replacing previous `Result` and `Exception` fields. These changes simplify the retry recording process and improve extensibility for tracking retry details across activities.

* Add support for capturing background activity properties

Introduced functionality to capture and persist background activity properties during workflow execution. This includes defining a key for properties, capturing them in middleware, and storing them in the workflow execution context. These changes ensure properties are handled consistently alongside other activity data.

* Add support for storing and propagating activity execution properties

Introduced a `Properties` dictionary to track additional metadata in activity execution records and stats, enabling richer diagnostics and tracing. Refactored resilience logic to improve retry handling and propagate retry-related flags in workflows. Enhanced database queries to map serialized properties for execution summaries.

* Add retry propagation for background activity execution

Introduced a mechanism to propagate the retry-attempted flag across activity execution contexts. Added a new notification `BackgroundActivityExecutionCompleted` and updated related middleware to send this notification. Enhanced resilience features to handle and propagate retry state effectively.

* Refactor default parameters and values to use 'null'.

Replaced 'default' with 'null' for optional parameters and values in `AddExecutionLogEntry`, improving clarity and ensuring semantic consistency with nullable types. No functional changes were introduced.

* Refactor flaky endpoint and enhance resilience support.

Replaced the "Flaky" endpoint with a more robust "SimulateResponseEndpoint" under a new module. Introduced a status code lookup utility and improved resilience strategies with configurable backoff types. Updated serialization to support enum conversions and enhanced caching behavior for response simulation.

* Update activity execution models with nullable properties

Replaced `default!` initializations with `null!` to ensure correct handling of nullable string properties in `ActivityExecutionRecord`. Added a new `Properties` dictionary to `ActivityExecutionRecordSummary` to store additional activity execution data. This enhances model flexibility and data extensibility.

* Add support for recording resilience strategy in context

Introduced a new method to store resilience strategy details in the activity execution context for enhanced diagnostics. Updated `ResilientActivityInvoker` to serialize and set the resilience strategy using this method, leveraging `JsonSerializer`.

* Remove redundant PropertyNamingPolicy assignment

The PropertyNamingPolicy was set to the default value (CamelCase), making the assignment unnecessary. This change simplifies the code while maintaining existing functionality.

* Set JSON property naming policy to camelCase

Updated JSON serialization settings to use camelCase naming for property names. This improves consistency with standard JSON naming conventions and ensures compatibility with camelCase-based APIs.

* Remove unused Endpoints folder reference from project file

The Endpoints folder reference in the project file was unnecessary and has been removed. This cleanup helps maintain a tidy and accurate project structure.

* Remove unused RetryAttemptFilter and add Polly packages

Removed the obsolete RetryAttemptFilter class as it was no longer in use. Added Polly and Polly.Extensions packages to the project to support resilience and fault-handling strategies. This update aligns with keeping dependencies relevant and reducing unused artifacts.

* Add resilience integration test for FlowSendHttpRequest (#6692)

* Refactor and fix resilience test cases for clarity and accuracy

Simplified imports, adjusted code structure, and corrected attempt indexing logic in resilience tests. These changes improve readability, maintainability, and ensure accurate validation of retry attempts in test scenarios.
2025-05-26 11:47:09 +02:00
Sipke Schoorstra f93ac41489 Replace default! with null! for better nullability safety
Updated default property values across activities to use `null!` instead of `default!`, ensuring clearer nullability intent. Also adjusted constructor parameter defaults to `null` for consistency.
2025-05-25 19:26:38 +02:00
Sipke Schoorstra ab59ebc12f
Skip flaky test in InputOutputLoggingTests.
The `WorkflowAsActivityInternal_ShouldHonorSettings_WhenExecuting` test is marked with `[Fact(Skip)]` due to intermittent failures. The issue appears unclear, despite the functionality working as expected in practice.
2025-05-20 11:41:00 +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 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 7fadf51be6
Fix Output Persistence of Async Activities (#6542)
* Updated output handling of asynchronously run workflows to be the same as when run synchronously

* updated tests

* Refactor activity execution mapping and output persistence

Introduced `GetPersistableOutputAsync` in `IActivityExecutionMapper` to streamline output persistence logic. Refactored the handling of activity persistence properties, replacing repetitive code with reusable methods. Removed unused dependencies and redundant methods, optimizing code readability and maintainability.

* Remove docker-compose-datadog.yml from solution file.

The docker-compose-datadog.yml file is no longer included in the solution structure. This change cleans up unused references to ensure the solution remains consistent and up-to-date.

* Refactor workflow extensions and add new utilities

Split and reorganize workflow-related extension methods into `RunActivityExtensions` and `RunWorkflowExtensions` for better modularity. Removed deprecated methods from `ServiceProviderExtensions`. Updated tests and usages to reflect these changes.

---------

Co-authored-by: Bob Hauser <rhauser@kinaxis.com>
2025-04-01 07:53:00 +02:00
Sipke Schoorstra 952cbb4edc
Add strict type checking for variable parsing (#6536)
* Add strict type checking for variable parsing

Introduced a `StrictMode` flag for variables, enforcing stricter type validation during parsing and conversions. Updated related methods and tests to reflect the stricter parsing behavior, ensuring consistent type compatibility and error handling.

* Refactor StrictMode handling and improve ObjectConverter logic

Moved StrictMode flag from Variable to ObjectConverter for better cohesion and updated related references. Additionally, removed unused parameters and simplified ObjectConverterOptions to streamline configuration and maintain consistency across the codebase.

* Refactor type conversion logic and update logging defaults

Improve type conversion reliability by introducing `TryConvertValue` and refining exception handling. Update JSON scenarios to use "Inherit" as the default for log persistence modes, ensuring consistency across configurations.

* Refactor exception handling in ObjectConverter.

Introduce a helper method `ReturnOrThrow` to streamline and centralize exception handling logic. This change also adds support for non-strict mode, allowing value fallback instead of throwing exceptions when enabled.

* Add numeric type checks and improve type conversion handling

Introduce `IsNumericType` extension method to identify numeric types. Enhance type conversion logic in `ObjectConverter` to handle numeric, boolean, and string types more accurately. Update variable deserialization workflows to handle conversion failures gracefully.

* Set a default comment for ObjectConverter.StrictMode assignment

Added a comment clarifying that StrictMode is set to its default value. This improves code readability and helps maintainers understand the intent.

* Fix formatting inconsistencies and improve code clarity

Removed redundant whitespace and adjusted formatting to align with coding standards. These changes enhance the readability and maintainability of the code without altering functionality.

* Fix typo in Program.cs variable comment

Corrected a minor issue in the comment for `identityTokenSection` to remove the unnecessary "Modify" text. This change improves code readability and removes potential confusion for developers.

* Simplify imports in ModifyVariableHandler.cs

Removed unused `Microsoft.Extensions.Options` and `Elsa.Workflows.Options` imports to clean up dependencies and improve maintainability. This change reduces clutter without affecting the existing functionality.
2025-03-31 18:11:14 +02:00
Sipke Schoorstra 8bf58c5c60
Add support for activity output testing (#6529)
* Add support for activity output testing

Removed obsolete test workflows and updated the If activity tests to align with simplified testing practices. Introduced `GetActivityOutput` extension for retrieving activity outputs from workflow results. Refactored related APIs to simplify execution flow and unified cancellation token handling in service methods.

* Remove unused Parlot.Fluent namespace in IfTests.cs

This commit removes an unused "using" directive for the Parlot.Fluent namespace in the IfTests.cs file. Cleaning up unused references helps maintain code clarity and reduces potential confusion.
2025-03-31 18:10:59 +02:00
Sipke Schoorstra 8e9d5e356e
Handle conversion of enumerables to arrays in ObjectConverter (#6508)
* Handle conversion of enumerables to arrays in ObjectConverter

Added functionality to convert enumerables to arrays when the target type is an array. The implementation ensures each item is properly cast to the target array's element type and then added to the resulting array.

* Add unit test for converting object array to double array

This commit introduces a new test ensuring the proper conversion of an object array of doubles to a double array. It verifies both the validity of the conversion and that the result is not null.
2025-03-18 16:09:49 +01:00
Sipke Schoorstra d8208d2fe7
Merge pull request #6495 from elsa-workflows/enh/explicit-deterministic-variable-id
Refactor variable initialization for clarity and consistency
2025-03-14 23:05:35 +01:00
Sipke Schoorstra 094291b673
Merge branch 'main' into enh/workflowinstance-name 2025-03-14 23:03:33 +01:00
Sipke Schoorstra 88744c720d
Fix incorrect syntax for generating GUID in CountdownWorkflow
Corrected the syntax for defining the static `DefinitionId` property. This ensures the GUID is generated properly without causing runtime issues.
2025-03-13 21:34:18 +01:00
Sipke Schoorstra ef71a3e731
Remove unnecessary whitespace in CountdownWorkflow.cs
Eliminated extraneous whitespace to improve code cleanliness and consistency. This change does not affect functionality but adheres to coding style guidelines.
2025-03-13 21:24:32 +01:00
Sipke Schoorstra 3be1220c4d
Refactor CountdownWorkflow tests
Updated CountdownWorkflowTests to simplify BookmarkFilter instantiation and restored active CountdownWorkflow logic.
2025-03-13 21:20:46 +01:00
Sipke Schoorstra 923e9d335d
Refactor variable initialization for clarity and consistency
Updated variable constructors across the codebase to use explicit names and initial values where applicable. Deprecated old constructor overloads and added new methods and overloads for better flexibility and readability. Minor cleanup includes replacing `default` keywords with `null` and streamlining code syntax.
2025-03-13 21:05:28 +01:00
Bob Hauser 6a42857f22 Fixes issue with FlowJoin(WaitAny) where activities can be executed multiple times 2025-03-08 19:59:55 -05:00
Sipke Schoorstra 13d7e91e0d
Remove agent-related configurations and dependencies.
This commit removes the "Agents" configuration section, related API keys, services, and persistence logic across the codebase. Unused agent-related NuGet packages and code references were also eliminated to simplify the project and focus on core functionality.
2025-03-02 16:08:51 +01:00
Sipke Schoorstra 74a1c50f66
Remove Agents projects
Deleted Agents projects. These projects are being migrated to elsa-integrations.
2025-03-02 15:55:29 +01:00
Sipke Schoorstra 046b88f5d2
Improved support for named workflow instances
Introduced the ability to set and persist custom names for workflow instances. Updated relevant classes, services, and tests to ensure proper handling of the `Name` property.
2025-03-02 11:17:18 +01:00
Sipke Schoorstra 43157fb6d6
Remove Azure Service Bus integration and related tests
Deleted the entire Azure Service Bus module, including activities, configurations, tests, and supporting code. This removal eliminates features like message handling workflows, queue/topic providers, and unit testing utilities for Azure Service Bus.
2025-02-23 23:43:15 +01:00
Bob Hauser 4e76a32e4e Update flowchart activity scheduling, implicit join (and FlowJoin/WaitAll) now only waits for followed connections 2025-02-12 23:27:40 -05:00
Sipke Schoorstra 71c0a5396e Add "Item 3" to looping workflow test scenarios.
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.
2025-01-30 23:29:46 +01:00
Sipke Schoorstra e54e116977 Fix activity output
Updated `ActivityOutputRegister` to always return the last output value. Added new integration test to validate the functionality.
2025-01-30 22:56:30 +01:00
Sipke Schoorstra 0560d11432 Improve JSON array conversion in ObjectConverter
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.
2025-01-29 10:50:42 +01:00
Sipke Schoorstra cc694bf15b Use var for local variables in test cases
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.
2025-01-14 23:19:51 +01:00
Sipke Schoorstra efd114944c Refactor and enhance JavaScript and object conversions.
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.
2025-01-14 23:16:29 +01:00
Sipke Schoorstra b2331f73db Handle collection and array serialization in TypeJsonConverter
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.
2025-01-11 20:23:05 +01:00
sergergood 3e76e3efb0 Added example of perfomance test 2024-12-27 18:57:22 +03:00
Sipke Schoorstra 0992404d96 Add integration test for workflow serialization
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`.
2024-12-26 11:17:54 +01:00
Mathijs Dumon c25ef53dcc Fix for #6082 - dropdowns are not populated for inputs without UIHints 2024-12-16 16:15:58 +01:00
Sipke Schoorstra 4770c21604 Refactor DispatchWorkflows tests and skip flaky test.
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.
2024-12-14 20:30:27 +01:00
Sipke Schoorstra b99c0c8412 Disable flaky test in BulkDispatchWorkflowsTests.
Commented out a test that was marked as flaky and skipped. This ensures the test suite remains reliable while the issue is addressed in the future.
2024-12-14 20:01:11 +01:00
Sipke Schoorstra bd9e006900 Skip flaky BulkDispatchWorkflows test temporarily
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.
2024-12-14 19:40:44 +01:00
Sipke Schoorstra cb6a7dfc11 Update RabbitMQ image to version 4-management
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.
2024-12-14 11:44:52 +01:00
Sipke Schoorstra 4793c6eac5 Refactor ProtoActor and workflow testing logic
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.
2024-12-14 09:59:29 +01:00
Sipke Schoorstra 9d00466ef3
Merge pull request #6157 from Suchiman/fixPrimitiveSerialization
Fix Primitive Collection serialization
2024-12-11 08:59:02 +01:00
Robin Sue 4d6b7a17fb Add .NET 9.0 target 2024-12-10 21:06:42 +01:00
Sipke Schoorstra 75cb3a3de2
Add synthetic properties to JS engine for exclusion (#6178)
* 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.
2024-12-05 09:30:31 +01:00
Robin Sue c4a6ce2796 Fix Primitive Collection serialization
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.
2024-12-04 15:47:01 +01:00