Skip to content

Conversation

@sfmskywalker
Copy link
Member

@sfmskywalker sfmskywalker commented Nov 21, 2025

Refactors extension methods in core workflow modules to instance methods.

This improves encapsulation and readability by:

  • Reducing the number of extension methods.
  • Making the code more object-oriented and easier to understand.
  • Improving code discoverability.

This change is Reviewable

…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
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Copy link
Contributor

Copilot AI left a 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.

Base automatically changed from bug/7077 to develop/3.6.0 November 21, 2025 19:58
sfmskywalker and others added 6 commits November 24, 2025 14:53
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants