feat: extend shells integration and modular server support (#7399)
* refactor(deps): use local CShells project refs
Replace CShells NuGet package references with direct project references to the local CShells source to enable developing and testing against local changes and simplify build integration across modules.
* Handle assembly load errors in feature discovery
Added error handling for assembly load failures in feature discovery to improve resilience. Also updated configuration for identity token options and removed unused service bus consumer dependencies. Simplified project structure by moving and cleaning up `Directory.Build.targets` files.
* Refactor configuration and service extension methods.
Moved `ShellSettingsExtensions` and `ShellConfiguration` to `CShells.Abstractions` for better modularity. Added new `ServiceCollectionFeatureExtensions` to improve options registration. Updated appsettings and references to support these changes.
* Introduce ManagementServiceCollectionExtensions to streamline activity and variable registration
Added `ManagementServiceCollectionExtensions` for registering Elsa activity types and variable descriptors, providing a modular and shell-feature-compatible approach to configuration. Updated relevant features to utilize these new extension methods, enhancing code modularity and reducing redundancy.
* Add resilience strategy registration to HTTP feature
Introduced `ResilienceServiceCollectionExtensions` to register resilience strategies within the `Elsa.Resilience.Core` module. Updated `HttpFeature` to incorporate resilience strategies, enhancing HTTP-related resilience configuration leveraging the new extension methods.
* Add new configuration options to JavaScriptFeature
Implemented multiple properties in `JavaScriptFeature` to enhance JavaScript execution: `AllowClrAccess`, `AllowConfigurationAccess`, `ScriptCacheTimeout`, `DisableWrappers`, and `DisableVariableCopying`. These additions enable more flexible and secure configuration of the Jint JavaScript engine.
* refactor(workflows): unify graph caching
Resolve workflow definitions first and store graphs under stable per-version-ID cache keys so different lookup paths share entries.
Centralize cache creation and change-token registration to remove duplicated caching logic.
Skip materializer-unavailable definitions to avoid caching null graphs and simplify flow.
* refactor(tests): centralize default IDs and materializer setup
Introduce constants for default definition and version IDs, and materializer name. Refactor tests to use these constants, streamline graph and definition resolution, and improve cache key creation by sharing logic across tests. Extend tests to check scenarios with unavailable materializers, ensuring caching only occurs for valid cases.
* extend(tests): enhance cache key verification in AutoUpdateTests
Added checks for both workflow definition and version cache keys in AutoUpdateTests to ensure comprehensive cache validation, improving test reliability and coverage.
* refactor(projects): update CShells project paths and solution configuration
Revised project reference paths in `Elsa.ModularServer.Web.csproj` for CShells projects and updated `Elsa.sln` to include new CShells projects, streamlining project organization and build configuration.
* Add `IWorkflowReferenceGraphBuilder` to `WorkflowManagementFeature`; rename `ResilienceShellFeature` to `ResilienceFeature`.
* Refactor `HttpFeature` to use `IMiddlewareShellFeature`, include `HttpWorkflowsMiddleware`, and update `HttpActivityOptions` defaults.
* Add `AddTypeAlias` and `AddVariableTypeAndAlias` extension methods to service collections
- Introduced `AddTypeAlias<T>` method in `ServiceCollectionExtensions.cs` for adding type aliases.
- Added `AddVariableTypeAndAlias<T>` method in `ManagementServiceCollectionExtensions.cs` to add variable types with aliases.
* Remove shell reload API endpoints, orchestrator, and associated tests from the codebase.
* Introduce `DefaultAdminUser` options and refactor `AdminUserInitializer` to use `IOptions`.
* Add user management endpoints: Delete, List, Update with enhanced user store functionality
* Implement `DefaultAdminUser` feature for initial admin bootstrap, decouple `SecurityRoot` from user management endpoints, update related documentation and permissions.
* Add role management endpoints: Delete, List, and Update, including role data models and handle obsolete SecurityRoot policy.
* Update CShells package references to version 0.0.12-preview.66 and refactor `TenantTaskManager` for improved task lifecycle management.
* Replace project references with package references in csproj files and remove unused folders.
* Integrate Nuplane features, add sample packages, and update dependency handling within ModularServer Web.
* Improve `CShells` startup endpoint registration and resolver handling
- Address duplicate endpoint registration by adding state-aware tracking and deduplication
- Resolve `WebRoutingShellResolver` constructor ambiguity by switching to factory-based registration
- Implement a startup-specific filter to prevent redundant endpoint remapping during `ShellsReloaded`
- Update project to use project references for `CShells` and `Nuplane` components in csproj files.
* Update logging configuration in appsettings for Development and Production
- Change default log level to 'Warning' in Development settings
- Adjust Microsoft.Hosting and Elsa.SamplePackage log levels to 'Information'
- Remove Microsoft.EntityFrameworkCore log level entry from Production settings
* Refactor assembly retrieval methods and update endpoint calls for consistency.
* Add `SampleEndpointFeature` and enhance logging and service integration
- Implement `SampleEndpointFeature` with a new endpoint for handling requests.
- Log endpoint access and integrate `ISampleService` with method `DoSomething`.
- Update logging configuration to include `CShells` and `Nuplane` log levels in Development settings.
- Update `Elsa.SamplePackage` to version 1.0.1 and manage dependencies with project and assembly references.
- Modify JSON configuration for `SampleEndpoint`.
* Update package versions for `CShells` to 0.0.13 and `Nuplane` to 0.0.1-preview.15 in props file.
* Refactor `DefaultAdminUserFeature` by renaming `ConfigureServices` to `Apply` and adjusting service registration method.
* Replace project references with package references across multiple projects and remove obsolete cshells-related solution entries.
* Remove `SampleCatalogEndpointExtensions.cs` and related endpoint mappings.
* Improve `TenantTaskManager` by using `TryRemove` for state clean-up and clarify `SemaphoreSlim` disposal behavior.
* Remove hardcoded default admin credentials and add warning for unconfigured AdminRoleName in admin user setup.
* Address unresolved review comments: fix doc comments, security defaults, compilation issue, and restore reload response contracts
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Refine reload endpoints: use specific exceptions, add error messages, rename ReloadedAt to Timestamp, remove unused model
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Add `ExceptionExtensions` with `IsFatal` method and simplify exception handling in `TenantTaskManager`. Remove unused properties from `Directory.Build.props`.
* Add unit tests for `TenantTaskManager` and fix potential state orphaning issue.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Fix logger dependency in `SampleEndpointFeature` constructor to use correct type.
* Add unit tests for Elsa Shells API endpoints and update solution configuration.
* Refactor ShellReload models: remove ShellReloadItemResult, update ShellReloadResponse properties.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@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: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-04-18 12:33:34 +00:00
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http.Json;
|
2026-07-11 13:38:09 +00:00
|
|
|
using CShells.Lifecycle;
|
feat: extend shells integration and modular server support (#7399)
* refactor(deps): use local CShells project refs
Replace CShells NuGet package references with direct project references to the local CShells source to enable developing and testing against local changes and simplify build integration across modules.
* Handle assembly load errors in feature discovery
Added error handling for assembly load failures in feature discovery to improve resilience. Also updated configuration for identity token options and removed unused service bus consumer dependencies. Simplified project structure by moving and cleaning up `Directory.Build.targets` files.
* Refactor configuration and service extension methods.
Moved `ShellSettingsExtensions` and `ShellConfiguration` to `CShells.Abstractions` for better modularity. Added new `ServiceCollectionFeatureExtensions` to improve options registration. Updated appsettings and references to support these changes.
* Introduce ManagementServiceCollectionExtensions to streamline activity and variable registration
Added `ManagementServiceCollectionExtensions` for registering Elsa activity types and variable descriptors, providing a modular and shell-feature-compatible approach to configuration. Updated relevant features to utilize these new extension methods, enhancing code modularity and reducing redundancy.
* Add resilience strategy registration to HTTP feature
Introduced `ResilienceServiceCollectionExtensions` to register resilience strategies within the `Elsa.Resilience.Core` module. Updated `HttpFeature` to incorporate resilience strategies, enhancing HTTP-related resilience configuration leveraging the new extension methods.
* Add new configuration options to JavaScriptFeature
Implemented multiple properties in `JavaScriptFeature` to enhance JavaScript execution: `AllowClrAccess`, `AllowConfigurationAccess`, `ScriptCacheTimeout`, `DisableWrappers`, and `DisableVariableCopying`. These additions enable more flexible and secure configuration of the Jint JavaScript engine.
* refactor(workflows): unify graph caching
Resolve workflow definitions first and store graphs under stable per-version-ID cache keys so different lookup paths share entries.
Centralize cache creation and change-token registration to remove duplicated caching logic.
Skip materializer-unavailable definitions to avoid caching null graphs and simplify flow.
* refactor(tests): centralize default IDs and materializer setup
Introduce constants for default definition and version IDs, and materializer name. Refactor tests to use these constants, streamline graph and definition resolution, and improve cache key creation by sharing logic across tests. Extend tests to check scenarios with unavailable materializers, ensuring caching only occurs for valid cases.
* extend(tests): enhance cache key verification in AutoUpdateTests
Added checks for both workflow definition and version cache keys in AutoUpdateTests to ensure comprehensive cache validation, improving test reliability and coverage.
* refactor(projects): update CShells project paths and solution configuration
Revised project reference paths in `Elsa.ModularServer.Web.csproj` for CShells projects and updated `Elsa.sln` to include new CShells projects, streamlining project organization and build configuration.
* Add `IWorkflowReferenceGraphBuilder` to `WorkflowManagementFeature`; rename `ResilienceShellFeature` to `ResilienceFeature`.
* Refactor `HttpFeature` to use `IMiddlewareShellFeature`, include `HttpWorkflowsMiddleware`, and update `HttpActivityOptions` defaults.
* Add `AddTypeAlias` and `AddVariableTypeAndAlias` extension methods to service collections
- Introduced `AddTypeAlias<T>` method in `ServiceCollectionExtensions.cs` for adding type aliases.
- Added `AddVariableTypeAndAlias<T>` method in `ManagementServiceCollectionExtensions.cs` to add variable types with aliases.
* Remove shell reload API endpoints, orchestrator, and associated tests from the codebase.
* Introduce `DefaultAdminUser` options and refactor `AdminUserInitializer` to use `IOptions`.
* Add user management endpoints: Delete, List, Update with enhanced user store functionality
* Implement `DefaultAdminUser` feature for initial admin bootstrap, decouple `SecurityRoot` from user management endpoints, update related documentation and permissions.
* Add role management endpoints: Delete, List, and Update, including role data models and handle obsolete SecurityRoot policy.
* Update CShells package references to version 0.0.12-preview.66 and refactor `TenantTaskManager` for improved task lifecycle management.
* Replace project references with package references in csproj files and remove unused folders.
* Integrate Nuplane features, add sample packages, and update dependency handling within ModularServer Web.
* Improve `CShells` startup endpoint registration and resolver handling
- Address duplicate endpoint registration by adding state-aware tracking and deduplication
- Resolve `WebRoutingShellResolver` constructor ambiguity by switching to factory-based registration
- Implement a startup-specific filter to prevent redundant endpoint remapping during `ShellsReloaded`
- Update project to use project references for `CShells` and `Nuplane` components in csproj files.
* Update logging configuration in appsettings for Development and Production
- Change default log level to 'Warning' in Development settings
- Adjust Microsoft.Hosting and Elsa.SamplePackage log levels to 'Information'
- Remove Microsoft.EntityFrameworkCore log level entry from Production settings
* Refactor assembly retrieval methods and update endpoint calls for consistency.
* Add `SampleEndpointFeature` and enhance logging and service integration
- Implement `SampleEndpointFeature` with a new endpoint for handling requests.
- Log endpoint access and integrate `ISampleService` with method `DoSomething`.
- Update logging configuration to include `CShells` and `Nuplane` log levels in Development settings.
- Update `Elsa.SamplePackage` to version 1.0.1 and manage dependencies with project and assembly references.
- Modify JSON configuration for `SampleEndpoint`.
* Update package versions for `CShells` to 0.0.13 and `Nuplane` to 0.0.1-preview.15 in props file.
* Refactor `DefaultAdminUserFeature` by renaming `ConfigureServices` to `Apply` and adjusting service registration method.
* Replace project references with package references across multiple projects and remove obsolete cshells-related solution entries.
* Remove `SampleCatalogEndpointExtensions.cs` and related endpoint mappings.
* Improve `TenantTaskManager` by using `TryRemove` for state clean-up and clarify `SemaphoreSlim` disposal behavior.
* Remove hardcoded default admin credentials and add warning for unconfigured AdminRoleName in admin user setup.
* Address unresolved review comments: fix doc comments, security defaults, compilation issue, and restore reload response contracts
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Refine reload endpoints: use specific exceptions, add error messages, rename ReloadedAt to Timestamp, remove unused model
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Add `ExceptionExtensions` with `IsFatal` method and simplify exception handling in `TenantTaskManager`. Remove unused properties from `Directory.Build.props`.
* Add unit tests for `TenantTaskManager` and fix potential state orphaning issue.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Fix logger dependency in `SampleEndpointFeature` constructor to use correct type.
* Add unit tests for Elsa Shells API endpoints and update solution configuration.
* Refactor ShellReload models: remove ShellReloadItemResult, update ShellReloadResponse properties.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@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: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-04-18 12:33:34 +00:00
|
|
|
using NSubstitute;
|
|
|
|
|
|
|
|
|
|
namespace Elsa.Shells.Api.Tests.Endpoints.Reload;
|
|
|
|
|
|
|
|
|
|
public class ReloadTests : ShellsApiTestBase
|
|
|
|
|
{
|
|
|
|
|
private const string ShellId = "test-shell";
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task Post_WhenSuccessful_Returns200WithCompletedStatus()
|
|
|
|
|
{
|
|
|
|
|
var response = await HttpClient.PostAsync($"/shells/{ShellId}/reload", null);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
|
|
|
var body = await response.Content.ReadFromJsonAsync<ShellReloadResult>(JsonOptions);
|
|
|
|
|
Assert.NotNull(body);
|
|
|
|
|
Assert.Equal("Completed", body.Status);
|
|
|
|
|
Assert.Equal(ShellId, body.RequestedShellId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task Post_WhenShellNotFound_Returns404WithNotFoundStatus()
|
|
|
|
|
{
|
2026-07-11 13:38:09 +00:00
|
|
|
ShellRegistry
|
|
|
|
|
.ReloadAsync(ShellId, Arg.Any<CancellationToken>())
|
|
|
|
|
.Returns(Task.FromException<ReloadResult>(new ShellBlueprintNotFoundException(ShellId)));
|
feat: extend shells integration and modular server support (#7399)
* refactor(deps): use local CShells project refs
Replace CShells NuGet package references with direct project references to the local CShells source to enable developing and testing against local changes and simplify build integration across modules.
* Handle assembly load errors in feature discovery
Added error handling for assembly load failures in feature discovery to improve resilience. Also updated configuration for identity token options and removed unused service bus consumer dependencies. Simplified project structure by moving and cleaning up `Directory.Build.targets` files.
* Refactor configuration and service extension methods.
Moved `ShellSettingsExtensions` and `ShellConfiguration` to `CShells.Abstractions` for better modularity. Added new `ServiceCollectionFeatureExtensions` to improve options registration. Updated appsettings and references to support these changes.
* Introduce ManagementServiceCollectionExtensions to streamline activity and variable registration
Added `ManagementServiceCollectionExtensions` for registering Elsa activity types and variable descriptors, providing a modular and shell-feature-compatible approach to configuration. Updated relevant features to utilize these new extension methods, enhancing code modularity and reducing redundancy.
* Add resilience strategy registration to HTTP feature
Introduced `ResilienceServiceCollectionExtensions` to register resilience strategies within the `Elsa.Resilience.Core` module. Updated `HttpFeature` to incorporate resilience strategies, enhancing HTTP-related resilience configuration leveraging the new extension methods.
* Add new configuration options to JavaScriptFeature
Implemented multiple properties in `JavaScriptFeature` to enhance JavaScript execution: `AllowClrAccess`, `AllowConfigurationAccess`, `ScriptCacheTimeout`, `DisableWrappers`, and `DisableVariableCopying`. These additions enable more flexible and secure configuration of the Jint JavaScript engine.
* refactor(workflows): unify graph caching
Resolve workflow definitions first and store graphs under stable per-version-ID cache keys so different lookup paths share entries.
Centralize cache creation and change-token registration to remove duplicated caching logic.
Skip materializer-unavailable definitions to avoid caching null graphs and simplify flow.
* refactor(tests): centralize default IDs and materializer setup
Introduce constants for default definition and version IDs, and materializer name. Refactor tests to use these constants, streamline graph and definition resolution, and improve cache key creation by sharing logic across tests. Extend tests to check scenarios with unavailable materializers, ensuring caching only occurs for valid cases.
* extend(tests): enhance cache key verification in AutoUpdateTests
Added checks for both workflow definition and version cache keys in AutoUpdateTests to ensure comprehensive cache validation, improving test reliability and coverage.
* refactor(projects): update CShells project paths and solution configuration
Revised project reference paths in `Elsa.ModularServer.Web.csproj` for CShells projects and updated `Elsa.sln` to include new CShells projects, streamlining project organization and build configuration.
* Add `IWorkflowReferenceGraphBuilder` to `WorkflowManagementFeature`; rename `ResilienceShellFeature` to `ResilienceFeature`.
* Refactor `HttpFeature` to use `IMiddlewareShellFeature`, include `HttpWorkflowsMiddleware`, and update `HttpActivityOptions` defaults.
* Add `AddTypeAlias` and `AddVariableTypeAndAlias` extension methods to service collections
- Introduced `AddTypeAlias<T>` method in `ServiceCollectionExtensions.cs` for adding type aliases.
- Added `AddVariableTypeAndAlias<T>` method in `ManagementServiceCollectionExtensions.cs` to add variable types with aliases.
* Remove shell reload API endpoints, orchestrator, and associated tests from the codebase.
* Introduce `DefaultAdminUser` options and refactor `AdminUserInitializer` to use `IOptions`.
* Add user management endpoints: Delete, List, Update with enhanced user store functionality
* Implement `DefaultAdminUser` feature for initial admin bootstrap, decouple `SecurityRoot` from user management endpoints, update related documentation and permissions.
* Add role management endpoints: Delete, List, and Update, including role data models and handle obsolete SecurityRoot policy.
* Update CShells package references to version 0.0.12-preview.66 and refactor `TenantTaskManager` for improved task lifecycle management.
* Replace project references with package references in csproj files and remove unused folders.
* Integrate Nuplane features, add sample packages, and update dependency handling within ModularServer Web.
* Improve `CShells` startup endpoint registration and resolver handling
- Address duplicate endpoint registration by adding state-aware tracking and deduplication
- Resolve `WebRoutingShellResolver` constructor ambiguity by switching to factory-based registration
- Implement a startup-specific filter to prevent redundant endpoint remapping during `ShellsReloaded`
- Update project to use project references for `CShells` and `Nuplane` components in csproj files.
* Update logging configuration in appsettings for Development and Production
- Change default log level to 'Warning' in Development settings
- Adjust Microsoft.Hosting and Elsa.SamplePackage log levels to 'Information'
- Remove Microsoft.EntityFrameworkCore log level entry from Production settings
* Refactor assembly retrieval methods and update endpoint calls for consistency.
* Add `SampleEndpointFeature` and enhance logging and service integration
- Implement `SampleEndpointFeature` with a new endpoint for handling requests.
- Log endpoint access and integrate `ISampleService` with method `DoSomething`.
- Update logging configuration to include `CShells` and `Nuplane` log levels in Development settings.
- Update `Elsa.SamplePackage` to version 1.0.1 and manage dependencies with project and assembly references.
- Modify JSON configuration for `SampleEndpoint`.
* Update package versions for `CShells` to 0.0.13 and `Nuplane` to 0.0.1-preview.15 in props file.
* Refactor `DefaultAdminUserFeature` by renaming `ConfigureServices` to `Apply` and adjusting service registration method.
* Replace project references with package references across multiple projects and remove obsolete cshells-related solution entries.
* Remove `SampleCatalogEndpointExtensions.cs` and related endpoint mappings.
* Improve `TenantTaskManager` by using `TryRemove` for state clean-up and clarify `SemaphoreSlim` disposal behavior.
* Remove hardcoded default admin credentials and add warning for unconfigured AdminRoleName in admin user setup.
* Address unresolved review comments: fix doc comments, security defaults, compilation issue, and restore reload response contracts
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Refine reload endpoints: use specific exceptions, add error messages, rename ReloadedAt to Timestamp, remove unused model
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Add `ExceptionExtensions` with `IsFatal` method and simplify exception handling in `TenantTaskManager`. Remove unused properties from `Directory.Build.props`.
* Add unit tests for `TenantTaskManager` and fix potential state orphaning issue.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Fix logger dependency in `SampleEndpointFeature` constructor to use correct type.
* Add unit tests for Elsa Shells API endpoints and update solution configuration.
* Refactor ShellReload models: remove ShellReloadItemResult, update ShellReloadResponse properties.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@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: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-04-18 12:33:34 +00:00
|
|
|
|
|
|
|
|
var response = await HttpClient.PostAsync($"/shells/{ShellId}/reload", null);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
|
|
|
|
var body = await response.Content.ReadFromJsonAsync<ShellReloadResult>(JsonOptions);
|
|
|
|
|
Assert.NotNull(body);
|
|
|
|
|
Assert.Equal("NotFound", body.Status);
|
|
|
|
|
Assert.Equal(ShellId, body.RequestedShellId);
|
2026-07-11 13:38:09 +00:00
|
|
|
Assert.Contains(ShellId, body.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task Post_WhenReloadFails_Returns503WithFailedStatus()
|
|
|
|
|
{
|
|
|
|
|
ShellRegistry
|
|
|
|
|
.ReloadAsync(ShellId, Arg.Any<CancellationToken>())
|
|
|
|
|
.Returns(Task.FromResult(new ReloadResult(ShellId, null, null, new InvalidOperationException("Shell reload failed"))));
|
|
|
|
|
|
|
|
|
|
var response = await HttpClient.PostAsync($"/shells/{ShellId}/reload", null);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode);
|
|
|
|
|
var body = await response.Content.ReadFromJsonAsync<ShellReloadResult>(JsonOptions);
|
|
|
|
|
Assert.NotNull(body);
|
|
|
|
|
Assert.Equal("Failed", body.Status);
|
|
|
|
|
Assert.Equal(ShellId, body.RequestedShellId);
|
|
|
|
|
Assert.Equal("Shell reload failed", body.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task Post_WhenBlueprintUnavailable_Returns503WithFailedStatus()
|
|
|
|
|
{
|
|
|
|
|
ShellRegistry
|
|
|
|
|
.ReloadAsync(ShellId, Arg.Any<CancellationToken>())
|
|
|
|
|
.Returns(Task.FromException<ReloadResult>(new ShellBlueprintUnavailableException(ShellId, new InvalidOperationException())));
|
|
|
|
|
|
|
|
|
|
var response = await HttpClient.PostAsync($"/shells/{ShellId}/reload", null);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode);
|
|
|
|
|
var body = await response.Content.ReadFromJsonAsync<ShellReloadResult>(JsonOptions);
|
|
|
|
|
Assert.NotNull(body);
|
|
|
|
|
Assert.Equal("Failed", body.Status);
|
|
|
|
|
Assert.Equal(ShellId, body.RequestedShellId);
|
|
|
|
|
Assert.Contains(ShellId, body.Message);
|
feat: extend shells integration and modular server support (#7399)
* refactor(deps): use local CShells project refs
Replace CShells NuGet package references with direct project references to the local CShells source to enable developing and testing against local changes and simplify build integration across modules.
* Handle assembly load errors in feature discovery
Added error handling for assembly load failures in feature discovery to improve resilience. Also updated configuration for identity token options and removed unused service bus consumer dependencies. Simplified project structure by moving and cleaning up `Directory.Build.targets` files.
* Refactor configuration and service extension methods.
Moved `ShellSettingsExtensions` and `ShellConfiguration` to `CShells.Abstractions` for better modularity. Added new `ServiceCollectionFeatureExtensions` to improve options registration. Updated appsettings and references to support these changes.
* Introduce ManagementServiceCollectionExtensions to streamline activity and variable registration
Added `ManagementServiceCollectionExtensions` for registering Elsa activity types and variable descriptors, providing a modular and shell-feature-compatible approach to configuration. Updated relevant features to utilize these new extension methods, enhancing code modularity and reducing redundancy.
* Add resilience strategy registration to HTTP feature
Introduced `ResilienceServiceCollectionExtensions` to register resilience strategies within the `Elsa.Resilience.Core` module. Updated `HttpFeature` to incorporate resilience strategies, enhancing HTTP-related resilience configuration leveraging the new extension methods.
* Add new configuration options to JavaScriptFeature
Implemented multiple properties in `JavaScriptFeature` to enhance JavaScript execution: `AllowClrAccess`, `AllowConfigurationAccess`, `ScriptCacheTimeout`, `DisableWrappers`, and `DisableVariableCopying`. These additions enable more flexible and secure configuration of the Jint JavaScript engine.
* refactor(workflows): unify graph caching
Resolve workflow definitions first and store graphs under stable per-version-ID cache keys so different lookup paths share entries.
Centralize cache creation and change-token registration to remove duplicated caching logic.
Skip materializer-unavailable definitions to avoid caching null graphs and simplify flow.
* refactor(tests): centralize default IDs and materializer setup
Introduce constants for default definition and version IDs, and materializer name. Refactor tests to use these constants, streamline graph and definition resolution, and improve cache key creation by sharing logic across tests. Extend tests to check scenarios with unavailable materializers, ensuring caching only occurs for valid cases.
* extend(tests): enhance cache key verification in AutoUpdateTests
Added checks for both workflow definition and version cache keys in AutoUpdateTests to ensure comprehensive cache validation, improving test reliability and coverage.
* refactor(projects): update CShells project paths and solution configuration
Revised project reference paths in `Elsa.ModularServer.Web.csproj` for CShells projects and updated `Elsa.sln` to include new CShells projects, streamlining project organization and build configuration.
* Add `IWorkflowReferenceGraphBuilder` to `WorkflowManagementFeature`; rename `ResilienceShellFeature` to `ResilienceFeature`.
* Refactor `HttpFeature` to use `IMiddlewareShellFeature`, include `HttpWorkflowsMiddleware`, and update `HttpActivityOptions` defaults.
* Add `AddTypeAlias` and `AddVariableTypeAndAlias` extension methods to service collections
- Introduced `AddTypeAlias<T>` method in `ServiceCollectionExtensions.cs` for adding type aliases.
- Added `AddVariableTypeAndAlias<T>` method in `ManagementServiceCollectionExtensions.cs` to add variable types with aliases.
* Remove shell reload API endpoints, orchestrator, and associated tests from the codebase.
* Introduce `DefaultAdminUser` options and refactor `AdminUserInitializer` to use `IOptions`.
* Add user management endpoints: Delete, List, Update with enhanced user store functionality
* Implement `DefaultAdminUser` feature for initial admin bootstrap, decouple `SecurityRoot` from user management endpoints, update related documentation and permissions.
* Add role management endpoints: Delete, List, and Update, including role data models and handle obsolete SecurityRoot policy.
* Update CShells package references to version 0.0.12-preview.66 and refactor `TenantTaskManager` for improved task lifecycle management.
* Replace project references with package references in csproj files and remove unused folders.
* Integrate Nuplane features, add sample packages, and update dependency handling within ModularServer Web.
* Improve `CShells` startup endpoint registration and resolver handling
- Address duplicate endpoint registration by adding state-aware tracking and deduplication
- Resolve `WebRoutingShellResolver` constructor ambiguity by switching to factory-based registration
- Implement a startup-specific filter to prevent redundant endpoint remapping during `ShellsReloaded`
- Update project to use project references for `CShells` and `Nuplane` components in csproj files.
* Update logging configuration in appsettings for Development and Production
- Change default log level to 'Warning' in Development settings
- Adjust Microsoft.Hosting and Elsa.SamplePackage log levels to 'Information'
- Remove Microsoft.EntityFrameworkCore log level entry from Production settings
* Refactor assembly retrieval methods and update endpoint calls for consistency.
* Add `SampleEndpointFeature` and enhance logging and service integration
- Implement `SampleEndpointFeature` with a new endpoint for handling requests.
- Log endpoint access and integrate `ISampleService` with method `DoSomething`.
- Update logging configuration to include `CShells` and `Nuplane` log levels in Development settings.
- Update `Elsa.SamplePackage` to version 1.0.1 and manage dependencies with project and assembly references.
- Modify JSON configuration for `SampleEndpoint`.
* Update package versions for `CShells` to 0.0.13 and `Nuplane` to 0.0.1-preview.15 in props file.
* Refactor `DefaultAdminUserFeature` by renaming `ConfigureServices` to `Apply` and adjusting service registration method.
* Replace project references with package references across multiple projects and remove obsolete cshells-related solution entries.
* Remove `SampleCatalogEndpointExtensions.cs` and related endpoint mappings.
* Improve `TenantTaskManager` by using `TryRemove` for state clean-up and clarify `SemaphoreSlim` disposal behavior.
* Remove hardcoded default admin credentials and add warning for unconfigured AdminRoleName in admin user setup.
* Address unresolved review comments: fix doc comments, security defaults, compilation issue, and restore reload response contracts
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Refine reload endpoints: use specific exceptions, add error messages, rename ReloadedAt to Timestamp, remove unused model
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/34eb1e13-833f-4b3c-9db6-2e9221d221b9
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Add `ExceptionExtensions` with `IsFatal` method and simplify exception handling in `TenantTaskManager`. Remove unused properties from `Directory.Build.props`.
* Add unit tests for `TenantTaskManager` and fix potential state orphaning issue.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Fix logger dependency in `SampleEndpointFeature` constructor to use correct type.
* Add unit tests for Elsa Shells API endpoints and update solution configuration.
* Refactor ShellReload models: remove ShellReloadItemResult, update ShellReloadResponse properties.
* Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@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: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-04-18 12:33:34 +00:00
|
|
|
}
|
|
|
|
|
}
|