Turns out nobody could trade. For months.
I built a bot that plays EchoQuest. Within a day it told me trading had been broken in production for months.
The bot is headless — no renderer, no browser. It logs in through the real auth flow, loads a character, opens a real socket and walks around using A* over the actual collision grid at pixel resolution. Then it runs scenarios: make a new player and get through the opening, stay logged in for a long session, walk every exit on every map, trade with another character.
The trade scenario failed straight away.
A placeholder I never bound
executeTrade locks both sides’ rows before it moves anything. I’d written the second lock as a SELECT ... FOR UPDATE referencing placeholder $2, and the query only ever bound one parameter.
Postgres does the right thing with that: it rejects the statement and the transaction rolls back. Which means every trade confirmation on production had been failing. Nothing got corrupted, to be fair — the rollback did its job and items stayed where they were. But nobody could complete a trade.
It survived because of where I develop. My local setup runs SQLite, and SQLite renumbers positional placeholders instead of complaining about the mismatch. On my machine the same code worked perfectly, every time.
And the tests passed, because they checked the call didn’t throw. It didn’t throw. It returned a rolled-back transaction, which looks completely normal if nobody asks whether the items moved.
So two problems stacked up: a dev database hiding a bug the production one catches, and tests checking for the absence of a crash instead of the presence of a result. The bot caught it because it didn’t know what it was looking for. It tried to trade and then looked in its inventory. There’s a test now that every statement in that transaction binds exactly the placeholders it names.
Fifteen minutes and you’re out
The long-session scenario found the second one. Play for fifteen minutes and the server disconnects you, with no reconnect.
The client was doing everything right. It refreshed its token well before expiry and had a fresh one ready. The server re-validated the socket every five minutes — against the original token it got at connect time. It never looked at the refreshed one, so the session was always going to die on the original token’s clock no matter how well the client behaved.
Nobody reported this. A fifteen-minute session that ends without an error message doesn’t look like a bug to the person it happens to. It looks like the game being flaky, and then it looks like doing something else with your evening.
Paying down the two-database debt
The trade bug was a symptom of something bigger. Production runs Postgres, the Steam and offline builds run SQLite, and the two had been drifting apart for months while I wasn’t paying attention.
So I regenerated the SQLite schema from a clean Postgres dump, replaying 170 migrations into one honest starting point, and re-exported the content seeds across 62 tables. Thirty of those had never been exported before, which is a polite way of saying thirty tables of game content existed on the server and simply weren’t in the offline build.
I also rewrote the SQLite migration runner for old saves to be foreign-key safe. It had been broken four ways at once for aged saves: a migration deleting rows other tables referenced, one depending on a table only the dump creates, syntax SQLite won’t accept, and installs stamped as current that had never received dump-only columns. All four are parity drift — two schemas maintained by hand, diverging a bit at a time, with nothing checking.
v0.39.0 went live mid-month with all of it in.
Maps that tell you what you’re about to break
The last day of the month was a long one. Map components — spawn zones, hazards, interactables, exits — live in a declarative registry now. Renaming a map cascades to everything attached to it, and deleting one reports what it’s about to take down with it and makes you confirm. There’s a health report endpoint that walks a map and lists what’s wrong with it, and hazards and interactables render, drag and edit in the tile editor instead of being database rows I edited by hand.
That last one fixes a failure mode I know well: content that exists in the database, doesn’t exist in the editor, and so stops existing in my head.
Five days
62 commits in September across five calendar days — the 1st, 2nd, 7th, 15th and 30th — and 21 of them on the 30th alone.
That’s not a good way to work and I won’t pretend otherwise. A marathon day puts a lot of unreviewed code into the repo in one sitting, and the review that catches the problems happens days later when I’ve forgotten why I did it that way. The bot helps with exactly that, which is probably why it got built in a month that looked like this.
— Bruno