diff --git a/common/testing/mocksdk/client_mock.go b/common/testing/mocksdk/client_mock.go index d9e9d46c0e3..83d786a7997 100644 --- a/common/testing/mocksdk/client_mock.go +++ b/common/testing/mocksdk/client_mock.go @@ -100,6 +100,20 @@ func (mr *MockClientMockRecorder) CompleteActivity(ctx, taskToken, result, err a return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompleteActivity", reflect.TypeOf((*MockClient)(nil).CompleteActivity), ctx, taskToken, result, err) } +// CompleteActivityByActivityID mocks base method. +func (m *MockClient) CompleteActivityByActivityID(ctx context.Context, namespace, activityID, activityRunID string, result any, err error) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CompleteActivityByActivityID", ctx, namespace, activityID, activityRunID, result, err) + ret0, _ := ret[0].(error) + return ret0 +} + +// CompleteActivityByActivityID indicates an expected call of CompleteActivityByActivityID. +func (mr *MockClientMockRecorder) CompleteActivityByActivityID(ctx, namespace, activityID, activityRunID, result, err any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompleteActivityByActivityID", reflect.TypeOf((*MockClient)(nil).CompleteActivityByActivityID), ctx, namespace, activityID, activityRunID, result, err) +} + // CompleteActivityByID mocks base method. func (m *MockClient) CompleteActivityByID(ctx context.Context, namespace, workflowID, runID, activityID string, result any, err error) error { m.ctrl.T.Helper() @@ -114,6 +128,21 @@ func (mr *MockClientMockRecorder) CompleteActivityByID(ctx, namespace, workflowI return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompleteActivityByID", reflect.TypeOf((*MockClient)(nil).CompleteActivityByID), ctx, namespace, workflowID, runID, activityID, result, err) } +// CountActivities mocks base method. +func (m *MockClient) CountActivities(ctx context.Context, options client.CountActivitiesOptions) (*client.CountActivitiesResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CountActivities", ctx, options) + ret0, _ := ret[0].(*client.CountActivitiesResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CountActivities indicates an expected call of CountActivities. +func (mr *MockClientMockRecorder) CountActivities(ctx, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountActivities", reflect.TypeOf((*MockClient)(nil).CountActivities), ctx, options) +} + // CountWorkflow mocks base method. func (m *MockClient) CountWorkflow(ctx context.Context, request *workflowservice.CountWorkflowExecutionsRequest) (*workflowservice.CountWorkflowExecutionsResponse, error) { m.ctrl.T.Helper() @@ -203,6 +232,26 @@ func (mr *MockClientMockRecorder) DescribeWorkflowExecution(ctx, workflowID, run return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeWorkflowExecution", reflect.TypeOf((*MockClient)(nil).DescribeWorkflowExecution), ctx, workflowID, runID) } +// ExecuteActivity mocks base method. +func (m *MockClient) ExecuteActivity(ctx context.Context, options client.StartActivityOptions, activity any, args ...any) (client.ActivityHandle, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, options, activity} + for _, a := range args { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ExecuteActivity", varargs...) + ret0, _ := ret[0].(client.ActivityHandle) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ExecuteActivity indicates an expected call of ExecuteActivity. +func (mr *MockClientMockRecorder) ExecuteActivity(ctx, options, activity any, args ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, options, activity}, args...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteActivity", reflect.TypeOf((*MockClient)(nil).ExecuteActivity), varargs...) +} + // ExecuteWorkflow mocks base method. func (m *MockClient) ExecuteWorkflow(ctx context.Context, options client.StartWorkflowOptions, workflow any, args ...any) (client.WorkflowRun, error) { m.ctrl.T.Helper() @@ -223,6 +272,20 @@ func (mr *MockClientMockRecorder) ExecuteWorkflow(ctx, options, workflow any, ar return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteWorkflow", reflect.TypeOf((*MockClient)(nil).ExecuteWorkflow), varargs...) } +// GetActivityHandle mocks base method. +func (m *MockClient) GetActivityHandle(options client.GetActivityHandleOptions) client.ActivityHandle { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetActivityHandle", options) + ret0, _ := ret[0].(client.ActivityHandle) + return ret0 +} + +// GetActivityHandle indicates an expected call of GetActivityHandle. +func (mr *MockClientMockRecorder) GetActivityHandle(options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActivityHandle", reflect.TypeOf((*MockClient)(nil).GetActivityHandle), options) +} + // GetSearchAttributes mocks base method. func (m *MockClient) GetSearchAttributes(ctx context.Context) (*workflowservice.GetSearchAttributesResponse, error) { m.ctrl.T.Helper() @@ -325,6 +388,21 @@ func (mr *MockClientMockRecorder) GetWorkflowUpdateHandle(ref any) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkflowUpdateHandle", reflect.TypeOf((*MockClient)(nil).GetWorkflowUpdateHandle), ref) } +// ListActivities mocks base method. +func (m *MockClient) ListActivities(ctx context.Context, options client.ListActivitiesOptions) (client.ListActivitiesResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListActivities", ctx, options) + ret0, _ := ret[0].(client.ListActivitiesResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListActivities indicates an expected call of ListActivities. +func (mr *MockClientMockRecorder) ListActivities(ctx, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListActivities", reflect.TypeOf((*MockClient)(nil).ListActivities), ctx, options) +} + // ListArchivedWorkflow mocks base method. func (m *MockClient) ListArchivedWorkflow(ctx context.Context, request *workflowservice.ListArchivedWorkflowExecutionsRequest) (*workflowservice.ListArchivedWorkflowExecutionsResponse, error) { m.ctrl.T.Helper() diff --git a/go.mod b/go.mod index aa2d4196166..bf8973058ec 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/lib/pq v1.10.9 github.com/maruel/panicparse/v2 v2.4.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/nexus-rpc/sdk-go v0.5.2-0.20260211051645-26b0b4c584e5 + github.com/nexus-rpc/sdk-go v0.6.0 github.com/olekukonko/tablewriter v0.0.5 github.com/olivere/elastic/v7 v7.0.32 github.com/prometheus/client_golang v1.21.0 @@ -60,7 +60,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.40.0 go.opentelemetry.io/otel/trace v1.40.0 go.temporal.io/api v1.62.5 - go.temporal.io/sdk v1.38.0 + go.temporal.io/sdk v1.41.1 go.uber.org/fx v1.24.0 go.uber.org/mock v0.6.0 go.uber.org/multierr v1.11.0 diff --git a/go.sum b/go.sum index ab7a7f9f222..5078aac257c 100644 --- a/go.sum +++ b/go.sum @@ -238,8 +238,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= -github.com/nexus-rpc/sdk-go v0.5.2-0.20260211051645-26b0b4c584e5 h1:Van9KGGs8lcDgxzSNFbDhEMNeJ80TbBxwZ45f9iBk9U= -github.com/nexus-rpc/sdk-go v0.5.2-0.20260211051645-26b0b4c584e5/go.mod h1:FHdPfVQwRuJFZFTF0Y2GOAxCrbIBNrcPna9slkGKPYk= +github.com/nexus-rpc/sdk-go v0.6.0 h1:QRgnP2zTbxEbiyWG/aXH8uSC5LV/Mg1fqb19jb4DBlo= +github.com/nexus-rpc/sdk-go v0.6.0/go.mod h1:FHdPfVQwRuJFZFTF0Y2GOAxCrbIBNrcPna9slkGKPYk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -378,8 +378,8 @@ go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOV go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.temporal.io/api v1.62.5 h1:9R/9CeyM7xqHSlsNt+QIvapQLcRxCZ38bnXQx4mCN6I= go.temporal.io/api v1.62.5/go.mod h1:iaxoP/9OXMJcQkETTECfwYq4cw/bj4nwov8b3ZLVnXM= -go.temporal.io/sdk v1.38.0 h1:4Bok5LEdED7YKpsSjIa3dDqram5VOq+ydBf4pyx0Wo4= -go.temporal.io/sdk v1.38.0/go.mod h1:a+R2Ej28ObvHoILbHaxMyind7M6D+W0L7edt5UJF4SE= +go.temporal.io/sdk v1.41.1 h1:yOpvsHyDD1lNuwlGBv/SUodCPhjv9nDeC9lLHW/fJUA= +go.temporal.io/sdk v1.41.1/go.mod h1:/InXQT5guZ6AizYzpmzr5avQ/GMgq1ZObcKlKE2AhTc= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= diff --git a/tests/nexus_workflow_test.go b/tests/nexus_workflow_test.go index 93ce8b1cd74..4acf8dd67fc 100644 --- a/tests/nexus_workflow_test.go +++ b/tests/nexus_workflow_test.go @@ -69,7 +69,7 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationCancelation() { h := nexustest.Handler{ OnStartOperation: func(ctx context.Context, service, operation string, input *nexus.LazyValue, options nexus.StartOperationOptions) (nexus.HandlerStartOperationResult[any], error) { if service != "service" { - return nil, nexus.HandlerErrorf(nexus.HandlerErrorTypeBadRequest, `expected service to equal "service"`) + return nil, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, `expected service to equal "service"`) } return &nexus.HandlerStartOperationResultAsync{OperationToken: "test"}, nil }, @@ -77,7 +77,7 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationCancelation() { if !firstCancelSeen { // Fail cancel request once to test NexusOperationCancelRequestFailed event is recorded and request is retried. firstCancelSeen = true - return nexus.HandlerErrorf(nexus.HandlerErrorTypeBadRequest, "intentional non-retyrable cancel error for test") + return nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "intentional non-retyrable cancel error for test") } return nil }, @@ -2057,17 +2057,17 @@ func (s *NexusWorkflowTestSuite) TestNexusSyncOperationErrorRehydration() { op := nexus.NewSyncOperation("op", func(ctx context.Context, outcome string, soo nexus.StartOperationOptions) (nexus.NoValue, error) { switch outcome { case "fail-handler-internal": - return nil, nexus.HandlerErrorf(nexus.HandlerErrorTypeInternal, "intentional internal error") + return nil, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeInternal, "intentional internal error") case "fail-handler-app-error": return nil, temporal.NewApplicationError("app error", "TestError", "details") case "fail-handler-bad-request": - return nil, nexus.HandlerErrorf(nexus.HandlerErrorTypeBadRequest, "bad request") + return nil, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "bad request") case "fail-operation": - return nil, nexus.NewOperationFailedError("some error") + return nil, nexus.NewOperationFailedErrorf("some error") case "fail-operation-app-error": return nil, temporal.NewNonRetryableApplicationError("app error", "TestError", nil, "details") } - return nil, nexus.HandlerErrorf(nexus.HandlerErrorTypeBadRequest, "unexpected outcome: %s", outcome) + return nil, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "unexpected outcome: %s", outcome) }) s.NoError(svc.Register(op)) @@ -2095,9 +2095,7 @@ func (s *NexusWorkflowTestSuite) TestNexusSyncOperationErrorRehydration() { var handlerErr *nexus.HandlerError require.ErrorAs(t, pendingErr, &handlerErr) require.Equal(t, nexus.HandlerErrorTypeInternal, handlerErr.Type) - var appErr *temporal.ApplicationError - require.ErrorAs(t, handlerErr.Cause, &appErr) - require.Equal(t, "intentional internal error", appErr.Message()) + require.Equal(t, "intentional internal error", handlerErr.Message) }, }, { @@ -2125,9 +2123,7 @@ func (s *NexusWorkflowTestSuite) TestNexusSyncOperationErrorRehydration() { var handlerErr *nexus.HandlerError require.ErrorAs(t, opErr, &handlerErr) require.Equal(t, nexus.HandlerErrorTypeBadRequest, handlerErr.Type) - var appErr *temporal.ApplicationError - require.ErrorAs(t, handlerErr.Cause, &appErr) - require.Equal(t, "bad request", appErr.Message()) + require.Equal(t, "bad request", handlerErr.Message) }, }, {