Nobody has started this yet — be first.
Business impact
This is the checkout endpoint -- the one that turns a hold into a sale. With this bug, it fails 100% of the time, for every reservation, no matter how valid the id. Every payment success would be followed by a failed commit call, always reported as "reservation not found" -- a misleading error that would send whoever's debugging it looking in completely the wrong place instead of the real, one-line routing bug.
Problem
POST /v1/reservations/{id}/commit returns 404 Not Found for every reservation id, including ones that were just created and definitely exist.
Current behavior
CommitReservation reads chi.URLParam(r, "reservation_id"), a name that was never registered anywhere -- the route binds that path segment to id, so chi.URLParam returns an empty string and Commit("") is called every time.
Expected behavior
Committing a valid, active reservation id should succeed (200 OK).
Steps to reproduce
go test ./tickets/tests/... -run TestTicket16 -vWhy this matters
The route is registered as POST /v1/reservations/{id}/commit -- chi binds that path segment to the URL parameter named id. CommitReservation reads chi.URLParam(r, "reservation_id"), a name that was never registered anywhere. chi.URLParam returns an empty string for an unbound name, so Commit("") is called every single time -- which can never find a real reservation.
Suggested approach
Compare CommitReservation's chi.URLParam call against GetReservation and ReleaseReservation right next to it in the same file -- they read the same route parameter correctly.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket16 -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/commit-wrong-url-paramFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin fix/commit-wrong-url-paramSubmit 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.