fix(api): raise an error if protocol's defined parameters have duplicate variable names #14888
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Closes AUTH-333.
An unintended behavior was found where protocol analysis would let you have two parameters share the same variable name. Not only would this cause issues reporting them since we key them by variable name, the protocol itself would only use the latter value, leading to unintended behavior. I thought this case would be covered once the parameters would be set, but since they are all stored in a dictionary, that was actually never being encountered since the latest one would overwrite the previous one.
Now we have an explicit check for uniqueness, raising an appropriate error message if you have two (or more, though it'll raise on the second) variable names shared.
Test Plan
Along with unit test coverage, ensured this protocol from the ticket now correctly raises.
Review requests
Risk assessment
Low, simple bug fix.