unison icon indicating copy to clipboard operation
unison copied to clipboard

Create testing harness for multi-node serialization

Open pchiusano opened this issue 2 years ago • 2 comments

We want to make sure a whole bunch of values round trip successfully, and also test the situation where the "sender" code cache is in a different state than the "receiver" code cache.

Suggestion: have some golden files of serialized stuff, which is checked in, make sure we can deserialize them.

Suggestion: have the golden file be generated from a Unison transcript that calls Value.serialize, that way we will notice if the serialization format ever accidentally changes.

pchiusano avatar Sep 01 '22 16:09 pchiusano

@ceedubs and @stew can provide some color on this.

Having this is going to give us more confidence when merging stuff like #3377

pchiusano avatar Sep 01 '22 16:09 pchiusano

Ideas we discussed:

  • Have a transcript that serializes as many cases we can think of, and writes results to file(s). These files are checked into version control so that we know if they ever change.
  • Also do the same but with hash builtin, so we know if hashing code ever changes
  • The serialized file should round trip - when you read the values back in, they test Universal.== to the originals
  • The serialized file should round trip even if the runtime code cache is permuted
    • How do we test this?
      • debug.permute-code-cache command, just use this within the transcript. Involves some munging of runtime state.
      • Value.(de)serializeSelfContained which serializes a value and all its Code dependencies (transitive). Just do this for a bunch of values, store them in git. Then have a io.test that picks a random permutation of those files and deserializes them all and has the same the hash.
      • Transcript can produce this file, so it's easy to add more test cases over time.

pchiusano avatar Sep 01 '22 18:09 pchiusano