Commit graph

35 commits

Author SHA1 Message Date
Sipke Schoorstra 50f858a8ce
Update safe dependency patch versions (#7459)
* Update dependency patch versions

* Align NuGet packaging dependency pin
2026-05-17 19:10:19 +02:00
Sipke Schoorstra c27bbd4ec2
Adds activity execution call stack support (#7271)
* Adds activity execution call stack support

Implements a call stack mechanism to track the execution chain, enabling visibility into the invocation hierarchy.

Introduces new fields to scheduling models and runtime contexts to store call stack information.

Includes EF Core migrations for various database providers to support new columns in `ActivityExecutionRecords`.

Provides an API to query and reconstruct the call stack for a given activity execution.

* Refactor: Replace `PagedCallStackResult` with `Page<T>` for execution chain pagination

* Remove ambient scheduling scope logic and related methods

Simplifies scheduling logic by removing ambient scope mechanisms, refactoring scheduling context handling, and updating affected classes accordingly.

* Add `GetCallStackAsync` to `IActivityExecutionsApi` for querying activity execution call stack

* Add new properties to `ActivityExecutionRecord` for scheduling and execution tracking

Introduce fields for aggregated fault count, scheduling context, workflow instance details, and call stack depth to enhance execution monitoring and debugging capabilities.

* Add call stack visualization for activity executions

Introduced components and models to display a call stack for activity executions in the Workflow Instance Viewer. This includes UI elements for call stack rendering, error handling, and data integration with activity execution records.

* Remove obsolete ambient scheduling properties from WorkflowExecutionContext

* Fix infinite loop issues in activity execution chain traversal

Added cycle detection using a `HashSet` to prevent infinite loops when traversing activity execution chains in multiple storage implementations. Updated unit tests to validate correct handling of circular references and chain traversal.

* Refactor activity execution chain retrieval logic

Centralized the `GetExecutionChainAsync` method into an extension class to streamline and unify its implementation across stores. Removed redundant implementations from individual stores and updated interfaces to utilize the new extension method. This reduces code duplication and simplifies future maintenance.

* Add CallStackDepth property to activity contexts

Integrated the `CallStackDepth` property into `ActivityExecutionContext`, `ActivityExecutionContextState`, and related classes to track and manage the call stack depth of activity executions. Removed obsolete depth calculation logic to streamline the process.

* Add unit tests for call stack depth calculations and persistence

- Add `WorkflowExecutionContextTests` to verify correct calculation of call stack depth during activity execution.
- Add `WorkflowStateExtractorTests` to ensure call stack depth is preserved during state extraction and application.

* Update src/modules/Elsa.Workflows.Api/Endpoints/ActivityExecutions/GetCallStack/Endpoint.cs

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

* Update src/modules/Elsa.Workflows.Api/Endpoints/ActivityExecutions/GetCallStack/Endpoint.cs

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

* Enhance activity execution handling with ID filter and task completion logic

- Implement `ActivityExecutionRecordFilter` for precise query matching by ID.
- Add await logic for task completion in command handler middleware.

* Add missing indexes for call stack columns in V3_7 migrations (#7250)

* Initial plan

* Add missing indexes for call stack columns in all provider migrations

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Optimize migrations by creating columns with correct indexable types

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Add unit tests for ActivityExecutionStoreExtensions

- Introduce tests for `GetExecutionChainAsync` covering scenarios of empty results, single records, multi-level chain traversal, workflow boundary constraints, pagination, and circular references.

* Refactor tests for `ActivityExecutionStoreExtensions`

- Replace mock setup with `CreateStore` helper for clean and clear test arrangements.
- Remove unused imports and clean up test setup for improved readability and maintenance.

* Remove unused imports from ActivityExecutionLogStore in Elsa.Persistence.EFCore module.

* Removes obsolete planning document

Removes the activity execution call stack planning document
as the feature has been implemented.

* Remove DefaultActivityExecutionMapperTests

- Deleted `DefaultActivityExecutionMapperTests.cs` as the test class is no longer in use and redundant.

* Address review feedback: Fix corrupted test, Oracle migrations, and call stack depth calculation (#7272)

* Initial plan

* Fix corrupted DefaultActivityExecutionMapperTests.cs test file

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Fix Oracle migration snapshot to use NCLOB for large text fields

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Optimize GetExecutionChainAsync to avoid loading all workflow instance records

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Fix CallStackDepth calculation to support cross-workflow invocations

- Add SchedulingCallStackDepth to ActivityInvocationOptions
- Update WorkflowExecutionContext to use provided depth when scheduling context not found
- Remove problematic test that reveals pre-existing bug with duplicate contexts

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Improve documentation for CallStackDepth calculation

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Add WorkflowStateExtractor to ActivityTestFixture services

* Refactor `DefaultActivityExecutionMapperTests` with `ActivityTestFixture` and add project reference for shared testing utilities.

* Propagate SchedulingCallStackDepth through cross-workflow invocation chain (#7273)

* Initial plan

* Add SchedulingCallStackDepth propagation through cross-workflow invocation chain

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Add unit tests for CallStackDepth propagation across workflow boundaries

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Initial plan (#7274)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Reduce NVARCHAR2 column sizes in Oracle migrations to optimize storage and improve performance.

* Change column types to NCLOB for large text fields in Oracle migrations to enhance data storage capacity.

* Update GitHub Actions to use .NET 10.x and refactor setup classes for consistency

* Improve test project detection in GitHub Actions by handling non-csproj files and updating project sorting mechanism.

* Enhance GitHub Actions to display .NET environment info and enforce .NET 10 toolchain for test execution.

* Update GitHub Actions to use .NET SDK 10.0.1xx and enforce its usage for builds and tests.

* Refine GitHub Actions workflow by narrowing test project search to the `test/unit` directory and removing unnecessary script checks.

* Remove redundant build step from GitHub Actions workflow.

* Enhance GitHub Actions workflow by adding multiple test directories and handling ignored failed sources in .NET restore.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
2026-02-24 15:23:59 +01:00
Matt 0f443e9419 Simplify Nuget package dependencies between .net versions. 2025-12-08 21:03:47 +00:00
Sipke Schoorstra a1d4e541fc
Add Elsa Script DSL (#7076)
* Update packages.yml

* Update elsa-server-and-studio.yml

* Update elsa-server.yml

* Update elsa-studio.yml (#6715)

* Update ListWorkflowDefinitionsRequest.cs (#6761)

Remove unnecessary line breaks

* Correct namespace and import for `ConfigureEngineWithVariableTypes`.

* Resolves build issues, update package versions and restructure project references

- Updated multiple package versions in `Directory.Packages.props` for better dependency management, including `BenchmarkDotNet`, `FastEndpoints`, and `Microsoft.Extensions.Http.Resilience`.
- Minor version upgrade for `System.Formats.Asn1` in `_build.csproj`.
- Replaced project reference to `Elsa.csproj` with `Elsa.IO.Http.csproj` in `Elsa.ServerAndStudio.Web.csproj`, enhancing modularity.
- Added new using directive for `Elsa.IO.Http.Features` in `Program.cs` to support new HTTP functionalities.

* Remove unused project references from Elsa.sln

These changes indicate that the associated projects or dependencies are no longer needed or have been replaced by other components in the solution.

* Rename copilot-setup-steps.yml.yml to copilot-setup-steps.yml

* Update RawStringContent encoding in JsonContentFactory (#6786)

* Update RawStringContent encoding in JsonContentFactory

Modified the instantiation of `RawStringContent` to use a
new `UTF8Encoding` instance with `encoderShouldEmitUTF8Identifier`
set to `false`, affecting the handling of the UTF-8 byte order
mark (BOM) in serialized JSON content. Fixes a bug with content length being different than expected.

* Refactor JsonContentFactory to reuse UTF8Encoding

Introduced a private static readonly field `_utf8Encoding` in the `JsonContentFactory` class to improve code readability and performance. This change replaces the instantiation of `UTF8Encoding` in the `CreateHttpContent` method, allowing for the reuse of the same encoding instance.

---------

Co-authored-by: Max Brooks <Max@compyl.com>

* Enhance thread safety with ConcurrentDictionary usage (#6760)

* Enhance thread safety with ConcurrentDictionary usage

Replaced `IDictionary` with `ConcurrentDictionary` for
both `_scheduledTasks` and `_scheduledTaskKeys` to
improve thread safety in a multi-threaded environment.

Updated methods `RegisterScheduledTask`,
`RemoveScheduledTask`, and `RemoveScheduledTasks` to
utilize the `Remove` method of `ConcurrentDictionary`,
ensuring safe and efficient removal of scheduled tasks.

* Refactor task registration and removal logic

Updated `RegisterScheduledTask` to use `AddOrUpdate` for streamlined task management. This change simplifies the addition and updating of scheduled tasks by consolidating logic into a single operation. Introduced `RemoveScheduledTask` method to handle task removal by name, improving code organization and clarity.

* Improve task removal handling in LocalScheduler

Modified the `LocalScheduler` class to enhance the removal process of scheduled tasks from the `_scheduledTaskKeys` collection. The removal operation now captures the result in a variable and includes a conditional check to log a warning if the task was not found, improving error handling and debugging capabilities.

* Refactor task removal in LocalScheduler

Updated the removal process for scheduled tasks in `_scheduledTasks`.
The new implementation collects all corresponding keys and attempts to remove them individually, logging warnings for any failures. This enhances error handling and provides better debugging information.

---------

Co-authored-by: Max Brooks <Max@compyl.com>

* Add IAsyncEnumerable check to ItemSourceActivityExecutionContextExtensions.GetItemSource (#6897)

* Use FullName in WorkflowDictionary (#6923)

* Fixed ParentWorkflowInstanceId not being set (#7029)

Co-authored-by: Peter Klooster <peter.klooster@autotaalglas.nl>

* Remove unused solution projects and update package references

- Deleted several project references from `Elsa.sln` to clean up the solution.
- Updated `Directory.Packages.props` for consistency and alignment with the latest package versions.

* Simplify CI pipeline by removing `Test` step from `Compile+Test+Pack` process.

* Initial plan

* Add ElsaScript DSL module with parser and compiler

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Add integration tests for ElsaScript DSL

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Add comprehensive documentation for ElsaScript DSL

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Refactor workflow activity instantiation logic

- Removed `ActivityFactory` and its related interfaces and extensions.
- Introduced `ActivityActivator` for handling activity creation.
- Extended AST with support for comprehensive workflow structures:
  - Added nodes for flowcharts, if/else, loops, and variable declarations.
- Updated `IElsaScriptCompiler` to use asynchronous methods.
- Expanded `ElsaScriptParser` to simplify syntax for `UseNode` and argument parsing.
- Adjusted compiler and parser for compatibility with new workflow AST model.

* Refactor test method names for clarity and add new compiler and parser tests

- Updated method names in `CompilerTests` and `ParserTests` for better readability and description of test intent.
- Added tests for compiler and parser:
  - Support for workflows without the `workflow` keyword.

* Refactor `ElsaScriptParser` to improve statement parsing and introduce a tokenizer

- Added `TokenizeStatements` method to split source into statements for enhanced parsing accuracy.
- Updated logic to process statements instead of raw lines, reducing parsing complexity and improving reliability.
- Improved handling of workflow and statement parsing, including edge cases with braces, parentheses, and string literals.

* Introduce ElsaScript support for BlobStorage workflow provider

- Added the `Elsa.WorkflowProviders.BlobStorage.ElsaScript` module to enable ElsaScript-based workflow definitions for BlobStorage.
- Implemented `ElsaScriptBlobWorkflowFormatHandler` for parsing ElsaScript workflows stored in BlobStorage.
- Extended `ElsaScriptParser` to leverage Parlot for improved DSL parsing.
- Introduced `IBlobWorkflowFormatHandler` to centralize workflow format handling and parsing.
- Updated `Elsa.Server.Web` to reference the new module and include an ElsaScript "Hello World" example workflow.

* Refactor ElsaScript services, update logging, and improve workflow handling

- Changed `ElsaScriptCompiler` service registration from `Singleton` to `Scoped` for better dependency management.
- Enhanced the "Hello World" example workflow and added `CopyToOutputDirectory` configuration.
- Removed unused namespaces and adjusted references in multiple projects to improve maintainability.
- Updated logging levels in `appsettings.json` to reduce unnecessary debug output.
- Improved `PolymorphicObjectConverter` by removing redundant dependencies.
- Added missing references to enhance feature support and ensure compatibility.

* Refactor activity instantiation and improve argument handling in `ElsaScriptCompiler`

- Added support for positional arguments with constructor matching logic.
- Refactored `InstantiateActivityUsingConstructor` to enhance activity creation.
- Updated `ActivityDescriptor` and related types to include `ClrType` for streamlined activity resolution.
- Simplified `TypedActivityProvider` by annotating it with `[UsedImplicitly]`.
- Adjusted `ElsaScriptParser` to remove unnecessary options from string literal definitions.

* Add HTTP-enabled "Hello World" workflow and support for additional HTTP activity constructors

- Introduced a new ElsaScript example workflow `hello-world-http.elsa` with an HTTP endpoint and response.
- Enhanced `HttpEndpoint` and `WriteHttpResponse` activities with additional constructors for improved flexibility.
- Updated project to include the new workflow in the output directory.

* Enhance `ElsaScriptParser` with a custom parser to handle nested raw expressions for ElsaScript workflows

- Introduced `RawExpressionParser` to parse raw text after `=>` up to a matching closing parenthesis.
- Updated `elsaExpressionWithLang` and `elsaExpressionWithoutLang` to use `RawExpressionParser`.
- Trimmed whitespace in parsed expressions.
- Added integration and parser tests for complex workflows with variables and expressions.
- Updated example workflow `hello-world-http.elsa` to demonstrate expression usage.
- Added `Elsa.Http` module reference to enable HTTP-based activities.

* Update "Hello World" workflow to simplify naming and enhance response logic

- Renamed workflow from `HelloWorldHttpDsl2` to `HelloWorldHttpDsl`.
- Updated HTTP endpoint path to `/hello-world-dsl` for consistency.
- Improved response logic by utilizing `getMessage()` JavaScript function.

* Add support for `OriginalSource` in workflow materialization and enhance ElsaScript materializer

- Introduced `OriginalSource` property in `WorkflowDefinition` and `MaterializedWorkflow` for preserving original source representation (e.g., ElsaScript, JSON, YAML).
- Added `ElsaScriptWorkflowMaterializer` implementation to materialize workflows directly from ElsaScript source.
- Updated `DefaultWorkflowDefinitionStorePopulator` to determine `StringData` or `OriginalSource` based on materialized workflow format.
- Enhanced `WorkflowDefinitionMapper` to support symmetric round-tripping with `OriginalSource`.
- Registered `ElsaScriptWorkflowMaterializer` in `ElsaScriptFeature` for dependency injection.
- Updated `JsonBlobWorkflowFormatHandler` and added `OriginalSource` support for round-trip preservation.
- Simplified `ElsaScriptParser` by aligning variable and parser naming.

* Update V3_6 migrations for PostgreSQL, MySQL, and Oracle databases and associated designer files.

* Handle disposal and race conditions in `ScheduledCronTask`

- Added `_disposed` flag to prevent accessing disposed resources.
- Updated `_executionSemaphore` and `_scopeFactory` logic to safely handle `ObjectDisposedException`.
- Enhanced task scheduling and timer disposal with additional safeguards against race conditions.
- Modified tests to ensure proper disposal and logging behavior when handling edge cases.

* Add support for metadata in ElsaScript workflows and enhance parser and compiler functionality

- Introduced metadata syntax in ElsaScript workflows (e.g., `DisplayName`, `Description`, `Version`) to enable metadata-driven behavior.
- Enhanced `ElsaScriptCompiler` to process metadata and properly integrate it into `Workflow` objects.
- Updated `ElsaScriptParser` to parse program-level AST with support for multiple workflows and global use statements.
- Refactored tests to validate metadata parsing and ensure backward compatibility with existing workflows.
- Added new test cases to cover scenarios like metadata parsing, compilation, and multi-workflow programs.

* Add support for `foreach` loops in ElsaScript and remove `let` keyword

- Introduced `foreach` loop syntax in `ElsaScriptParser` and `ElsaScriptCompiler`, enabling iteration over collections with optional variable declaration.
- Updated `ForNode` and `ForEachNode` to include a `DeclaresVariable` flag for improved variable handling.
- Removed support for the `let` keyword in variable declarations, streamlining syntax to use `var` and `const` only.
- Enhanced `for` loop syntax to support optional `var` declaration and block or single-statement bodies.
- Refactored test cases to validate `foreach` and `for` loop enhancements and ensure backward compatibility.

* Simplify ElsaScript workflow syntax by removing redundant quotes in workflow identifiers and updating `for` loop syntax for clarity and consistency.

* Remove redundant quotes from workflow identifiers in integration tests

* Simplify Elsa scripts and improve error handling

- Removed redundant braces in workflow declarations for streamlined syntax.
- Enhanced logging in `JsonBlobWorkflowFormatHandler` and `ElsaScriptBlobWorkflowFormatHandler` to warn on parsing errors and provide context.
- Updated configuration to log errors for `Elsa.Workflows.ActivityRegistry`.
- Refined "Hello World" and "For Loop" workflows for clarity and added improved loop handling.

* Refine Elsa workflows and update compiler logic

- Simplified "Hello World" workflow by adding braces and improving consistency.
- Adjusted "For Loop" workflow to rename and clarify logic, including expression updates and variable handling.
- Fixed compiler mapping of `"cs"` to `"CSharp"` for better clarity.
- Enhanced "Hello World HTTP" workflow to correctly reference `variables.message` in expressions.

* Add flowchart support in ElsaScript parser, compiler, and integration tests

- Introduced `flowchart` syntax in `ElsaScriptParser` to support flowchart-based workflows.
- Updated `ElsaScriptCompiler` to compile `flowchart` nodes with labeled activities, connections, entry points, and variables.
- Added integration tests for parsing and compiling empty and simple flowcharts.
- Enhanced `FlowchartNode` and `LabeledActivityNode` for better representation of flowchart structures.
- Improved error handling and logging for invalid flowchart configurations.

* Add tests for compiling and parsing flowcharts with nodes, connections, and block nodes in ElsaScript

- Added integration tests for compiling and validating flowchart structures, including activities, connections, and entry points.
- Implemented parser tests for parsing flowcharts with node connections and block nodes.
- Updated project files to include new workflow examples for testing.

* Add Parlot package and update project file in integration tests

- Added `Parlot` package version `0.0.27` to `Directory.Packages.props`.
- Updated integration test project file to include a new `Include` directive for better targeting.

* Update Parlot package to version 1.5.2 in Directory.Packages.props

* Remove `elsa-server-and-studio.yml` workflow and update solution file

- Deleted `elsa-server-and-studio.yml` workflow as it's no longer needed.
- Updated `Elsa.sln` to remove reference to the deleted workflow.

* Remove `elsa-studio.yml` workflow and update solution and packages

- Deleted `elsa-studio.yml` workflow as it's no longer used.
- Updated `Elsa.sln` to remove reference to the deleted workflow.
- Changed `base_version` in `packages.yml` from `3.7.0` to `3.6.0`.

* Downgrade Docker image in `elsa-server.yml` workflow from `v3.7.0-preview` to `v3.6.0-preview`

* Update Docker image tag in `elsa-server.yml` workflow from `v3.6.0-preview` to `v3.6-preview`

* Add logging support to `LocalScheduler` and replace `Debug.WriteLine` with `ILogger`

* Remove unused `System.Collections.Generic` and `Elsa.Extensions` imports in `LocalScheduler`

- Cleaned up unnecessary using directives to improve code readability and maintainability.
- Minor whitespace adjustment for consistent formatting.

* Remove unnecessary whitespace in `LocalScheduler` for consistent formatting

* Improve exception handling in blob workflow format handlers

- Updated exception handling in `ElsaScriptBlobWorkflowFormatHandler` and `JsonBlobWorkflowFormatHandler` to gracefully catch and log all exceptions during workflow parsing.
- Adjusted comments to clarify behavior for invalid user-provided files, ensuring the workflow loading process is not disrupted.

* Refactor blob workflow format handlers to use `SupportedExtensions` for improved file filtering

- Added `SupportedExtensions` property to all blob format handlers to optimize blob storage browsing.
- Simplified `CanHandle` logic by removing extension checks, leveraging `SupportedExtensions` for initial filtering.
- Updated comments for clarity and consistency across handlers.

* Refactor `DefaultWorkflowDefinitionStorePopulator` to simplify `stringData` assignment logic and improve readability

* Remove outdated comment in `CompilerTests` about skipped tests

* Apply suggestion from @Copilot

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

* Refactor `ElsaScriptCompiler` to streamline type conversion logic, improve language mapping, and enhance asynchronous flowchart compilation

* [WIP] Update ParseError printing based on feedback (#7082)

* Initial plan

* Fix ParseError formatting to use Message and Position properties

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Replace `as` casts with direct casts in ParserTests for null safety (#7083)

* Initial plan

* Replace 'as' casts with direct casts in ParserTests for better null safety

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Fix Oracle column types for OriginalSource and other large text fields (#7079)

* Initial plan

* Fix Oracle OriginalSource and StringData column types to handle large data

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Refactor tests to replace type checks with `Assert.IsType` for improved clarity and type safety

* Initial plan (#7080)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Add `Parlot` package reference and update solution structure by removing and reorganizing projects and workflows.

* Set default expression language to "JavaScript" in `ElsaScriptCompiler`.

* Add integration test to verify default expression language resets between ElsaScript compilations

* Simplify UTF-8 encoding in JsonContentFactory (#7081)

* Initial plan

* Remove explicit UTF8Encoding in JsonContentFactory and use Encoding.UTF8

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Fix test to use Encoding.UTF8.GetByteCount for multi-byte character support

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: Ender <37611092+zengande@users.noreply.github.com>
Co-authored-by: Matt <knibbsy10@live.com>
Co-authored-by: Max Brooks <45081361+MaxBrooks114@users.noreply.github.com>
Co-authored-by: Max Brooks <Max@compyl.com>
Co-authored-by: FuJa0815 <30809803+FuJa0815@users.noreply.github.com>
Co-authored-by: Peter Klooster <crashkonijn@gmail.com>
Co-authored-by: Peter Klooster <peter.klooster@autotaalglas.nl>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-25 19:57:50 +01:00
Sipke Schoorstra b0d93d347b
Add unit and integration tests for DownloadHttpFile activity (#7094)
* Add unit and integration tests for `DownloadHttpFile` activity

- Developed comprehensive unit tests for the `DownloadHttpFile` activity validating method execution (GET, POST), URL handling, headers, and status codes.
- Added integration tests to verify functionality like authorization headers, filename extraction, and response stream handling.
- Updated `IntegrationTests` project references to include the required `Elsa.Http` module.

* Refactor `DownloadHttpFileTests` to simplify test setup and improve reusability

- Consolidated test initialization logic into `RunActivityAsync` for cleaner and reusable test setup.
- Updated existing tests to use `RunActivityAsync`, reducing boilerplate code.
- Unified filename extraction tests into a parameterized theory to improve test coverage and clarity.
- Simplified helper handlers with expression-bodied members for readability.

* Add comments to clarify HttpResponseMessage disposal responsibility in `DownloadHttpFileTests`.

* Ensure `HttpResponseMessage.Content` is always set to prevent null reference issues in `DownloadHttpFileTests`.

* Refactor `DownloadHttpFileTests` to ensure `HttpResponseMessage.Content` is always initialized and simplify content assignment logic.

* Update `DownloadHttpFileTests` to set an empty `HttpResponseMessage.Content` for testing `HasContent` behavior

* Add `GitHubActionsTestLogger` package to test projects and refactor `Directory.Packages.props`

- Updated unit and integration test projects to include `GitHubActionsTestLogger` for improved test reporting in CI.
- Refactored `Directory.Packages.props` to add conditional dependencies for .NET 8, 9, and 10 compatibility.

* Remove `GitHubActionsTestLogger` package from test projects.

* Add project reference for unit tests and update `DownloadHttpFileTests`

- Included `Elsa.Activities.UnitTests` project reference in `IntegrationTests` to reuse helpers.
- Removed redundant `TestHttpMessageHandler` by utilizing shared helper from `UnitTests`.

* Refactor `DownloadHttpFileTests` to remove unused methods and simplify imports

* Update target framework to .NET 10 and upgrade `Nuke.Components` package to v10.0.0
2025-11-24 14:37:06 +01:00
Sipke Schoorstra 8747151330
Add code coverage configuration and adjust test projects (#7049)
* Add code coverage configuration and adjust test projects

- Introduced `Include` and `Threshold` properties across test project files for improved code coverage tracking.
- Added `coverlet.collector` as a dependency for coverage data collection.
- Removed unused `global using` directives and redundant imports for cleaner test codebases.

* Update GitHub Actions workflows for pull request triggers

- Adjusted `pr.yml` to include `patch/*` and `develop/*` branches.
- Removed redundant pull request triggers in `packages.yml` for cleaner configuration.

* Expand pull request triggers in GitHub Actions

- Renamed `PR` workflow to `pr` for consistency.
- Included `patch/*` and `develop/*` branches in `pr.yml` and `Build.CI.GitHubActions.cs`.

* Remove pack target from pull request workflows

- Updated `pr.yml` to exclude the pack step.
- Adjusted `Build.CI.GitHubActions.cs` to reflect the removal of the pack target.

* Remove `Elsa.Workflows.Api` from integration test project references

- Updated `Elsa.Workflows.IntegrationTests.csproj` to exclude `Elsa.Workflows.Api` from the `Include` list and project references for cleanup and simplification.
2025-11-12 13:59:36 +01:00
Matt c36f1c977b Update package versions and use new FastEnpoints methods.
- Updated `Directory.Packages.props` with new package versions, including `ElsaStudioVersion`, `MicrosoftVersion`, and others.
- Changed `System.Formats.Asn1` version in `_build.csproj`.
- Re-factored `Endpoint.cs` to use new `Send` methods for updated FastEndpoints packages.
2025-08-05 23:50:40 +01:00
Matt 10348c5ea3 Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
Sipke Schoorstra ce0ea7e680
Update package and remove obsolete project entry
Upgraded `System.Formats.Asn1` to version `9.0.2` to address vulnerabilities. Removed the obsolete "nuke" project entry and associated files from the solution to clean up unused references. These changes enhance security and streamline the project structure.
2025-02-23 23:38:48 +01:00
Marko Lahma 6945eb191a Upgrade to NUKE 9.0.4 and fix automatic workflow generation 2025-01-26 19:29:19 +02:00
Robin Sue 17382b981e Upgrade Nuke to remove BinaryFormatter dependency 2024-12-10 21:06:42 +01:00
Robin Sue 4d6b7a17fb Add .NET 9.0 target 2024-12-10 21:06:42 +01:00
Marko Lahma 575892c44f
Enable CPM transitive pinning and resolve version conflicts (#6069)
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-10-31 09:12:21 +01:00
Sipke Schoorstra 7edfe188a7
Update packages (#6058)
* Update dependencies and refactor MongoDB usages to IQueryable

Updated MongoDB-related methods to use IQueryable instead of IMongoQueryable for better compatibility and cleaner code. Additionally, upgraded several dependencies and packages to newer versions, ensuring enhanced security and performance.

* Remove TargetFramework from MongoDb project file

The TargetFramework property has been removed from Elsa.MongoDb.csproj. This change is likely to allow for a more flexible build configuration or to delegate framework specification to a higher-level configuration.

* Update package versions in _build.csproj

Upgraded Azure.Identity to 1.13.1, NuGet.Packaging to 6.11.1, and Microsoft.Identity.Client to 4.66.1. These updates address vulnerabilities and ensure compatibility with dependencies.
2024-10-25 22:38:41 +02:00
Sipke Schoorstra fd92557469 Merge remote-tracking branch 'origin/patch/3.2.x' 2024-10-25 20:19:01 +02:00
Sipke Schoorstra f6eccde968 Switch to project references from package references
Replaced package references for various Elsa modules with direct project references. This change aims to streamline dependency management and avoid issues related to differing package versions. Updated the solution file and Directory.Build.props accordingly to reflect the new paths.
2024-10-18 10:54:23 +02:00
dependabot[bot] e90fe0a762
Bump System.Text.Json from 7.0.4 to 8.0.5 in /build (#6021)
Bumps [System.Text.Json](https://github.com/dotnet/runtime) from 7.0.4 to 8.0.5.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v7.0.4...v8.0.5)

---
updated-dependencies:
- dependency-name: System.Text.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 18:45:27 +02:00
Sipke Schoorstra 6b9079d61c Refactor Nuke script paths and update GitHub Actions
Simplify the Nuke directory structure by moving scripts to the root level. Adjust the GitHub Actions workflow to reflect the new script path. This improves script accessibility and project organization.
2024-09-15 17:17:27 -07:00
Marko Lahma aa14e7f536
Upgrade to NUKE 8.1 (#5952)
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-09-12 09:56:06 -07:00
Sipke Schoorstra 5bc48e6969 Remove 'nuke' project and update NUKE tool directories
Removed the 'nuke' project entry from the solution file and adjusted related NUKE tool directory paths within the build project file. These changes streamline the configuration and ensure the NUKE scripts are correctly located in the new directory structure.
2024-08-15 11:45:26 +02:00
Sipke Schoorstra 900dec2a06 Update Nuke paths in build project configuration
Changed the `NukeRootDirectory` and `NukeScriptDirectory` paths to ensure correct directory structure. This update aims to resolve any discrepancies in the build process by pointing to the appropriate directories.
2024-08-14 21:57:40 +02:00
Sipke Schoorstra 0152c4f9b8 Update NukeScriptDirectory path in _build.csproj
Changed the NukeScriptDirectory path to point one level up to streamline the directory structure. This minor adjustment helps in maintaining consistency across the project configuration.
2024-08-14 21:54:02 +02:00
Sipke Schoorstra 426b9bcde3 Move build and deployment scripts
This commit moves various build scripts, Docker-related files, Kubernetes deployment configurations, and migration scripts.
2024-08-14 21:42:46 +02:00
Marko Lahma f5dc29cdcc
Drop NET 7 support and cleanup NuGet package references (#5828)
* Directory.Packages.props should mandate used versions
* Add NuGet audit mode setting to show any problems during restore
* System.Text.Json should be 8.0.4 which is patched against security vulnerabilities
* Fix build GH Actions generation

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-07-24 14:30:39 +02:00
Raymond den Haan 3593b93ad7 Removed package override from build project 2024-06-13 16:30:05 +02:00
Raymond den Haan 9237a212ed Updated Azure.Identity for vulnerability 2024-06-13 15:49:29 +02:00
Raymond den Haan a2683d3216 Forced package upgrade due to vulnerability 2024-06-13 15:06:06 +02:00
cristinamudura 9fa1b4685e
Feature/sonar cloud (#5224)
* Update packages.yml

* Added sonar cloud properties

* Update packages.yml

* Update packages.yml

* Update packages.yml

* Update packages.yml

* Updated nuke Build to produce test coverage output

* Updated project key

* Fix organization key

* Versioning fix

* Removed sonar properties

* Added jdk17

* Changed build configuration for nuke

* Added opencover paths

* Added the coverlet collector NuGet package

* Added exclusions

* Updated workflow

* Modified exclusions

* Updated packages.yml to contain sonar cloud integration

* Removed test github action

* Updated for test coverage

* Updated MergeWith property for the tests

* Add verbose to check for code coverage issue

* Updated reportPaths

* Added --collect parameter

* Updates

* Updated packages workflow

* Updated exclusions

* Added sonar exclusions

* Updated exclusions

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-04-26 15:46:34 +02:00
Sipke Schoorstra 0eb01c01f3
Add SearchTerm to Workflow Definitions List API client (#5035)
* Refactor search filtering and move ListWorkflowDefinitionsRequest file

Updated the searching mechanism in `WorkflowDefinitionFilter.cs` by validating that Name and Description are not null before performing the search. In `ListWorkflowDefinitionsRequest.cs`, the file was moved from the Responses namespace to Requests and a new property `SearchTerm` was added, allowing filtering of workflow definitions by their name, ID or description.

* Update code style settings for csproj

The .DotSettings file for the project has been adjusted with changes to code naming rules and settings migration. These modifications adjust policies for naming conventions of Instance and Static fields, enhancing code style conformance. Also, an additional settings migration rule has been applied.

* Add 'issue/*' branch to GitHub actions workflow

The GitHub actions workflow has been updated to include the 'issue/*' branch. This ensures that any changes made in the 'issue/*' branches will trigger the workflow and any associated tests or builds, improving the overall continuous integration process.

* Remove Skip and Take methods from SqlServerDialect

The mentioned functions have been removed from SqlServerDialect class in the Elsa.Dapper module. The base class provides the correct default implementation for the SQL Server dialect.
2024-03-05 07:31:59 +01:00
Sipke Schoorstra f37b3c424b Expand triggers and branches for GitHub Actions
The GitHub Actions configuration has been updated to also trigger on Push events and Workflow Dispatch events. OnPushBranches and OnPullRequestBranches now also include branches prefixed with 'feature', 'patch', 'fix', and 'enhancement'. This is reflected in both the Build.CI.GitHubActions.cs file and the packages.yml GitHub workflow.
2024-02-21 11:26:09 +01:00
Marko Lahma 01c34e6b13
Add PR workflow (#4956) 2024-02-18 23:36:24 +01:00
Marko Lahma bc3d6d9bbc Convert to use Central Package Management
* Add GitHubActionsTestLogger
2024-02-04 13:49:54 +02:00
Sipke Schoorstra 55737f24ae Refactor formatting and rearrange project reference order
Modified code formatting to enhance readability in several files including integration tests and workflow definitions. Order of project references in both Elsa.sln and Elsa.Server.Web.csproj files were rearranged. Unnecessary namespaces were also removed in BulkSuspendedWorkflow.cs and _build.csproj file saw a minor adjustment.
2024-01-26 19:55:01 +01:00
Sipke Schoorstra a644d59c73 Update target branches for GitHub Actions
The target branches for GitHub Action on pull requests have been updated. Specifically, the wildcard 'v3*' is removed from the 'OnPullRequestBranches' attribute. Now, actions will only be triggered for pull requests on the 'main' branch.
2024-01-26 14:49:30 +01:00
Marko Lahma 832fac4db1
Add NUKE build support (#4815) 2024-01-21 10:53:07 +01:00