Nobody has started this yet — be first.
Business impact
The README's entire quickstart -- docker compose up --build, then run the load test against the flash-sale SKU -- depends on this seeding step actually creating that SKU. With this bug, a brand new deployment starts up successfully (no errors, no crash) but the demo SKUs simply do not exist: the load-test tool's default target immediately 404s, and anyone following the README's own instructions hits a wall on their very first command with no indication of why.
Problem
seed.Run completes without error on a fresh database, but neither the flash-sale nor everyday-widget SKU actually gets created.
Current behavior
Run's "already seeded?" check skips seeding whenever GetSKU returns an error -- but GetSKU returns ErrSKUNotFound precisely when the SKU does not exist yet, which is exactly the case that should trigger seeding.
Expected behavior
On a fresh database, seed.Run creates both demo SKUs with their documented stock levels. On an already-seeded database (e.g. a second replica starting up, or a restart), it is a safe no-op -- it must not double-restock a SKU that already exists.
Steps to reproduce
go test ./tickets/tests/... -run TestTicket11 -vWhy this matters
Run's "already seeded?" check is inverted: it skips seeding whenever GetSKU returns an error -- but GetSKU returns ErrSKUNotFound precisely when the SKU does not exist yet, which is exactly the case that should trigger seeding, not skip it. On a fresh database, every demo SKU look-up returns that not-found error, so every seed attempt is skipped.
Suggested approach
Read the comment right next to the continue in seed.Run's loop -- it says "already seeded" -- and check whether the condition above it actually means "already seeded" or the opposite.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket11 -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/seed-inverted-conditionFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin fix/seed-inverted-conditionSubmit 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.