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

Fix proxy manipulation of single payload fields #202

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

bergundy
Copy link
Member

What changed?

Fixed a bug where the proxy visited single payload fields but didn't actually set the converted result on the parent object.

@bergundy bergundy requested review from a team as code owners January 17, 2025 14:57
Copy link
Member

@cretz cretz 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 this was originally caused by moving internally from a mutating visitor to a returning visitor in #119 (though it's not the fault of that issue that we didn't have a test for single-payload case).

@@ -273,6 +273,14 @@ func visitPayloads(
if options.SkipSearchAttributes { continue }
{{end}}
if o == nil { continue }
{{range $record.Payloads -}}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we then should just remove the case *common.Payload logic altogether? Or if we want that to work for people passing in payload directly to the visitor, then we should probably just make case *common.Payload work (i.e. replace the data and metadata fields of the visitPayload result). And if that's the case, you don't need these other changes I assume.

So I say either 1) keep your logic and remove the case *common.Payload and document to users that this doesn't work when you pass in Payload directly, or 2) fix case *common.Payload and remove this new stuff.

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 yeah, we can remove the *common.Payload case. Let's just do that.

Copy link
Member

@cretz cretz Jan 17, 2025

Choose a reason for hiding this comment

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

Works for me. I would like to request that we update the VisitPayloads Godoc to mention that directly visiting *common.Payload does not work, but that is non-blocking (this is kinda a compat break too)

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me do this in a follow up PR since this is blocking a release and I won't have time to do it otherwise.

@bergundy bergundy force-pushed the proxy-single-payload-fix branch from 6926d41 to be23dd9 Compare January 17, 2025 17:13
@bergundy bergundy requested a review from cretz January 17, 2025 17:15
bergundy added a commit to temporalio/samples-go that referenced this pull request Jan 17, 2025
## What was changed

Updates SDK and Server dependencies.

## Why?

Triaging a bug observed internally using a grpc-proxy with workflows that use a Nexus Operation. I wanted to reproduce with purely OSS sample code, which required updating dependencies to get the Nexus workflowservice methods.

Note that there's a bug in the proxy that doesn't handle single Payload fields properly that will be fixed in temporalio/api-go#202.

## Checklist

1. How was this tested:
Running both `grpc-proxy` and `nexus` samples. I didn't test the OIDC path, however.

---------

Co-authored-by: Roey Berman <roey.berman@gmail.com>
@@ -273,6 +273,14 @@ func visitPayloads(
if options.SkipSearchAttributes { continue }
{{end}}
if o == nil { continue }
{{range $record.Payloads -}}
Copy link
Member

@cretz cretz Jan 17, 2025

Choose a reason for hiding this comment

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

Works for me. I would like to request that we update the VisitPayloads Godoc to mention that directly visiting *common.Payload does not work, but that is non-blocking (this is kinda a compat break too)

@bergundy bergundy merged commit a6b8ad8 into temporalio:master Jan 17, 2025
3 checks passed
@bergundy bergundy deleted the proxy-single-payload-fix branch January 21, 2025 14:24
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.

4 participants