Skip to main content
← All Posts

You can build a house now, and I broke every Steam login

You can build a house in EchoQuest now. That took most of August.

Claim a plot and place walls, and they autotile themselves into corners and junctions. Close a loop and the game notices — a flood fill runs over your placements, works out you’ve made a room, classifies it, and starts feeding you a comfort buff called Homely. There are beds you can rotate and recolour and sleep in to set your respawn, chests that actually hold things, and crafting stations. Claims chain outward as you expand, and a trail links the first homestead back to Millhaven so it’s somewhere rather than nowhere.

The resource loop closed around it. Harvesting is per-click and gated on tools, so a stone node will refuse your fists. You can plant saplings, and what you plant grows through sprite stages instead of appearing fully formed. Trees sway. The player and the mobs sort by depth, so you walk behind a tree instead of through it. And the hotbar floats at the bottom of the screen the way it should have from the start.

296 commits. Biggest month this project has had. 4,084 tests across 150 files by the end of it.

Every Steam login was expired before it existed

Here’s the one that cost me a day.

Sessions in the single-player and Steam builds kept dying. No error, nothing logged, nothing thrown. You’d log in and then be logged out, and the only clue was that it never happened on the web build.

Those builds use SQLite and the web build uses Postgres. Our SQLite parameter binder had a generic fallback for objects, and a JavaScript Date is an object, so it went down that path and got JSON.stringify’d. What ended up in the column wasn’t a timestamp. It was the timestamp with a literal double-quote as its first character.

Then SQLite compared it as text, and in text collation a quote sorts below every digit. So expires_at > datetime(now) came out false — not after an hour, but from the moment the row was written. Every token in those builds was expired before it existed, and the check doing the expiring was working exactly as designed.

The fix is four lines: handle Date before the generic branch. Postgres was never affected because its driver knows what a Date is and never had to guess.

What stuck with me is that nothing here was broken. The binder serialised an object, the comparison compared strings, the session expired. Every piece did its job and the result was a build you couldn’t stay logged into.

The Stats tab had been working the whole time

Smaller, and funnier. The Stats tab in the character panel showed nothing, and I’d assumed for weeks that I hadn’t built the content yet.

I had. It had been rendering into the DOM all along. Every other tab panel had a CSS rule giving it a display value when active and Stats never got one, so the base display: none won unopposed. The data was there, laid out, correct, and invisible.

It’s got primary stats and point allocation on it now, which is what I thought I was building that day.

Monsters out of data instead of art

Enemy appearances are data now. A humanoid enemy is a set of layers composited at runtime — body, gear, weapon, aura — instead of a hand-drawn spritesheet per monster, which means a new armed enemy is a row in a table rather than a commission. Armed humanoids got weapon swing overlays, equipped swords show up in the player’s attack swings, and I replaced 33 placeholder assets with real art.

WorldScene also stopped being one enormous class. It split into CombatDispatcher, NpcController, DungeonController, FogOfWarSystem, HarvestController and AbilityVFX, and the admin front end broke into about ten controllers.

What the pentest found

A gray-box pass turned up four things worth naming. A rate limiter that did nothing at all — the store API changed in express-rate-limit v7, my config was still v6-shaped, and the result accepted the configuration and limited nothing. A race in promo-key redemption where two requests arriving together could both win. Upload MIME sniffing you could lie to. Webhook replay with no dedup.

All fixed. The rate limiter is the one that bothers me, because it’s the same thing as the expired-token bug: a component that reports success while doing nothing.

What’s still wrong

Steam saves created before the date fix still have mangled timestamp columns in them. The code doesn’t write bad rows anymore, but it doesn’t clean up the old ones either, and I didn’t get to that repair pass in August.

The webhook dedup fix shipped without tests, which I noticed a week later and backfilled. And the refactor needed a string of same-day follow-ups for dead stubs, orphaned imports and tests pointing at modules that had moved. Pulling six systems out of one class in a day doesn’t give you six clean systems. It gives you six systems and a list.

— Bruno