Nobody has started this yet — be first.
Business impact
Service can fetch a single reservation by id (GetReservation), but there is no way to ask "what is currently holding stock against this SKU?" without already knowing every individual reservation id. Support staff investigating "why is available lower than I expect" have no query to run short of hitting Postgres directly.
Problem
Service.ListActiveReservations exists only as a panicking TODO(ticket-08) stub; there is no way to list reservations currently in active status against a SKU.
Current behavior
Calling Service.ListActiveReservations currently panics with "TODO(ticket-08): Service.ListActiveReservations not implemented".
Expected behavior
Service.ListActiveReservations(ctx, skuID) ([]Reservation, error) returns every reservation currently in active status against skuID, ordered by creation time -- excluding anything committed, released, or expired.
Steps to reproduce
go test ./tickets/tests/... -run TestTicket08 -vWhy this matters
This is a straightforward read query, but it is a genuinely missing capability: reservations already has an index on sku_id (reservations_sku_id_idx), so filtering by sku_id and status = 'active' is cheap. The interesting part is getting the query and the column list right, and returning proper values (including nullable ) the same way already does.
Suggested approach
Look at getReservation's query and scanning logic right above this method's stub in pkg/inventory/service.go -- this is the same pattern, just filtered by sku_id and status and returning a slice instead of a single row. ListLedger (further down in the same file) shows the rows.Next() / scan-in-a-loop pattern for returning a slice.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket08 -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 feat/list-active-reservationsFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin feat/list-active-reservationsSubmit 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 inReservationorder_referencegetReservationSKIP 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 2
Implement a feature
Extend the system within its own patterns.