The Occasional Jam No. 13

No. 13 soapbox

Why I Can't Open-Source This Site

5 min read

Publishing the source code for this site would publish every puzzle it has not shipped yet.

Open source is the reason a site like this can exist at all: nearly every layer under it is somebody else's public work, given away. A small site run by one person ought to be readable end to end in return, and I would like to put a repository link at the bottom of every post about how the machinery works. Here is why I don't.

The code is the answer key

Puzzles here are made in advance, on my own computer, and uploaded finished. The tour covers the whole pipeline. One piece of it matters here: for some of the games, a day's puzzle is a pure function of its date. Give the generator a date and you get that day's puzzle. Give it the same date next year and you get the same puzzle.

Seeded by its date
LNGDWND
Drawn at random
ABZSNKM

Made once.

A toy, not one of the real generators. A seeded day comes out the same every time it is made, so anyone holding the code holds the day.
The source code contains the puzzles, the way a recipe contains a cake.

Whatever chance goes into a day is fixed by its date, and nothing is written down afterwards. There is no ledger of which puzzles have been used, because the date is the ledger. Publishing the code would hand over the three months of days I keep queued and every day after them.

There is no careful way to publish it either. Writing code so that it is deliberately hard to follow, on the theory that working it out becomes more trouble than it is worth. protects against a reader, and nobody spoiling this site would need to read the code, only run it.

A gate on the cupboard, not the recipe

The finished puzzles do have a real defense, and it is the one piece of security on this site I am strict about. They sit in a private bucket no browser can reach, and every request passes a small gate that checks the calendar first.

Ask for tomorrow and the gate says there is nothing there, because a refusal would confirm there was something to refuse.

Old days work the other way round, since they are meant to be known about. Past two weeks, playing one is a Supporter perk, so a locked day is refused out loud. The one account that can see into the future is mine, which is how I play a day before anybody else.

All of that guards the cupboard and none of it guards the recipe. Anyone who can make tomorrow's file has no reason to go looking for my copy.

Why I made the puzzles repeatable

I picked repeatable puzzles on purpose, because the alternative is a content pipeline I cannot audit or repair.

A day that regenerates identically is a day I can reproduce when it misbehaves.

The 4am job that tops the queue back up holds no memory of its own. It looks at what exists, works out what is missing, and makes only that, so a missed run heals itself the next night.

When I changed how one game picks its days, I could compute the replacement stretch, print exactly which queued days would change and what they would become, read the list, and only then let anything be written. The same tool leaves today and tomorrow alone, and it will not touch a day I have already played through, because my score is stored inside that day's file. None of that works if the puzzles cannot be made twice.

I know because the other choice is in the same repository. One game's generator is not seeded at all. Run it twice and you get two different days, and nothing about that game's future is in the source, because the source does not know it either.

For the builders: what an unseeded generator does instead

It draws at random, checks that the day it just made is solvable, and keeps it if so. The only record of what it will serve on a date is the file already in the bucket, which is safer and worse to run. I cannot regenerate one of those days. If a file were lost, the day would be gone, and whatever I put in its place would be a different puzzle.

That is the trade, and I don't think either side is obviously right. Repeatable puzzles cost me the ability to show anyone the generator. Puzzles that cannot be repeated cost me the ability to fix a bad day. Each game took whichever deal it needed when it was built.

What it would take to open the door

This is escapable, and I should be plain about that, because "I can't open source it" often means "I would rather not". Everything that makes a day predictable would have to move into private configuration, supplied when the puzzles are made, the way the site's other keys already are, and stop travelling in the repository beside the code that reads it.

For the builders: why this secret is not a credential

That leaves a repository you can read completely and cannot run against the real thing without my config, which is the ordinary shape of any open project with secrets. The unusual part is that this secret is not a credential. A leaked key is rotated in a minute. A leaked ordering is fixed only by building a new one and rewriting every queued day still safe to touch.

None of this is hard. It is a small, boring project I have not done because nothing is blocked on it, and I would rather spend the hours on the games. It becomes worth doing when somebody wants to read the code instead of being told about it.

So the explanations are public instead

This is most of why the blog exists. If I can't hand over the repository, I can write its parts down in the detail I would want if I found this site and got curious, including the awkward stuff. I know it is a worse substitute. Prose can be flattering or a year out of date, and you cannot run it to check. Everyone reading these posts is taking my word for things, and taking someone's word is the dependency open source exists to remove.