Doki Doki · 2026 – now · primary developer
Sigma
The manufacturing and supply-chain console a food factory runs on every day.
Doki Doki · 2026 – now · primary developer
The manufacturing and supply-chain console a food factory runs on every day.
The manufacturing and supply-chain console a food factory runs on. I am the primary developer, so most of what can go wrong here went wrong for me first.
Stock lived in two places: an available total, and a quantity on each RFID card attached to a bag. Production debited only the first. Free stock could go negative, and items became impossible to tag.
Firestore makes this harder than it sounds: there are many writers, and a transaction must do all its reads before any write. So every change now goes through one central writer. It refuses negative stock and writes ledger rows with derived ids, which turns a retried request into a no-op. Kiosk issues use a client-generated UUID for the same reason. The invariant is simple to say and test: the total on cards can never exceed what is available.
Two batches could book the same stock, and nobody found out until someone stood at the scale with not enough material. Stock only falls at production and only enters once pre-processing is ticked done, so a correct refusal could still block material that is physically in the room.
Reservations are now calculated from open batches at the production date, and expiry-first allocation drains the oldest lots, counting a lot only if it is unexpired on that date. A guard checks this when a batch is created or edited. Because the physical world can be right when the system is wrong, an override exists: it recomputes the shortfall on the server and records who overrode what.
There was no record of where a batch was, who handled it, or what each room lost. Tablets on the floor have weak Wi-Fi, and the USB RFID readers present themselves as keyboards. So the scanner captures keystrokes globally, ignores focused inputs, buffers until Enter, and validates the result. Out-of-order and double scans are blocked inside a transaction.
When the network drops, the kiosk stays readable from a local cache, but writes stop. An offline write queue was deferred on purpose. My favourite bug lives here: my spec drove the offline banner from the cache flag, and non-leader tabs report that flag as true forever, so perfectly healthy tablets said they were offline. The banner now follows connectivity only.
Goods entered stock unchecked, and the checks differ by item and vendor. I built admin-defined parameters, a two-stage sampling ladder, CIEDE2000 colour difference, and a gate where only the accepted quantity reaches stock.
Then the colour rule broke. A single difference threshold cannot reproduce a procedure with box-shaped tolerances, because the two orderings invert: a sample that passes one can fail the other. Per-axis bands and a HOLD outcome fix that. That work is finished on a branch and not merged yet.
A Firebase client config is public, so any signed-in user could try to skip the server. All client writes are denied, and reads need an allow-listed path plus a server-set role claim. Emulator tests cover this, including a token with no claim. Staff writes are default-deny in middleware, and a sweep test checks the allow-list against the real route files, so a route added later stays closed until someone lists it. The cost is a list to maintain.