Skip to content
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

Update Buffer ser/de variant indices #261

Closed
wants to merge 2 commits into from

Conversation

mickvangelderen
Copy link

No description provided.

Copy link

@andreisilviudragnea andreisilviudragnea left a comment

Choose a reason for hiding this comment

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

There needs to be a unit test which verifies if the serde serialization code before and after #259 depends on the values of these numbers or not.

@mickvangelderen
Copy link
Author

mickvangelderen commented Jan 12, 2024

There needs to be a unit test which verifies if the serde serialization code before and after #259 depends on the values of these numbers or not.

@andreisilviudragnea Do you mean if the serialized value depends on the variant indices? It probably does, given that you need to supply them as well in the deserialization implementation.

@anton-lisanin mentioned that we are free to change the serialized format. It does not need to be backwards compatible.

I do think it would be a good idea to assert that serializing and deserializing gives back something equivalent to the original, if we don't already have those tests.

@andreisilviudragnea
Copy link

I know from previous experience that changing serialization code without unit tests is dangerous.

The concrete serialization framework which should be tested here is bincode.

@mickvangelderen
Copy link
Author

I know from previous experience that changing serialization code without unit tests is dangerous.

That goes for pretty much any code 🤡 .

So to your knowledge there are no unit tests for this. I suppose our integration tests should catch problems with the serialization but having it unit tested would give a better guarantee and earlier feedback.

@mickvangelderen
Copy link
Author

@andreisilviudragnea FYI added tests.

@anton-lisanin
Copy link
Collaborator

@anton-lisanin mentioned that we are free to change the serialized format. It does not need to be backwards compatible.

We need to keep backward compatibility for deserialization.
It's ok to change serialization format, but deserialization function should handle both old and new formats.

Copy link
Collaborator

@anton-lisanin anton-lisanin left a comment

Choose a reason for hiding this comment

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

Rejected.
With this code, it is not possible to deserialize from the buffer that was serialized in the previous version.

@mickvangelderen
Copy link
Author

mickvangelderen commented Jan 12, 2024

We need to keep backward compatibility for deserialization. It's ok to change serialization format, but deserialization function should handle both old and new formats.

Ah I misunderstood you then. We should have tests to assert we can deserialize the old format in that case. This also means that develop is currently broken since we error on unknown variants including the previously valid 0 variant (buffer::Inner::Empty).

@mickvangelderen
Copy link
Author

This PR was made based on the assumption that we can make backwards incompatible changes to the serialized format which is not the case. I've opened #263 to implement unit tests which guarantee that the serialized data looks a certain way, and that serialized data from previous and the current version can be successfully deserialized.

@mickvangelderen mickvangelderen deleted the update-buffer-variant-indices branch January 12, 2024 19:34
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