-
Notifications
You must be signed in to change notification settings - Fork 55
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
IWF-372: Fix GetSearchAttributes returning nil when no IwfExecutionStateIds are set #505
Conversation
9c505c6
to
656aac8
Compare
@@ -45,7 +45,8 @@ func MapToInternalSearchAttributes(attributes []iwfidl.SearchAttribute) (map[str | |||
|
|||
func MapCadenceToIwfSearchAttributes(searchAttributes *shared.SearchAttributes, requestedSearchAttributes []iwfidl.SearchAttributeKeyAndType) (map[string]iwfidl.SearchAttribute, error) { | |||
if searchAttributes == nil || len(requestedSearchAttributes) == 0 { | |||
return nil, nil | |||
// return empty map rather than 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.
unable to convert value <nil> to type KEYWORD_ARRAY for key IwfExecutingStateIds
The error was when we converting a nil to KeywordArray, so I believe it's at line 66...
You should be able to reproduce this, if you modify wait_until_search_attributes_optimization_test.go
to make it more complex -- for the default mode (ENABLED_FOR_STATES_WITH_WAIT_UNTIL_ONLY) , after the S7-1, start another S8 with waitUntil and it will try to refresh IwfExecutingStateIds
with 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.
Basically, whenever it tried to refresh IwfExecutingStateIds
that is nil. At the beginning this SA doesn't even exist so there wasn't error.
Then it was set to some values(array), and then cleared up as a nil. Then setting again will see the errors.
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.
Another easy way to produce this is using Java SDK:
S1->S2->S1 where S1 has waitUntil but S2 doesn't have.
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.
Fixed + made an existing test to verify it works as expected
I also think we should change Potentially, swallowing error and proceeding will cause wrong behavior -- we were super lucky last time that swallowing error was correct in that case 😂 By returning error, the workflow will be blocked and we have to fix the bug. |
bb73c66
to
b3cd703
Compare
b3cd703
to
dd70ab2
Compare
Description
Checklist
Related Issue
Closes #issue_number