-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Refactors extension methods to instance methods #7089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop/3.6.0
Are you sure you want to change the base?
Conversation
…anced coordination and separation of concerns.
…ization. - Deleted the `EnumerableTypeConverter` class and its JSON serialization logic. - Removed associated type descriptor attribute in `DefaultFormattersFeature`. - Updated `ObjectFormatter` to handle collection serialization directly with JSON.
…logic into `ObjectFormatter`. - Deleted `EnumerableTypeConverterTests` as the related functionality was removed. - Added comprehensive tests in `ObjectFormatterTests` to handle serialization of collections and arrays with JSON.
…ailing materialization - Introduced comprehensive test scenarios verifying `DeleteTriggersAsync` behavior when workflows fail to load or partially succeed. - Enhanced error handling in `TriggerIndexer` to skip failed workflows while ensuring remaining workflows are processed.
…tegration tests - Enhanced `DeleteTriggersAsync` with exception handling to skip failed workflows while processing others. - Logged warnings for failed workflows without halting execution. - Added comprehensive integration tests to verify behavior across success, failure, and mixed scenarios. - Refactored tests for improved clarity, maintainability, and consistency.
…low instances - Enhanced `ResumeWorkflowTask.ExecuteAsync` to handle `WorkflowInstanceNotFoundException` gracefully when a scheduled workflow instance is missing. - Logged warnings for skipped executions to improve observability. - Ensured remaining workflows and scheduled tasks are processed seamlessly without disruption.
…ng concurrent scheduling - Introduced a `lock` object to synchronize access to internal dictionaries. - Resolved `IndexOutOfRangeException` caused by concurrent modifications during startup. - Ensured thread-safe operations in `ScheduleAsync`, `ClearScheduleAsync`, and related methods. - Improved reliability and stability of scheduling under concurrent workloads.
…tion - Added exception handling in `TriggerIndexer.DeleteTriggersAsync` to skip failed workflows while continuing processing. - Enhanced `ResumeWorkflowTask` to handle missing workflow instances gracefully and log warnings. - Introduced thread synchronization in `LocalScheduler` with `lock` to prevent concurrent access issues. - Implemented and refactored tests to ensure behavior consistency and improve maintainability. - Added component tests for workflow deletion scenarios, covering running, completed, and non-existent workflows.
…delete logic - Added comprehensive component tests for workflow instance deletion scenarios (running, completed, bulk, and non-existent instances). - Refactored `BulkDelete` API to use `IWorkflowInstanceManager` for proper cleanup of related records (execution logs, activity executions, bookmarks).
…or with failing and successful workflows - Introduced `FailingMaterializer` and `WorkingMaterializer` for simulating failing and successful workflow materializations. - Added `TriggerDeletionTestScenario`, `TriggerTestDataBuilder`, and related test data classes to define comprehensive test cases. - Updated `DeleteTriggersAsync` tests with scenarios for materialization failures and mixed success. - Improved test coverage and maintainability with reusable test data builders and utilities.
… for improved readability and encapsulation
…sulation and readability in core workflow modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/modules/Elsa.Workflows.Core/Extensions/MemoryBlockReferenceExtensions.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR attempts to refactor extension methods to instance methods across the core workflow modules using an extension(Type parameter) syntax pattern. However, this refactoring introduces a critical compilation error.
Key Issue: The code uses extension(Type name) { ... } syntax which is not valid C# and does not exist in any released version of C# (including C# 9.0 which this project targets). C# extension methods must be defined as static methods in static classes with the this modifier on the first parameter.
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| WorkflowExecutionMiddlewareExtensions.cs | Attempts to convert middleware extension methods using invalid extension() syntax |
| ActivityExecutionMiddlewareExtensions.cs | Attempts to convert pipeline builder extensions using invalid extension() syntax |
| WorkflowExtensions.cs | Attempts to convert workflow extensions using invalid extension() syntax |
| WorkflowExecutionContextExtensions.cs | Attempts to convert execution context extensions using invalid extension() syntax |
| VariableExtensions.cs | Attempts to convert variable manipulation extensions using invalid extension() syntax |
| All other extension files | All follow the same invalid pattern of using extension() syntax blocks |
Impact: This PR will cause complete compilation failure across the entire Elsa.Workflows.Core module and any dependent projects. The syntax used is not recognized by the C# compiler.
...les/Elsa.Workflows.Core/Pipelines/WorkflowExecution/WorkflowExecutionMiddlewareExtensions.cs
Show resolved
Hide resolved
...les/Elsa.Workflows.Core/Pipelines/ActivityExecution/ActivityExecutionMiddlewareExtensions.cs
Outdated
Show resolved
Hide resolved
...les/Elsa.Workflows.Core/Pipelines/WorkflowExecution/WorkflowExecutionMiddlewareExtensions.cs
Outdated
Show resolved
Hide resolved
src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.cs
Show resolved
Hide resolved
src/modules/Elsa.Workflows.Core/Extensions/ExpressionExecutionContextExtensions.cs
Show resolved
Hide resolved
src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.InputOutput.cs
Show resolved
Hide resolved
...es/Elsa.Workflows.Core/Activities/Flowchart/Extensions/ActivityExecutionContextExtensions.cs
Outdated
Show resolved
Hide resolved
...es/Elsa.Workflows.Core/Activities/Flowchart/Extensions/ActivityExecutionContextExtensions.cs
Outdated
Show resolved
Hide resolved
…tivityExecutionMiddlewareExtensions.cs Co-authored-by: Copilot <[email protected]>
…rkflowExecutionMiddlewareExtensions.cs Co-authored-by: Copilot <[email protected]>
…n and simplify methods - Converted extension methods to instance methods for better readability and maintainability. - Introduced helper methods to encapsulate logic for common operations like detecting unconsumed tokens, running instances, scheduled works, and faulted children. - Improved reusability and cohesion of workflow-related logic.
…prove accessibility and reusability of workflow logic
…ntextExtensions.InputOutput.cs Co-authored-by: Copilot <[email protected]>
…y by simplifying conditional expression
Refactors extension methods in core workflow modules to instance methods.
This improves encapsulation and readability by:
This change is