Nilo

Journal6

One command

A compiler is an easy thing to break without noticing. A change made for one new feature can alter what every other piece turns into, and the art may still look right.

I do not read the compiler. A model writes it. So I cannot rely on reading a change to know it is safe. What I can rely on is checks that fail loudly, and until now those were scattered: two scripts run by hand, and a comparison somebody had to remember to do.

Now there is one command, and it runs three things.

The language checks

470 small pieces, each one compiled and run. Some must produce an exact result. Others must be refused, with an exact message on the right line. That second kind matters as much as the first: a language is partly made of what it will not let me write.

The sketchbook checks

29 checks that drive the live page in a real browser: a save redraws the piece, an error shows over it, the sliders move, a capture lands in the right folder.

The byte comparison

This is the new one. Every piece is built twelve ways: both targets, both modes, and so on. The size and a fingerprint of each result are kept in a list. There are 180 builds in it.

After any change to the compiler, the same builds are made again and compared. If one byte of one file is different, it says which. A change that is meant to alter the output has to say so, by updating the list on purpose.

A refusal is kept in the list too, as its message. So if an error message changes, that shows as well.

Its first use

The list was made before curves, gradients and groups went in. That was a large change to the compiler. When it was finished, every one of the builds already in the list came out the same, byte for byte. Only the new piece was added.

That is what I wanted to be able to say, and to have checked instead of hoped.

What it does not cover

  • Nothing looks at the images, apart from one layer of one real piece that is compared stroke for stroke. A mark could be valid and still be drawn wrong.
  • There are no tests inside the compiler itself. Everything is checked from the outside, by what comes out. When something fails, that tells me what broke but not always where.
  • Nothing runs on its own. Somebody has to type the command.