Nobody has started this yet — be first.
Business impact
There is no way to discover a SKU's reservations short of already knowing each individual reservation id. Support staff investigating "what's holding this SKU's stock right now" (or "what happened to this customer's order") have no endpoint to call.
Problem
The route is already wired up and Server.ListReservationsForSKU exists only as a panicking TODO(ticket-20) stub.
Current behavior
GET /v1/skus/{id}/reservations currently returns a 500 because Server.ListReservationsForSKU panics with "TODO(ticket-20): Server.ListReservationsForSKU not implemented".
Expected behavior
GET /v1/skus/{id}/reservations?status= lists reservations against a SKU, optionally filtered by status (active, committed, expired, released); an empty/omitted status returns all of them.
Steps to reproduce
go test ./tickets/tests/... -run TestTicket20 -vWhy this matters
The route is already wired up and Server.ListReservationsForSKU exists as a stub -- this is a straightforward query against the reservations table filtered by sku_id and, optionally, status -- the same query-param-handling shape ListLedger right above it already demonstrates for after/limit.
Suggested approach
Look at ListLedger in the same file for the pattern of reading an optional query param and building the WHERE clause conditionally, and GetReservation in internal/handler/reservation_handler.go for the row-to-JSON shape a single reservation already uses.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket20 -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-reservations-endpointFix 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-reservations-endpointSubmit 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 2
Implement a feature
Extend the system within its own patterns.