dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

Updates completed in the last WF task of a workflow are not written in history #406

Open dhiaayachi opened 2 months ago

dhiaayachi commented 2 months ago

Expected Behavior

Updates completed in the last WF task of a workflow are written in history

Actual Behavior

Updates completed in the last WF task of a workflow are not written in history.

Steps to Reproduce the Problem

Sending an update to this workflow

func UpdateWorkflow(ctx workflow.Context) (string, error) {
    channel := workflow.NewChannel(ctx)
    err := workflow.SetUpdateHandler(ctx, "string-update", func(value string) (string, error) {
        channel.Send(ctx, value)
        return value, nil
    })
    if err != nil {
        return "", err
    }

    var value string
    channel.Receive(ctx, &value)
    return value, nil
}

Results in this history, that does not have an update accepted or update completed event.

[
  {
    "eventId": "1",
    "eventTime": "2023-04-03T13:05:32.160078Z",
    "eventType": "WorkflowExecutionStarted",
    "version": "0",
    "taskId": "1049883",
    "workerMayIgnore": false,
    "workflowExecutionStartedEventAttributes": {
      "workflowType": {
        "name": "UpdateWorkflow"
      },
      "parentWorkflowNamespace": "",
      "parentWorkflowNamespaceId": "",
      "parentWorkflowExecution": null,
      "parentInitiatedEventId": "0",
      "taskQueue": {
        "name": "tq-ffc81536-2576-49e8-be6e-35c3243ae6a1-TestIntegrationSuite/TestUpdateWorkflow",
        "kind": "Normal"
      },
      "input": null,
      "workflowExecutionTimeout": "15s",
      "workflowRunTimeout": "15s",
      "workflowTaskTimeout": "1s",
      "continuedExecutionRunId": "",
      "initiator": "Unspecified",
      "continuedFailure": null,
      "lastCompletionResult": null,
      "originalExecutionRunId": "816dbfbb-97d8-4b12-a9c5-3a5a551fbb76",
      "identity": "73816@Quinn-Klassens-MacBook-Pro.local@",
      "firstExecutionRunId": "816dbfbb-97d8-4b12-a9c5-3a5a551fbb76",
      "retryPolicy": null,
      "attempt": 1,
      "workflowExecutionExpirationTime": "2023-04-03T13:05:47.159Z",
      "cronSchedule": "",
      "firstWorkflowTaskBackoff": "0s",
      "memo": null,
      "searchAttributes": null,
      "prevAutoResetPoints": null,
      "header": {
        "fields": {}
      },
      "parentInitiatedEventVersion": "0"
    }
  },
  {
    "eventId": "2",
    "eventTime": "2023-04-03T13:05:32.160152Z",
    "eventType": "WorkflowTaskScheduled",
    "version": "0",
    "taskId": "1049884",
    "workerMayIgnore": false,
    "workflowTaskScheduledEventAttributes": {
      "taskQueue": {
        "name": "tq-ffc81536-2576-49e8-be6e-35c3243ae6a1-TestIntegrationSuite/TestUpdateWorkflow",
        "kind": "Normal"
      },
      "startToCloseTimeout": "1s",
      "attempt": 1
    }
  },
  {
    "eventId": "3",
    "eventTime": "2023-04-03T13:05:32.167600Z",
    "eventType": "WorkflowTaskStarted",
    "version": "0",
    "taskId": "1049893",
    "workerMayIgnore": false,
    "workflowTaskStartedEventAttributes": {
      "scheduledEventId": "2",
      "identity": "73816@Quinn-Klassens-MacBook-Pro.local@",
      "requestId": "759c7b00-0b79-43db-a809-942241caf43e",
      "suggestContinueAsNew": false,
      "historySizeBytes": "798"
    }
  },
  {
    "eventId": "4",
    "eventTime": "2023-04-03T13:05:32.170337Z",
    "eventType": "WorkflowTaskCompleted",
    "version": "0",
    "taskId": "1049897",
    "workerMayIgnore": false,
    "workflowTaskCompletedEventAttributes": {
      "scheduledEventId": "2",
      "startedEventId": "3",
      "identity": "73816@Quinn-Klassens-MacBook-Pro.local@",
      "binaryChecksum": "8fdfc468d7abcb59aa1b177d806ee337",
      "workerVersioningId": null,
      "sdkMetadata": {
        "coreUsedFlags": [],
        "langUsedFlags": []
      },
      "meteringMetadata": {
        "nonfirstLocalActivityExecutionAttempts": 0
      }
    }
  },
  {
    "eventId": "5",
    "eventTime": "2023-04-03T13:05:33.165635Z",
    "eventType": "WorkflowTaskScheduled",
    "version": "0",
    "taskId": "1049901",
    "workerMayIgnore": false,
    "workflowTaskScheduledEventAttributes": {
      "taskQueue": {
        "name": "Quinn-Klassens-MacBook-Pro.local:d8f5c194-fddb-40f1-b192-8f06895a6eba",
        "kind": "Sticky"
      },
      "startToCloseTimeout": "1s",
      "attempt": 1
    }
  },
  {
    "eventId": "6",
    "eventTime": "2023-04-03T13:05:33.166436Z",
    "eventType": "WorkflowTaskStarted",
    "version": "0",
    "taskId": "1049902",
    "workerMayIgnore": false,
    "workflowTaskStartedEventAttributes": {
      "scheduledEventId": "5",
      "identity": "73816@Quinn-Klassens-MacBook-Pro.local@",
      "requestId": "b3fdbe37-6124-4014-ae47-d691d0cadbaf",
      "suggestContinueAsNew": false,
      "historySizeBytes": "1015"
    }
  },
  {
    "eventId": "7",
    "eventTime": "2023-04-03T13:05:33.171298Z",
    "eventType": "WorkflowTaskCompleted",
    "version": "0",
    "taskId": "1049903",
    "workerMayIgnore": false,
    "workflowTaskCompletedEventAttributes": {
      "scheduledEventId": "5",
      "startedEventId": "6",
      "identity": "73816@Quinn-Klassens-MacBook-Pro.local@",
      "binaryChecksum": "8fdfc468d7abcb59aa1b177d806ee337",
      "workerVersioningId": null,
      "sdkMetadata": {
        "coreUsedFlags": [],
        "langUsedFlags": []
      },
      "meteringMetadata": {
        "nonfirstLocalActivityExecutionAttempts": 0
      }
    }
  },
  {
    "eventId": "8",
    "eventTime": "2023-04-03T13:05:33.171325Z",
    "eventType": "WorkflowExecutionCompleted",
    "version": "0",
    "taskId": "1049904",
    "workerMayIgnore": false,
    "workflowExecutionCompletedEventAttributes": {
      "result": {
        "payloads": [
          {
            "metadata": {
              "encoding": "anNvbi9wbGFpbg=="
            },
            "data": "InZhbHVlIg=="
          }
        ]
      },
      "workflowTaskCompletedEventId": "7",
      "newExecutionRunId": ""
    }
  }
]

Specifications