Skip to content

Conversation

@mdrichardson
Copy link
Contributor

@mdrichardson mdrichardson commented Nov 26, 2019

With compute_hash as:

def compute_hash(self, obj: object) -> str:
    # TODO: Should this be compatible with C# JsonConvert.SerializeObject ?
    return str(obj)

...the hashes always return as something like "DialogStack at memoryAddressXYZ". If the DialogStack changes (dialogs added/removed), the memory address doesn't change, so the hash appears to be the same and changes are not written.

With:

def compute_hash(self, obj: object) -> str:
    return str(Pickler().flatten(obj))

...the whole DialogStack would get serialized and changes are correctly detected.


This wasn't detected because MemoryStorage manipulates the objects in memory, anyway and doesn't actually need to call MemoryStorage.write(). With persistent storage, write wasn't being called enough and things like ConversationState weren't actually updating, preventing users from progressing through WaterfallDialogs.

@mdrichardson mdrichardson requested a review from axelsrz November 26, 2019 19:23
def compute_hash(self, obj: object) -> str:
# TODO: Should this be compatible with C# JsonConvert.SerializeObject ?
return str(obj)
return str(Pickler().flatten(obj))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! This is so important that I'm surprised that didn't blow up earlier

@axelsrz axelsrz merged commit 2b38e87 into master Nov 27, 2019
@axelsrz axelsrz deleted the mdrichardson-patch-1 branch November 27, 2019 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants