Nobody has started this yet — be first.
Business impact
Any client showing a countdown ("your hold expires in 4:58") or checking whether a reservation is about to lapse computes expires_at - created_at (or just compares expires_at to "now") and gets a negative number or an already-past timestamp for a reservation that was just created and is nowhere close to expiring. A checkout page built on this API would show "this item's hold expired 4 minutes ago" the instant a customer adds it to their cart.
Problem
Every reservation the API returns (from POST /v1/skus/{id}/reservations, GET /v1/reservations/{id}, commit, and release) reports expires_at that is before created_at.
Current behavior
toReservationResponse assigns ExpiresAt: r.CreatedAt and CreatedAt: r.ExpiresAt -- the two fields are swapped in the struct literal.
Expected behavior
expires_at must always be after created_at for a freshly created reservation (that's the entire point of a time-to-live hold).
Steps to reproduce
go test ./tickets/tests/... -run TestTicket05 -vWhy this matters
toReservationResponse builds the JSON response struct by copying fields off the domain Reservation value. Two of those field assignments got swapped -- a classic copy-paste/reordering mistake when a struct literal has many same-typed fields sitting next to each other.
Suggested approach
Compare toReservationResponse in internal/handler/dto.go field by field against the reservationResponse struct's own field names right above it. ExpiresAt should come from the domain value's ExpiresAt.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket05 -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/reservation-response-timestamp-swapFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin fix/reservation-response-timestamp-swapSubmit 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.