-
Notifications
You must be signed in to change notification settings - Fork 886
fix: do not skip parameter validation if min or max = 0 #7707
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
Conversation
Does it look like we need to update the dependency on protoc-gen-go-grpc? |
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.
Except for the potentially lossy migration, looks good! 👍🏻
BEGIN; | ||
ALTER TABLE template_version_parameters ALTER COLUMN validation_min DROP NOT NULL; | ||
ALTER TABLE template_version_parameters ALTER COLUMN validation_max DROP NOT NULL; | ||
UPDATE template_version_parameters SET validation_min = NULL WHERE validation_min = 0; |
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.
Thinking out loud, what if someone has explicitly specified min to be 0 so that -1 can't be used? This seems like a potentially lossy migration and we should probably wait until templates are updated to receive their new, null value?
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's not worse than what we have today, because we treat min=0 as disabling validation!
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.
Oh, didn't realize. That's both surprising and worrying, glad it's getting fixed. 😄
@@ -0,0 +1,6 @@ | |||
BEGIN; | |||
UPDATE template_version_parameters SET validation_min = 0 WHERE validation_min = NULL; | |||
UPDATE template_version_parameters SET validation_max = 0 WHERE validation_max = NULL; |
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.
On the other hand, the lossyness here seems fine.
Related: #7582
This PR fixes the validation issue which enforced defining
min
andmax
together for a coder_parameter. Once this is merged,mix
andmax
will be optional and not bound together.