feat(seats): limited seats with race-proof holds (#91) #94
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!94
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/91-limited-seats"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #91. Limited-seat products can never oversell: the database enforces the cap (counters change only via an append-only ledger trigger), same approach as the wallet ledger (ADR 0009).
What's in it
internal/seats(+pgstore): Hold, Take, Confirm, Release, Return; idempotent keys, one 3 s lock budget, ascending lock order, lazy expiry of expired holdsseat_hold_minutes(10),seat_pending_alert_minutes(30)GET /v1/seats/availability; admin seat pools, flag, capacity rules,GET /v1/admin/seats/stuck-holds; OpenAPI + live contract test updatedVerification
make cover: 94.3% total (minimum 80%); seats 100%, seats/pgstore 91.6%go test ./... -race,make lint,make contract: cleanNeeds owner attention
ErrBusyto 503, READ COMMITTED only.ErrBusywhen under 1 ms of lock budget remains; merged-quantity int overflow on absurd internal inputs.🤖 Generated with Claude Code
Seat pool CRUD and PUT /v1/admin/park-products/{id}/seat-pool under admin_portal.administration.manage. Leaving a pool locks it FOR UPDATE and is refused while it has rules ending today or later or held seats; a hold on a pool with no limited park product is ErrNotOnSale, so a hold and an unflag never both succeed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>Capacity rule CRUD under /v1/admin/seat-pools/{id}/capacity-rules and /v1/admin/seat-capacity-rules/{id}, and GET /v1/admin/seats/stuck-holds (threshold from seat_pending_alert_minutes, 30 by default, or ?older_than_minutes=), all under admin_portal.administration.manage. Overlap, removing a held or sold day, and lowering below held + sold are 409; bad dates, spans over 366 days and capacities outside 1..1,000,000 are 422. Docs: R-SEAT-1, CLAUDE.md Seats section, ADR 0009 capacity rules section, spec Flag rule as built. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>