Skip to content

feat(workflow): add WorkflowExecutorService for action dispatch#28

Open
mpge wants to merge 1 commit intomainfrom
feat/workflow-executor
Open

feat(workflow): add WorkflowExecutorService for action dispatch#28
mpge wants to merge 1 commit intomainfrom
feat/workflow-executor

Conversation

@mpge
Copy link
Copy Markdown
Member

@mpge mpge commented Apr 24, 2026

Summary

Ports the NestJS workflow-executor.service.ts to WordPress. The existing WorkflowEngine only evaluates conditions — this service parses the JSON action array on workflow.actions and dispatches each entry to TicketService / AssignmentService.

Action catalog: change_priority, change_status, assign_agent, set_department, add_tag, remove_tag, add_note, insert_canned_reply.

  • {{field}} placeholders in canned replies interpolated via WorkflowEngine::interpolateVariables
  • One failing action does not halt the others (warn-logged when WP_DEBUG is on) — mirrors NestJS
  • Unknown action types skip; malformed JSON returns an empty action list
  • The existing AutomationRunner stays as-is — Automations and Workflows are distinct surfaces

Scope

Executor only. Follow-up PRs:

  1. WorkflowRunner — loads matching workflows for a trigger event, evaluates conditions, writes WorkflowLog
  2. WP hook listener — bridges escalated_ticket_created / _replied / etc. into processEvent

Splitting keeps the diff reviewable and lets each piece land independently.

Test plan

  • 14 WP integration tests covering every action type + malformed-input paths (run via WP test harness)
  • CI green: test (8.1), test (8.2), lint

Ports the NestJS workflow-executor.service.ts to WordPress. The existing
WorkflowEngine only evaluates conditions; this service parses the JSON
action array stored on workflow.actions and dispatches each entry
against TicketService / AssignmentService.

Action catalog: change_priority, change_status, assign_agent,
set_department, add_tag, remove_tag, add_note, insert_canned_reply.
{{field}} placeholders in canned replies are interpolated via
WorkflowEngine::interpolateVariables.

One failing action does not halt the others (warn-logged when WP_DEBUG
is on). Unknown action types skip. Malformed JSON returns an empty
action list.

Follow-up PR will add the WorkflowRunner (loads matching workflows,
evaluates, writes WorkflowLog) and the hook that bridges
escalated_ticket_created / _replied / etc. into processEvent.

The existing AutomationRunner stays as-is — Automations and Workflows
are distinct product surfaces.
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.

1 participant