Coding 2020-10-23
I seem to have gotten the type stubs I wrote working, so that's exciting. After I publish this, I'm going to try updating the tests to be properly type-compatible before I start tossing in runtime validation using the new fields I expect to have.
The basic idea there is to write visitors for different kinds of generic aliases, so I can confirm at import time that, if the data in a module instance conforms to its type annotations, the instance should be able to attempt something when serialized. There are a few things this idea doesn't test:
- Whether the type annotations are actually accurate.
- Whether the serializer functions provided by the libraries will succeed.
- Whether loaders exist for the serialized data (this wouldn't be hard to add, but I don't know if it'd be worth it)
- Whether the serializers and deserializers properly round-trip data (this would be the domain of property-based testing)
I think what I want to do is get the basic runtime infrastructure together for the basic serializer checks, then work on property-based tests. The idea there is to make sure that, if I use this code, it'll end up writing something to disk. The property-based testing is to develop confidence that what's written to disk is valid. As long as I don't totally cheap out on the serializers, then it's probably not a problem if something is wrong with a loader, since I can just debug the loader and then pick things back up.
Anyway, cutting things close on time, better wrap up.
Good night.