Writing

Notes on backend engineering, distributed systems, databases and AI.

18
Nov
A rusted metal wrench resting on a weathered and textured stone block

Ratchets: Build Limits That Only Tighten

Floors catch a collapse, not a slow slide. Ratchets for bundle size, coverage and docs, the tree-shaking bug one caught, and the escape hatch they need.
6 min read
16
Nov
black metal ladder leaning on white wall

Testing a Reconnect Ladder: Assert the Climb, Not the End State

A client that gives up at once and one that retries forever both pass an end-state reconnect test. Here's how to test the retries themselves, and why the test went red on a Mac.
6 min read
11
Nov
Row of metal lockers with padlocks on doors

SKIP LOCKED: Claim the Next Job in One Statement, Then Test It on Real Postgres

Claiming queue work with one FOR UPDATE SKIP LOCKED statement, and why that forces your tests onto a real Postgres with cloned template databases.
6 min read
09
Nov
Old telephone switchboard with many wires

Postgres as Your socket.io Scale-Out Bus, and Why It Needs Its Own Pool

Fan out realtime events across server instances with Postgres LISTEN/NOTIFY instead of Redis, without letting the adapter break your pool sizing, your tests, or your large broadcasts.
7 min read
04
Nov
selective focus photo of brown and blue hourglass on stones

Dependencies That Hang Are Worse Than Dependencies That Fail

A queue that silently hung on a misconfigured Redis connection, a dashboard one dead host could freeze, and the fix for both: deadlines, serve-first startup and visible health.
6 min read
02
Nov
A glowing fingerprint on a dark circular scanner surface with concentric lines

Don't Let the LLM Name Your Entities

An LLM called one credit card three different names and my app created three accounts. Use model output for meaning, never for identity: key records on facts the model copies, not labels it writes.
6 min read
28
Oct
magnifying glass on white table

Design the Image the Model Sees, Not Just the Prompt

Vision models shrink what you send them. For an AI photo-culling tool, the real work was building a composite image the model can actually judge.
7 min read
26
Oct
a wall full of clocks

Offline Sync Without Lost Edits: Stale-Write Triggers and Partial Unique Indexes

Order conflicts by when the edit happened, let a Postgres trigger drop stale writes, keep balances in a ledger, and make 'only once' a partial unique index.
7 min read
21
Oct
a group of mannequins sitting next to each other

Green Tests, Broken LLM: Five Things the First Real Model Call Exposed

Mocks repeat your assumptions back to you. Five integration failures that only appeared on the first real LLM call, and the smoke test that catches them.
6 min read
19
Oct
a tower with a sunset in the background

Realtime Events Should Invalidate the Cache, Not Carry State

Let socket events say what changed and let the server say what it is now: one projection, no client drift, and a polling fallback that is the same code path.
6 min read