-
Notifications
You must be signed in to change notification settings - Fork 220
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 versioning override with AutoUpgrade behavior #1765
Fix versioning override with AutoUpgrade behavior #1765
Conversation
@@ -105,6 +105,9 @@ func workflowExecutionOptionsMaskToProto(mask []string) *fieldmaskpb.FieldMask { | |||
} | |||
|
|||
func workerDeploymentToProto(d Deployment) *deploymentpb.Deployment { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make the source of this a pointer if unset is a valid state? Meaning, make VersioningOverride.Deployment
accept a pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was cleaner not to expose pointers and just use an empty struct. Otherwise you ended up with what "a pointer to an empty struct" means vs a nil pointer. It is also consistent with the other apis that use Deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like the server treats an empty struct here as invalid and errors is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise you ended up with what "a pointer to an empty struct" means vs a nil pointer.
If there is a difference between empty and null in the server-side API and we need to represent that difference, we should do the same here. If the server errors on empty, good, that tells the user it was invalid like it might for anything else invalid. If the server wants to treat empty and null as the same, we can too.
It is also consistent with the other apis that use Deployment.
Are there other fields where the zero value of a struct means nil when converting to proto? I think we should consider fixing those too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, other empty structs related to deployment are ok, but this one was not... They may eventually fix that, but this is
blocking the autoUpgrade override...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cretz There was a difference but it was not intentional, there should be no difference. It is just that the OSS server release is out, and it is better to fix it internally in the first SDK release without exposing it, and eventually change it in the server...
All the other values that I can think of would take either empty or nil. I mapped VersioningOverride{} to nil mostly to keep things more clear, but I don't think it is strictly needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment explaining this so future readers understand why we are inconsistent here?
If the server will always treat nil and empty the same then I am fine using an empty struct instead of a pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment added
What was changed
The current implementation for versioning override fails for AutoUpgrade
because it uses an empty Deployment struct instead of a nil pointer.
See #1764 for details.
Also missing
gofmt
of some unrelated files corrected.Why?
This is a blocker for the new versioning-3 implementation.
Checklist
Versioning override AutoUpgrade using a ref to an empty deployment struct instead of a nil pointer #1764
Integration test