Skip to content

[core] WorkflowRunEvent loses the phase, so every event of an action shows the same label #261

Description

@gabiudrescu

What happens

Expanding one activity in the admin gives four rows that read identically:

#1  08:40:41 - demo.fulfilment.charge_card
#3  08:40:41 - demo.fulfilment.charge_card
#4  08:40:41 - demo.fulfilment.charge_card
#5  08:40:41 - demo.fulfilment.charge_card

They are ActivityScheduled, ActivityTaskStarted, ActivityTaskCompleted and ActivityCompleted. A reader cannot tell which is which, and the natural conclusion is that the dashboard is repeating itself.

Why

WorkflowRunEvent carries label, kind, actionKey, started and failed. label is the name of the thing, and kind is its nature. Neither says what happened to it. started and failed are the only phase information, and they cover two phases out of four.

So the template has nothing to print but the action name, once per event.

Ask

A phase on WorkflowRunEvent, set by JournalRunHistoryReader where the event class is already known:

enum WorkflowRunEventPhase: string
{
    case Requested = 'requested';   // scheduled: the workflow asked
    case Started   = 'started';     // a worker picked it up
    case Failed    = 'failed';      // an attempt failed
    case Settled   = 'settled';     // the result the workflow observes
}

started and failed fold into it. The same four rows then read:

#1  08:40:41  REQUESTED  orderNumber: "000000018", amountInCents: 115918
#3  08:40:41  STARTED    try 1
#4  08:40:41  SETTLED    "ch_000000018"

Why I am asking rather than sending a patch

I have this working in the browser, by guessing the phase from the shape of the recorded payload: payload + metadata means requested, attempt means started, failureClass means failed, result means settled. It works on every event this journal produces, and it is guesswork - the shapes are not a contract, and Temporal's history has different ones.

The reader knows the event class. It should say so, and the shape of that field is the author's call.

Related

The attempt number is in the payload (attempt) but not on WorkflowRunEvent either, so "try 2" is only reachable by parsing details. Worth exposing alongside the phase.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions