Oversell-proof stock reservations under extreme concurrent contention: 100 units, 50,000 simultaneous "Buy Now" clicks, and exactly 100 must succeed.
Nobody has started this yet — be first.
No published tickets in this project yet.
About this project
A production-grade inventory and reservation service whose entire reason for existing is preventing overselling under extreme concurrent contention. An append-only ledger () is the source of truth, double-entry-bookkeeping style, with a Postgres trigger physically forbidding any / on it; a materialized row gives O(1) reads and carries a constraint so can never even be committed out of balance. The reservation hot path is a pluggable with two implementations — one atomic conditional and one read-then-compare-and-swap optimistic loop reusing the sibling project's jittered-backoff retry executor — selected via and benchmarked head to head against 50,000 concurrent requests. A reaper reclaims expired holds safely across multiple replicas, idempotent commit/release logic makes retried payment webhooks a non-event, and a reconciliation tool re-sums the entire ledger from scratch to catch drift a naive balance check would miss.
Clone it
$git clone https://github.com/nishant1821/GolangDevTraining.gitHow to run it locally, step by step.
stock_ledgerUPDATEDELETEsku_inventoryCHECKavailable + reserved + sold = totalClaimStrategyUPDATEreliableLOCK_STRATEGYSELECT ... FOR UPDATE SKIP LOCKEDSeventeen tickets are bugs deliberately injected into an otherwise-working codebase (an off-by-one on the exact-boundary claim, a sign flip that corrupts the optimistic strategy, a copy-pasted SQL branch that returns sold stock to available instead of marking it sold, two hard concurrency bugs from missing row-locking clauses); eight are enhancements that do not exist yet, each with a compile-only panicking stub so the codebase and the verification tests build before the real implementation is written. Every ticket has a dedicated Go test that goes green when the fix is correct — and several document exactly which of the project's own pre-existing tests they collaterally break in the meantime.