Limited-seat products: capacity rules, holds, race-proof reservations #91

Closed
opened 2026-10-23 15:35:26 +02:00 by amiryahaya · 0 comments
Owner

Must land BEFORE checkout (#26). Owner's answers (2026-10-23):

  • Flag: park_products.limited_seats boolean NOT NULL DEFAULT false. Only flagged park-products have capacity rules; unflagged ones skip the seat path entirely (no hold, no counter). Unflagging is refused while capacity rules or active holds exist.
  • Cap: counts people, per park + product; usually per day, but definable as a date range.
  • Channels: web, mobile, POS and travel-agent portal all consume seats.
  • Shoppers see "N left" / "sold out" (no waitlist). Lowering a cap below what is sold is refused.
  • Holds: default 10 minutes; released at once on failure/cancel; NOT released while a mobile-money payment is pending (reconcile first). POS/agent wallet sales confirm instantly, no hold.

Design (same guard rails as wallets, ADR 0007)

Single conditional UPDATE ... WHERE sold + n <= cap, CHECK, append-only reservations ledger with idempotency keys, hold -> confirm/release, multi-day all-or-nothing locking days in ascending order, drift view, raw-SQL hammer tests, hot-day benchmark (~1,000 buyers on one product-day), OpenAPI update, ADR 0008.

Depends on #24 (HTTP idempotency keys) for the retry story.

Must land BEFORE checkout (#26). Owner's answers (2026-10-23): - **Flag:** `park_products.limited_seats boolean NOT NULL DEFAULT false`. Only flagged park-products have capacity rules; unflagged ones skip the seat path entirely (no hold, no counter). Unflagging is refused while capacity rules or active holds exist. - **Cap:** counts people, per park + product; usually per day, but definable as a date range. - **Channels:** web, mobile, POS and travel-agent portal all consume seats. - **Shoppers see** "N left" / "sold out" (no waitlist). Lowering a cap below what is sold is refused. - **Holds:** default 10 minutes; released at once on failure/cancel; NOT released while a mobile-money payment is pending (reconcile first). POS/agent wallet sales confirm instantly, no hold. ## Design (same guard rails as wallets, ADR 0007) Single conditional `UPDATE ... WHERE sold + n <= cap`, CHECK, append-only reservations ledger with idempotency keys, hold -> confirm/release, multi-day all-or-nothing locking days in ascending order, drift view, raw-SQL hammer tests, hot-day benchmark (~1,000 buyers on one product-day), OpenAPI update, ADR 0008. Depends on #24 (HTTP idempotency keys) for the retry story.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/kws#91
No description provided.