I think I found and fixed the bug.
I'm leaving this here as a kind of timestamp of when I had what I think it is:
$ shasum -a 512 fix.txt
0d9d7753257c96ab50565a4d542cf41bc37c2815a6a83ada04d03c2ba7469eca1edad18f46fd6c0 8b4c4f6b945517e369d84ce787162c5087106455729e3ce08 fix.txt
I'll publish the file once I've spoken with the devs.