Added logic to search for workflow-as-activities based on DefinitionId (not only versionId)#7149
Merged
sfmskywalker merged 13 commits intoDec 17, 2025
Conversation
1. Fixed problem: (re-)added logic to search for workflow-as-activities based on DefinitionId (not only versionId) 2. Added tests for Deserialiazation so this logic cannot disappear "unnoticed" in the future.
Contributor
Author
|
@dotnet-policy-service agree [company="Nexxbiz"] |
Contributor
Author
|
@dotnet-policy-service agree company="Nexxbiz" |
workflowDefinitionId is also used in other activities. Therefore, we must make sure to only search by workflowDefinitionId when the value is a string (e.g. when workflow used as activity, the value will always be a constant string, because the workflowDefinitionId cannot be resolved using expressions)
1) First try to find the activity by type name 2) Even if a descriptor is found by its type name, there might be multiple versions of a workflow-as-activity, hence; if the workflowDefinitionVersionId is specified, then this can override the initially found activity descriptor by type name. 3) Lastly, only when no activity descriptor is found by type name AND the activity JSON contains the property "workflowDeftinitionId", then we can search by workflowDefinitionId
…Pomelo compatibility constraints.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores and enhances the logic for deserializing workflow-as-activities based on WorkflowDefinitionId (not only WorkflowDefinitionVersionId), and adds comprehensive unit tests to prevent this functionality from being lost in future refactorings. The changes also include updates to the MySQL EF Core project configuration to exclude .NET 10.0 support due to Pomelo driver limitations, and package version updates for resilience-related libraries.
Key Changes
- Refactored activity deserialization logic to search by WorkflowDefinitionId when WorkflowDefinitionVersionId is not available and no well-known activity type is found
- Added comprehensive unit tests covering various deserialization scenarios for activities and workflow-as-activities
- Limited MySQL EF Core provider to .NET 8/9 due to Pomelo compatibility constraints
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
src/modules/Elsa.Workflows.Core/Serialization/Converters/ActivityJsonConverter.cs |
Refactored GetActivityDetails method to handle WorkflowDefinitionId-based lookup; extracted FindActivityDescriptorByCustomProperty helper method; reordered logic to check well-known activities before workflow-as-activities |
test/unit/Elsa.Workflows.Core.UnitTests/Serialization/Converters/ActivityJsonConverterTests.cs |
New comprehensive test file with 6 test cases covering deserialization scenarios for known/unknown activities, workflow-as-activities with DefinitionId, VersionId, and type name only |
src/modules/Elsa.Persistence.EFCore.MySql/Elsa.Persistence.EFCore.MySql.csproj |
Added TargetFrameworks property to exclude net10.0 due to Pomelo EF Core MySQL provider limitation; minor formatting changes to PackageReference elements |
Directory.Packages.props |
Updated Microsoft.Extensions.Http.Resilience and Microsoft.Extensions.Resilience versions from 9.0.11 to 9.10.0 for .NET 8/9 target frameworks |
…d improve readability.
Ensures the custom property lookup path is tested by mocking type name lookups to return null when searching for ActivityDescriptors.
Corrects the assignment logic for `activityDescriptor` and ensures `activityTypeVersion` uses the overridden descriptor's version when a custom property match is found.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Adjust null-check handling for `activityDescriptor` overrides. - Improve comment clarity and consolidate lambda expressions. - Remove unnecessary whitespace.
sfmskywalker
approved these changes
Dec 17, 2025
- Introduce `BlobExtensions` for extracting blob file extensions. - Add `SupportsExtension` to `IBlobWorkflowFormatHandler` to filter handlers by supported extensions.
- Deleted `flowchart-test.elsa` and `multi-workflow-example.elsa`. - Removed corresponding references from the project file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed problem: (re-)added logic to search for workflow-as-activities based on DefinitionId (not only versionId)
Added tests for Deserialization so this logic won't disappear "unnoticed" in the future.
This change is