Field Manual - SystemsVol. 01§V · SystemsImplementation notes

How these systems work.

Four diagrams from projects I’ve built. They cover missed sync records, uncertain payouts, multiplayer scoring, and database deadlocks.

Each diagram highlights an invariant: a condition the implementation needs to preserve.

erp-sync --keyset-drain

§V · FIG.01
FIG. 01

Syncing every ERP record

The ERP records changes with timestamps rounded to the minute. Advancing the cursor after a full 1,000-row page could skip other records from that same minute.

Never advance the watermark unless accepted + rejected == rows_sent. Every sent row must be accounted for.

payouts --exactly-once

§V · FIG.02
FIG. 02

Handling uncertain payouts

A payout request can time out after money has moved. The response alone doesn’t tell us whether it is safe to try again.

Release funds only on a provable failure. Keep an uncertain transfer pending until its status is confirmed.

realtime --server-authoritative

§V · FIG.03
FIG. 03

Multiplayer scoring6 → 100+ players

The server checks answers and assigns scores. During a live question, clients receive neither the answer key nor permission to set their own score.

The server calculates scores and withholds the answer key during live questions. Six-player rooms can broadcast updates to more than 100 subscribers.

locks --one-global-order

§V · FIG.04
FIG. 04

Consistent lock orderingLogistics · Postgres

Two payment operations can deadlock when they lock the same rows in opposite orders. Postgres aborts one transaction with 40P01.

A single global lock ordering across every money path, so the cycle that caused 40P01 cannot form.

For the business context and the rest of each project, see the case studies.