-
Notifications
You must be signed in to change notification settings - Fork 805
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 mapping #6531
Fix mapping #6531
Conversation
whoops, got confused and accidentally pushed to the wrong fork, reopening |
if input == nil { | ||
panic("version history item is null") | ||
return nil |
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.
are callers assuming this function will always return non-nil or panic? If so we should go over them and handle nil case gracefully (potentially by returning a proper error) to avoid nil pointer exceptions downstream
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 tried to do that in the previous PR, though it's certainly possible I missed a few locations. The value I expect to be nil on the first request and subsequently used to keep track of the workflow state.
this case (CDNC-11702) I missed
What changed?
Fixes (hopefully) some mapping bugs I introduced with #6523 due to the version history being passed in being nil sometimes, therefore causing panics.
The mapping code as it's currently written panics (and is changed by this PR) which I think is the correct architectural choice. The mappers, by panicing as they presently are, are confusing validation with mapping. This corrects the mapper to gracefully handle nil input, and a quick survey appears to show that there are no expected areas which should never be nil that don't already have nil-check validation in place.
Specifically, in the case of
cadence/service/frontend/api/handler.go
Line 1954 in 5f579dd
Why?
How did you test it?
Potential risks
Release notes
Documentation Changes