Skip to content

Add Nexus link converter for Link_Callback - #322

Merged
atol merged 2 commits into
mainfrom
alicelin/NEXUS-952/link-callback
Oct 16, 2026
Merged

atol merged 2 commits into
mainfrom
alicelin/NEXUS-952/link-callback

Conversation

@atol

@atol atol commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

What changed?

Added conversion between commonpb.Link_Callback and Nexus links to temporalnexus. It uses the same URL format the server introduced in temporalio/temporal#12070.

Why?

The server now sends Callback links, but api-go, and so the Go SDK, doesn't recognize them and drops them. This change lets those links round-trip the same way they do on the server.

How did you test it?

Added unit tests.

Potential risks

None.

@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@atol
atol marked this pull request as ready for review October 15, 2026 19:19
@atol
atol requested review from a team as code owners October 15, 2026 19:19
@atol
atol requested review from Evanthx and chrsmith October 15, 2026 19:19

@Evanthx Evanthx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two nits, but overall I liked it!

}
var err error
if nexusLink, err = ConvertLinkCallbackToNexusLink(v.Callback); err != nil {
return nil, false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This error is lost. Should log it at least, not sure altering this method to return the error is worthwhile!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't feel strongly about it, but I kinda disagree.

The (*nexuspb.Link, bool) return value communicates that the function will return false if there is a problem. So I don't know if us seeing a bad input is enough of a concern to write it into the logs. Kinda like in other languages you might have a func TryParse(s string) (int, bool) function that would swallow errors.

Also, wiring in the context needed to find the right log stream might be pain. And/or writing to STDOUT/STDERR might cause other headaches.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

+1 to what Chris said, I don't think we should log here.

if err != nil {
return decodedLink{}, err
}
return decodedLink{namespace: segments[0], id: segments[1], runID: segments[2], query: link.URL.Query()}, nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be worth checking that there are three elements in segments - or at least setting up a unit test that runs this with an empty segment array and just makes sure it all works nicely or fails nicely!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a check for the number of segments in decodeSegments.

@chrsmith chrsmith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Modulo nitpicks this LGTM.


// ConvertNexusLinkToLinkCallback converts a Nexus Link to Link_Callback.
//
// NOTE: Experimental

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: I'm personally conflicted about this // NOTE: Experimental comment.

On one hand, this code is specifically to support a feature that isn't in a pre-release stage. And we literally call that out as "Experimental". (https://docs.temporal.io/evaluate/product-release-stages)

But I also think that we'd ever plan on removing this code if we didn't ship Worker Callbacks. Or if we did, going back and removing the // NOTE: Experimental comments.

I don't have a good answer for what we should do instead. Just that I personally don't like seeing // NOTE: Experimental in the codebase for files that haven't been touched in years 😅 .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I don't have a good answer either. But I think it's okay to mark it as experimental for now 🤷‍♀️

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.

5 participants