weeknotes: yaml-checking

2025-11-16

SchemaGen

I picked up bird.rs after a few weeks. I tend to tidy up code while trying to remember what it does, so I ended up doing a big refactoring of the bird’s config. The data fell into place in satisfying ways. I can now trace my way around the bird’s silhouette through its parameters.

All of this is a very nice improvement, but the changes led to a painful step of going back through the definitions for the robin, goldfinch, and swift to make sure they aren’t drifting dramatically. Normally, I would run the program and see what fails, but that route just shows one failure at a time, and this update affected most of the existing fields.

This time, I used something I set up a few months ago: automatically-generated JSON schemas! When a sketch runs, it automatically generates a schema for the configuration. Then a VSCode extension uses that schema to highlight the YAML fields that are missing keys or don’t exist. I don’t need to run the Rust program, or even reference the program code, because red squiggles tell me the name of what is missing.

syntax highlighting missing keys, incorrect types, etc

I had a few silly issues to fix with my previous integration of schemars. I had written it so it couldn’t generate a valid config until… the program had a valid config. That was a quick fix. I also wanted to have it complain about extra fields, but I sometimes use fake keys for YAML references like “bird body color” that are reused throughout the config sketch. With some chatbot help, I updated the schema to ignore keys that start with _. This is all working great!

I occasionally get tempted to write my own domain-specific language or stop using YAML. I do tell myself I am also trolling noyaml folks, and my years of Python development made me overly-diligent about indentation.

Senescence blog post

I wrote up a blog post about the senescence project! I wrote some special systems for generating visualizations for the blog post.

Boston Museum of Fine Art

There was a cool exhibit of Rachel Ruysch, a Dutch artist from the 17th and 18th centuries. What I particularly enjoyed was that they pulled specimens, like butterfly and beetle boxes, from the natural history museum, and showed them alongside Ruysch’s paintings of the same creatures.