Nobody has started this yet — be first.
Business impact
This project's reconciliation tooling exists specifically so that "does the materialized inventory match the ledger?" is something you can trust, not something you have to re-derive by hand during an incident. If Reconcile cries wolf on perfectly healthy SKUs -- reporting drift where there is none -- the team will do exactly what everyone does with noisy alerts: start ignoring them. The one time Reconcile reports a real drift, on-call may not take it seriously, because "oh, that report is always a little off."
Problem
Reconcile reports in_sync: false for a SKU that has only ever been restocked, reserved, and had a reservation manually released -- a perfectly healthy sequence with no bugs involved. The available figure it computes from the ledger is lower than the real, correct value by exactly however many units have ever been released.
Current behavior
Reconcile's Available formula is restock - reserve + expire, missing the + release term entirely, so every released unit is permanently uncounted in the "correct" figure it compares against.
Expected behavior
A SKU whose materialized sku_inventory row genuinely matches its ledger history should report in_sync: true, regardless of whether that history includes releases.
Steps to reproduce
go test ./tickets/tests/... -run TestTicket09 -vWhy this matters
Reconcile recomputes available from the ledger as restock - reserve + release + expire -- a release, like an expiry, gives its units back to available. The + release term is missing, so every released unit is permanently uncounted in the "correct" figure Reconcile compares against, even though the materialized row (which a release does update correctly) is fine.
Suggested approach
Look at the comment on LedgerReason in pkg/inventory/inventory.go, which documents the reason to account mapping every ledger row follows (release -> reserved -= delta, available += delta), and compare it against the Available formula inside Reconcile.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket09 -v
Hints (0/2)
Try it without hints first — the reading is the exercise.
Working on this ticket
Work on a branch named for the ticket — that's what you'll submit.
Branch off your fork
Sign in to create it automatically, or do it yourself:
$git checkout -b fix/reconcile-drops-release-termFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin fix/reconcile-drops-release-termSubmit it below
Paste your fork URL and the branch name, with a short write-up of the root cause.
Questions
Ask about anything unclear in the ticket — the maintainer and anyone who has solved it can answer. Please don't post full solutions.
Sign in to ask a question or reply.
Sign inSKIP LOCKEDhttp://localhost:8081localhost:5434flash-saleeveryday-widgetcurl localhost:8081/healthzgo run ./cmd/loadtest -url http://localhost:8081 -sku flash-sale -concurrency 10000Work the tickets in tickets/docs/ (ordered easy → hard); each names one dedicated Go test in tickets/tests/:
export TEST_DATABASE_URL=postgresql://inventory:inventory@localhost:5432/inventory_test?sslmode=disable
go test ./tickets/tests/... -run TestTicket24 -v # a single ticket
./tickets/run_tickets.sh # all 25, clean pass/fail summary
Tickets that don't touch Postgres (02, 07, 17, 19) run fine without TEST_DATABASE_URL; the rest t.Skip cleanly, not fail, if it's unset.
Level 1
Fix a bug
Read existing behaviour, correct it.