Nobody has started this yet — be first.
Business impact
Callers who want to know "is this reservation still holding stock?" have to compare r.Status == inventory.ReservationActive themselves; callers who want "does this SKU have anything left to sell?" have to compare sku.Available > 0 themselves. Both are one-line checks, but they are duplicated at every call site instead of being named, self-documenting methods on the domain types themselves -- every future caller (HTTP handlers, the load-test tool, a future admin CLI) will otherwise reimplement them slightly differently each time.
Problem
There is currently no Reservation.IsActive() or SKU.IsInStock() method; the panicking stub TODO(ticket-07) is called by tests wherever either is needed.
Current behavior
Calling Reservation.IsActive() or SKU.IsInStock() currently panics with "TODO(ticket-07): ... not implemented" instead of returning a boolean.
Expected behavior
Two small convenience methods: Reservation.IsActive() bool -- true only when Status == ReservationActive; SKU.IsInStock() bool -- true only when Available > 0.
Steps to reproduce
go test ./tickets/tests/... -run TestTicket07 -vWhy this matters
This is a small ergonomic gap in the domain types (pkg/inventory) that every future caller -- HTTP handlers, the load-test tool, a future admin CLI -- will otherwise reimplement slightly differently each time. Centralizing the definition here means "active" and "in stock" mean exactly one thing across the whole codebase.
Suggested approach
Both are one-line comparisons against fields already on the struct -- no database access, no new imports. Look at how ReservationStatus and its ReservationActive constant are already defined right above Reservation in this same file.
Acceptance criteria
Verification
go test ./tickets/tests/... -run TestTicket07 -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/isactive-isinstockFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin feat/isactive-isinstockSubmit 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.