Workflows: a trigger registry modules can add to, and IWorkflowEngine obsoleted
- Dominant language
- C#
- Stars
- 6
- Forks
- 7
- Avg merge
- 4h 42m
- Merged PRs (30d)
- 307
Description
Workflow triggers are a fixed list in one class. `barakoCMS/Features/Workflows/WorkflowProjection.cs:26-58` maps four event kinds (created, updated, published, a named transition) to trigger names, and `TriggerEvent` is a free string (`barakoCMS/Models/WorkflowDefinition.cs:21`). `WorkflowEvents.Deleted` is declared (`barakoCMS/Models/WorkflowEvents.cs:21`) and never emitted. `IWorkflowEngine` is registered (`barakoCMS/Extensions/ServiceCollectionExtensions.cs:887`) and called only by tests, while the runner does the real work.
### Why it matters
A module cannot add a trigger: a form submitted, a file uploaded, a payment received, a member joined. #839 adds a schedule by putting a field on the definition rather than a trigger kind. A school that wants "when a registration is deleted, email the office" gets a workflow that saves and never fires, because nothing validates the string.
### The general concept
A trigger registry. Core registers its content triggers, modules register their own, each with a name and the shape of data it passes. Workflow definitions are validated against the registry on save, and the schedule trigger in #839 registers there too. `IWorkflowEngine` is marked `[Obsolete]` since nothing in the host calls it.
### Where it lives
Core: workflows, with registration open to modules.
### Compatibility
`IWorkflowEngine` is package surface, so it is marked `[Obsolete]` with removal in 6.0.0, one full major away, and keeps working. Existing definitions with the four current trigger names keep firing. Refusing an unknown trigger name on save tightens validation, so that part moves the contract version or starts as a warning in the response.
### Done when
- A module registers a trigger and a workflow on it fires, and a test showing that is not possible today.
- Saving a workflow with an unregistered trigger name is refused or warned, and a test covers `Deleted`.
- `IWorkflowEngine` carries `[Obsolete]` with a removal version.
Found in the architecture sweep of 15 September 2026.
Contributor guide
Research direction
Start with WorkflowProjection.cs:26-58, WorkflowDefinition.cs:21, WorkflowEvents.cs:21, and ServiceCollectionExtensions.cs:887 to trace current trigger mapping, validation, registration, and IWorkflowEngine usage. Read the workflow runner and existing workflow tests before deciding how module registration and unknown-trigger warnings or refusals fit the current contract. Done means a module trigger can fire in a workflow, Deleted is covered, unknown names are handled, and IWorkflowEngine has its removal-version Obsolete marker.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100