Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Nexus SDK 0.2.0 #1802

Merged
merged 2 commits into from
Feb 11, 2025
Merged

Upgrade to Nexus SDK 0.2.0 #1802

merged 2 commits into from
Feb 11, 2025

Conversation

bergundy
Copy link
Member

@bergundy bergundy commented Feb 5, 2025

Do not merge before we update the dependencies to use a published api-go and Nexus Go SDK.

Tested against server 1.26.2 and changes made in temporalio/temporal#7241.

@bergundy bergundy requested a review from a team as a code owner February 5, 2025 00:56
@bergundy bergundy force-pushed the nexus-0.2.0 branch 2 times, most recently from 1524297 to 1a3b09b Compare February 5, 2025 14:48

// workflowRunOperationToken is the decoded form of the workflow run operation token.
type workflowRunOperationToken struct {
NamespaceName string `json:"ns"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this format expected to be consistent across SDKs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect it to. Happy for others to chime in.

@@ -2504,7 +2504,7 @@ func (env *testWorkflowEnvironmentImpl) ExecuteNexusOperation(
}, true)
case *nexuspb.StartOperationResponse_AsyncSuccess:
env.postCallback(func() {
opID = v.AsyncSuccess.GetOperationId()
opID = v.AsyncSuccess.GetOperationToken()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
opID = v.AsyncSuccess.GetOperationToken()
opToken = v.AsyncSuccess.GetOperationToken()

@@ -3241,7 +3241,7 @@ func (h *testNexusOperationHandle) startedCallback(opID string, e error) {
// Ignore duplciate starts.
return
}
h.operationID = opID
h.operationToken = opID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
h.operationToken = opID
h.operationToken = opToken

@@ -444,9 +467,17 @@ func (h *nexusTaskHandler) nexusHandlerErrorToProto(handlerErr *nexus.HandlerErr
if err != nil {
return nil, err
}
var retryBehavior enumspb.NexusHandlerErrorRetryBehavior
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Not using errors.As to be consistent ApplicationError checking with the rest of the SDK.
if appErr, ok := err.(*ApplicationError); ok && appErr.NonRetryable() {
return nexus.NewFailedOperationError(appErr)
return &nexus.HandlerError{
// TODO(bergundy): Change this to a non retryable internal error after the 1.27.0 server release.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create to track this? Also doesn't this need to be done before GA since it is a breaking change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -444,9 +467,17 @@ func (h *nexusTaskHandler) nexusHandlerErrorToProto(handlerErr *nexus.HandlerErr
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it seems like we have all the Nexus error conversion logic here https://github.com/temporalio/sdk-go/pull/1802/files#diff-82a19cd3836c5a75e55d9c5d4400c0bfdd09029eb29fd1fa9755cf1a724f4654R86 except this one function. Not blocking but might be nice to group it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's maybe a slight duplication but I don't think it's very critical apart from the grouping.

return base64.URLEncoding.WithPadding(base64.NoPadding).EncodeToString(data), nil
}

func loadWorkflowRunOperationToken(data string) (workflowRunOperationToken, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During the meeting yesterday @cretz suggested we reserve v for a versioning field and fail if it is present. Did we decided not to do that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks, that slipped my mind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming in the next commit.

Copy link
Member Author

@bergundy bergundy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need an interceptor to get the client, I can add it here or in a separate PR.

return base64.URLEncoding.WithPadding(base64.NoPadding).EncodeToString(data), nil
}

func loadWorkflowRunOperationToken(data string) (workflowRunOperationToken, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks, that slipped my mind.

internal/failure_converter.go Show resolved Hide resolved
@Quinn-With-Two-Ns
Copy link
Contributor

I think we need an interceptor to get the client, I can add it here or in a separate PR.

Not sure I understand what do you mean exactly by "need an interceptor" here? We don't have Temporal Nexus inbound or outbound interceptors that is on my plate. When we add them GetClient would be part of the outbound interceptor.

@bergundy bergundy merged commit 22ebdc0 into temporalio:master Feb 11, 2025
12 checks passed
@bergundy bergundy deleted the nexus-0.2.0 branch February 11, 2025 00:39
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.

3 participants