elsa-workflows / elsa-workflows/elsa-foundation

Extract a shared base for runtime scheduler work handlers (DRY)

Open
#274 1 comment 0 reactions 0 assignees View on GitHub
ready-for-agent status:todo
Dominant language
C#
Stars
5
Forks
1
Avg merge
3h 52m
Merged PRs (30d)
212

Description

_Filed from an automated code-quality analysis. Verified against source. Related to #253 (scheduler feature)._

## Problem
The runtime scheduler work handlers repeat the same building blocks across ~8 files: a near-identical try/catch JSON payload-deserialization block, a `ValidatePinnedExecutable()`-style validation body, and several private `New*()` factory methods that construct work items and post-commit intents. Any change to deserialization or validation must be applied in every handler.

## Locations
- `src/Elsa/Workflows/Runtime/Core/Services/WorkflowStartSchedulerWorkHandler.cs`
- `src/Elsa/Workflows/Runtime/Core/Services/WorkflowStartActivitySchedulerWorkHandler.cs`
- `src/Elsa/Workflows/Runtime/Core/Services/WorkflowScheduleActivitySchedulerWorkHandler.cs`
- `src/Elsa/Workflows/Runtime/Core/Services/WorkflowCheckpointSchedulerWorkHandler.cs`
- …and the other `*SchedulerWorkHandler.cs` peers in the same folder.

## Severity / impact
Medium. Duplication across critical runtime handlers; inconsistent validation/deserialization risk.

## Proposed remedy
Introduce a `SchedulerWorkHandlerBase` abstract class providing `DeserializePayload(...)` and shared pinned-executable validation, and extract a `RuntimeSchedulerWorkItemFactory` for the repeated work-item/intent construction. **Note:** issue #253 reports the scheduler solution currently does not compile — coordinate with / sequence after that fix before refactoring.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing issue #253 and the listed handlers in src/Elsa/Workflows/Runtime/Core/Services/, then inspect the other *SchedulerWorkHandler.cs peers for the repeated deserialization, validation, and factory patterns. Coordinate with the scheduler compilation fix before refactoring. Done means the shared base and RuntimeSchedulerWorkItemFactory cover the repeated work while the scheduler solution compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.