Skip to content

Commit

Permalink
IWF-542: Update iwf-idl and replace deprecated workflow type error
Browse files Browse the repository at this point in the history
  • Loading branch information
stevo89519 committed Jan 31, 2025
1 parent 2a439d5 commit 23dc72b
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 9 deletions.
7 changes: 7 additions & 0 deletions gen/iwfidl/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ components:
workflowConfigOverride:
disableSystemSearchAttribute: true
continueAsNewThreshold: 1
optimizeTimer: true
continueAsNewPageSizeInBytes: 4
executingStateIdMode: null
optimizeActivity: true
Expand Down Expand Up @@ -1011,6 +1012,7 @@ components:
workflowConfigOverride:
disableSystemSearchAttribute: true
continueAsNewThreshold: 1
optimizeTimer: true
continueAsNewPageSizeInBytes: 4
executingStateIdMode: null
optimizeActivity: true
Expand Down Expand Up @@ -1341,6 +1343,7 @@ components:
- STATE_DECISION_FAILING_WORKFLOW_ERROR_TYPE
- CLIENT_API_FAILING_WORKFLOW_ERROR_TYPE
- STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE
- STATE_API_FAIL_ERROR_TYPE
- INVALID_USER_WORKFLOW_CODE_ERROR_TYPE
- RPC_ACQUIRE_LOCK_FAILURE
- SERVER_INTERNAL_ERROR_TYPE
Expand Down Expand Up @@ -1601,6 +1604,7 @@ components:
workflowConfig:
disableSystemSearchAttribute: true
continueAsNewThreshold: 1
optimizeTimer: true
continueAsNewPageSizeInBytes: 4
executingStateIdMode: null
optimizeActivity: true
Expand Down Expand Up @@ -3284,6 +3288,7 @@ components:
example:
disableSystemSearchAttribute: true
continueAsNewThreshold: 1
optimizeTimer: true
continueAsNewPageSizeInBytes: 4
executingStateIdMode: null
optimizeActivity: true
Expand All @@ -3298,6 +3303,8 @@ components:
type: integer
optimizeActivity:
type: boolean
optimizeTimer:
type: boolean
type: object
Context:
example:
Expand Down
26 changes: 26 additions & 0 deletions gen/iwfidl/docs/WorkflowConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Name | Type | Description | Notes
**ContinueAsNewThreshold** | Pointer to **int32** | | [optional]
**ContinueAsNewPageSizeInBytes** | Pointer to **int32** | | [optional]
**OptimizeActivity** | Pointer to **bool** | | [optional]
**OptimizeTimer** | Pointer to **bool** | | [optional]

## Methods

Expand Down Expand Up @@ -154,6 +155,31 @@ SetOptimizeActivity sets OptimizeActivity field to given value.

HasOptimizeActivity returns a boolean if a field has been set.

### GetOptimizeTimer

`func (o *WorkflowConfig) GetOptimizeTimer() bool`

GetOptimizeTimer returns the OptimizeTimer field if non-nil, zero value otherwise.

### GetOptimizeTimerOk

`func (o *WorkflowConfig) GetOptimizeTimerOk() (*bool, bool)`

GetOptimizeTimerOk returns a tuple with the OptimizeTimer field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetOptimizeTimer

`func (o *WorkflowConfig) SetOptimizeTimer(v bool)`

SetOptimizeTimer sets OptimizeTimer field to given value.

### HasOptimizeTimer

`func (o *WorkflowConfig) HasOptimizeTimer() bool`

HasOptimizeTimer returns a boolean if a field has been set.


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
2 changes: 2 additions & 0 deletions gen/iwfidl/docs/WorkflowErrorType.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

* `STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE` (value: `"STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE"`)

* `STATE_API_FAIL_ERROR_TYPE` (value: `"STATE_API_FAIL_ERROR_TYPE"`)

* `INVALID_USER_WORKFLOW_CODE_ERROR_TYPE` (value: `"INVALID_USER_WORKFLOW_CODE_ERROR_TYPE"`)

* `RPC_ACQUIRE_LOCK_FAILURE` (value: `"RPC_ACQUIRE_LOCK_FAILURE"`)
Expand Down
36 changes: 36 additions & 0 deletions gen/iwfidl/model_workflow_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gen/iwfidl/model_workflow_error_type.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integ/wf_state_api_fail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func doTestStateApiFail(t *testing.T, backendType service.BackendType, config *i
assertions.Equalf(&iwfidl.WorkflowGetResponse{
WorkflowRunId: startResp.GetWorkflowRunId(),
WorkflowStatus: iwfidl.FAILED,
ErrorType: ptr.Any(iwfidl.STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE),
ErrorType: ptr.Any(iwfidl.STATE_API_FAIL_ERROR_TYPE),
ErrorMessage: iwfidl.PtrString("statusCode: 400, responseBody: {}, errMsg: 400 Bad Request (%!s(*string=<nil>))"),
}, resp, "response not expected")
}
2 changes: 1 addition & 1 deletion integ/wf_state_api_timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func doTestStateApiTimeout(t *testing.T, backendType service.BackendType, config
assertions.Equalf(&iwfidl.WorkflowGetResponse{
WorkflowRunId: startResp.GetWorkflowRunId(),
WorkflowStatus: iwfidl.FAILED,
ErrorType: ptr.Any(iwfidl.STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE),
ErrorType: ptr.Any(iwfidl.STATE_API_FAIL_ERROR_TYPE),
ErrorMessage: resp.ErrorMessage,
}, resp, "response not expected")
}
4 changes: 2 additions & 2 deletions replayTests/history/v4-local-activity-optimization.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
"encodedAttributes": null,
"cause": null,
"applicationFailureInfo": {
"type": "STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE",
"type": "STATE_API_FAIL_ERROR_TYPE",
"nonRetryable": false,
"details": {
"payloads": [
Expand Down Expand Up @@ -468,7 +468,7 @@
"encodedAttributes": null,
"cause": null,
"applicationFailureInfo": {
"type": "STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE",
"type": "STATE_API_FAIL_ERROR_TYPE",
"nonRetryable": false,
"details": {
"payloads": [
Expand Down
8 changes: 4 additions & 4 deletions service/interpreter/activityImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func StateApiWaitUntil(
})
return nil, composeHttpError(
activityInfo.IsLocalActivity,
provider, err, httpResp, string(iwfidl.STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE))
provider, err, httpResp, string(iwfidl.STATE_API_FAIL_ERROR_TYPE))
}

if err := checkCommandRequestFromWaitUntilResponse(resp); err != nil {
Expand Down Expand Up @@ -150,7 +150,7 @@ func StateApiExecute(
})
return nil, composeHttpError(
activityInfo.IsLocalActivity,
provider, err, httpResp, string(iwfidl.STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE))
provider, err, httpResp, string(iwfidl.STATE_API_FAIL_ERROR_TYPE))
}

if err = checkStateDecisionFromResponse(resp); err != nil {
Expand Down Expand Up @@ -206,13 +206,13 @@ func printDebugMsg(logger UnifiedLogger, err error, url string) {

func composeStartApiRespError(provider ActivityProvider, err error, resp *iwfidl.WorkflowStateStartResponse) error {
respStr, _ := resp.MarshalJSON()
return provider.NewApplicationError(string(iwfidl.STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE),
return provider.NewApplicationError(string(iwfidl.STATE_API_FAIL_ERROR_TYPE),
fmt.Sprintf("err msg: %v, response: %v", err, string(respStr)))
}

func composeExecuteApiRespError(provider ActivityProvider, err error, resp *iwfidl.WorkflowStateDecideResponse) error {
respStr, _ := resp.MarshalJSON()
return provider.NewApplicationError(string(iwfidl.STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE),
return provider.NewApplicationError(string(iwfidl.STATE_API_FAIL_ERROR_TYPE),

Check warning on line 215 in service/interpreter/activityImpl.go

View check run for this annotation

Codecov / codecov/patch

service/interpreter/activityImpl.go#L215

Added line #L215 was not covered by tests
fmt.Sprintf("err msg: %v, response: %v", err, string(respStr)))
}

Expand Down
2 changes: 1 addition & 1 deletion service/interpreter/workflowImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ func convertStateApiActivityError(provider WorkflowProvider, err error) error {
if provider.IsApplicationError(err) {
return err
}
return provider.NewApplicationError(string(iwfidl.STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE), err.Error())
return provider.NewApplicationError(string(iwfidl.STATE_API_FAIL_ERROR_TYPE), err.Error())
}

func getCommandThreadName(prefix string, stateExecId, cmdId string, idx int) string {
Expand Down

0 comments on commit 23dc72b

Please sign in to comment.