Workflow Business Rules
Summary
This is the authoritative catalog of 30 verified Workflow business rules.
Business Purpose
Provide a reviewable source of truth for authoring, publication, routing, task decisions, tenancy and evidence behavior.
Actors
Workflow authors, approvers, delegates, process initiators, tenant administrators, product owners, support teams and owners of connected business modules.
Business Flow
| ID | Rule | Trigger | Outcome | Validation | Source |
|---|---|---|---|---|---|
| WF-BR-01 | Tenant context is required for commands | Create, update, publish, start or task action | Operation uses tenant scope | Missing tenant raises request error | Application/Common/Abstractions.cs |
| WF-BR-02 | Definition key is required | Create | Invalid result | Nonblank check | WorkflowDefinitionCommands.cs |
| WF-BR-03 | Definition name is required | Create | Invalid result | Nonblank check | WorkflowDefinitionCommands.cs |
| WF-BR-04 | Key is tenant-unique | Create | Conflict if duplicate | Repository existence check and unique index | WorkflowDefinitionCommands.cs |
| WF-BR-05 | Category defaults to General | Create without category | General stored | Domain factory fallback | WorkflowDefinition.cs |
| WF-BR-06 | Creation opens draft version 1 | Create | Definition/Draft v1 | Domain factory | WorkflowDefinition.cs |
| WF-BR-07 | Submitted steps replace draft contents | Create/update with steps | Steps and conditions rebuilt | Published guard | WorkflowDefinition.cs |
| WF-BR-08 | Approver type must be recognized | Build steps | Invalid result for unknown type | Flexible enum parse | WorkflowDefinitionCommands.cs |
| WF-BR-09 | Step type defaults to Approval | Missing/unknown step type | Approval stored | Parse fallback | WorkflowDefinitionCommands.cs |
| WF-BR-10 | Step mode defaults to Sequential | Missing/unknown mode | Sequential stored | Parse fallback | WorkflowDefinitionCommands.cs |
| WF-BR-11 | Published versions are immutable | Replace published steps | Domain rejection | IsPublished guard | WorkflowDefinition.cs |
| WF-BR-12 | Editing steps after publish creates next draft | Update with steps | Version number increments | Editable-draft selection | WorkflowDefinition.cs |
| WF-BR-13 | Publication needs a current draft | Publish | Invalid without draft | Domain validation | WorkflowDefinition.cs |
| WF-BR-14 | Publication needs at least one step | Publish | Invalid empty draft | Step-count check | WorkflowDefinition.cs |
| WF-BR-15 | Start needs definition ID or key | Start | Invalid otherwise | Input branch | WorkflowInstanceCommands.cs |
| WF-BR-16 | Start needs a published version | Start | Invalid without published version | Published-version lookup | WorkflowInstanceCommands.cs |
| WF-BR-17 | Empty context is not serialized | Start | Null context JSON | Context-count check | WorkflowInstanceCommands.cs |
| WF-BR-18 | Stages are considered in ascending order | Start/advance | Earliest later applicable stage opens | Ordered distinct step orders | WorkflowInstanceCommands.cs |
| WF-BR-19 | All stage conditions must pass | Stage evaluation | Failed stage is skipped | Iterative all-condition check | WorkflowInstanceCommands.cs |
| WF-BR-20 | Conditions support equality and inequality | Stage evaluation | Case-insensitive comparison | ne/neq; other values act as eq | WorkflowInstanceCommands.cs |
| WF-BR-21 | No applicable stage auto-completes | Start/advance | Completed/Approved | Null next-stage result | WorkflowInstanceCommands.cs |
| WF-BR-22 | Same-order steps open together | Open stage | One task per step | Step-order grouping | WorkflowInstanceCommands.cs |
| WF-BR-23 | Stage advances after all tasks are nonpending | Approval | Next stage or completion | Stage completion check | WorkflowInstance.cs |
| WF-BR-24 | User approver uses configured user | Open stage | AssignedTo populated | Approver resolver | WorkflowInstanceCommands.cs |
| WF-BR-25 | Manager uses context then fallback value | Open stage | AssignedTo resolved | managerEmail/manager/value fallback | WorkflowInstanceCommands.cs |
| WF-BR-26 | Role, HR and Admin become role assignments | Open stage | AssignedRole populated | Approver resolver | WorkflowInstanceCommands.cs |
| WF-BR-27 | My tasks returns matching pending assignments | Query worklist | Caller email/role tasks | Status and identity predicate | WorkflowQueries.cs |
| WF-BR-28 | Decisions require Running/Pending | Approve/reject/delegate | Conflict otherwise | Status checks | WorkflowInstanceCommands.cs |
| WF-BR-29 | Any rejection rejects the instance | Reject task | Rejected result and completion time | Aggregate transition | WorkflowInstance.cs |
| WF-BR-30 | Delegation requires a destination and remains pending | Delegate | User reassigned; role cleared | Nonblank and status checks | WorkflowInstanceCommands.cs |
Responsibilities
Authors maintain valid draft steps before publication. Initiating modules supply a subject and routing context. Approvers act only on applicable pending tasks. Tenant and service owners govern access, integration enablement and operational support.
Business Rules
Catalog rules describe current implementation, not recommended policy. Audit/timeline/outbox atomicity and tenant query filtering are documented as control behavior outside the numbered execution catalog.
Integrations
Workflow Service owns definitions, versions, instances and tasks. Connected modules can synchronously start and read instances when their integration is enabled; lifecycle domain events are persisted to an outbox and relayed as integration events.
Limitations
Actor-to-assignment enforcement is absent; stored step mode does not alter execution; unsupported state enum values are not business capabilities.
Requires Confirmation
Production enablement, approver-role naming, upstream access enforcement, terminal decision propagation, notification ownership, retention and operating procedures require confirmation.
Source References
microservices/src/workflow-service/Domain/Workflow/WorkflowDefinition.csmicroservices/src/workflow-service/Domain/Workflow/WorkflowInstance.csmicroservices/src/workflow-service/Application/Commands/WorkflowDefinitionCommands.csmicroservices/src/workflow-service/Application/Commands/WorkflowInstanceCommands.csmicroservices/src/workflow-service/Application/Queries/WorkflowQueries.cs
Related Articles
See Also
Keywords
Workflow, approval, definition, version, task, delegation.
Revision Information
Draft source-backed business documentation reviewed on 2026-07-20; next quarterly review is 2026-10-20.