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

[api-go] Repeated Payload not being visited #1865

Open
yuandrew opened this issue Mar 12, 2025 · 0 comments
Open

[api-go] Repeated Payload not being visited #1865

yuandrew opened this issue Mar 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@yuandrew
Copy link
Contributor

yuandrew commented Mar 12, 2025

Expected Behavior

Visitor should visit this repeated temporal.api.common.v1.Payload https://github.com/temporalio/api/blob/9156239c8272003b6f228951602ca2b130a55876/temporal/api/workflowservice/v1/request_response.proto#L938

This test should pass

func TestVisitPayloads_AggregationGroup(t *testing.T) {
	// Due to us not visiting protos inside Any, this test used to fail
	root := &workflowservice.CountWorkflowExecutionsResponse_AggregationGroup{GroupValues: []*common.Payload{{Data: []byte("orig-val")}}}

	var count int
	// Visit with any recursion enabled and only change orig-val
	err := VisitPayloads(context.Background(), root, VisitPayloadsOptions{
		Visitor: func(ctx *VisitPayloadsContext, p []*common.Payload) ([]*common.Payload, error) {
			count += 1
			// Only mutate if the payloads has orig-val
			if len(p) == 1 && string(p[0].Data) == "orig-val" {
				return []*common.Payload{{Data: []byte("new-val")}}, nil
			}
			return p, nil
		},
	})
	require.NoError(t, err)
	require.Equal(t, 1, count)
}

Actual Behavior

Test is failing due to Payload not being visited.

Steps to Reproduce the Problem

Specifications

  • Version:
  • Platform:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant