Nobody has started this yet — be first.
Business impact
/readyz only ever reports database_ok. If the outbox dispatcher falls behind (say, the bank simulator/rail is slow or the dispatcher goroutine died silently), there's no signal in readiness -- only in the Prometheus paystate_outbox_depth gauge, which most orchestrators don't scrape as a readiness probe.
Problem
Server.SetDispatcher and the readyz wiring to call Dispatcher.PendingCount already exist (see cmd/paystate/main.go's apiServer.SetDispatcher(dispatcher) call) -- only PendingCount itself is an unimplemented, panicking stub, which means /readyz currently always returns 500 once a dispatcher is wired in (as it now is, in both cmd/paystate/main.go and the ticket test harness).
Current behavior
GET /readyz returns 500 with a panic logged: Dispatcher.PendingCount not implemented.
Expected behavior
GET /readyz should return 200 with a JSON body including pending_outbox_rows (rows currently pending or processing), alongside the existing database_ok.
Steps to reproduce
go run ./cmd/paystate curl -s localhost:8080/readyz
Why this matters
This is the same shape as RefreshDepthMetrics's SQL in the same file (count rows in ('pending', 'processing')) -- you're implementing the same query, just returning a single int64 instead of setting a Prometheus gauge.
Suggested approach
Look at RefreshDepthMetrics right below PendingCount in internal/outbox/dispatcher.go for the query shape (SELECT count(*) FROM outbox WHERE status IN ('pending', 'processing')) you need, condensed to a single-value QueryRow.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket18 -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/outbox-pending-count-readyzFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin feat/outbox-pending-count-readyzSubmit 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 indocker composepaystate/paystate/go.modreplace reliable => ../reliabledocker compose up --buildpaystate/context: ..docker-compose.ymlCREATED_TIMEOUTAUTHORIZED_TIMEOUTWork the tickets in tickets/docs/ (ticket-01 through ticket-25); each names one Go test in tickets/tests/:
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket01 -v # a single ticket
TEST_DATABASE_URL=postgresql://... ./tickets/run_tickets.sh # all 25, clean pass/fail summary
Tickets that don't touch Postgres (02, 03, 04, 05, 06, 14, 15, 24) run fine without TEST_DATABASE_URL set; the rest report FAIL with a "TEST_DATABASE_URL not set" message if it's missing. make test-race runs the full go test -race -p 1 ./... suite the same way.
Level 2
Implement a feature
Extend the system within its own patterns.