Add bookmyshow module: seat booking with hold expiry and payment timeout, naive vs pessimistic vs optimistic inventories, race and deadlock demos, JDBC strategies on H2 (8 test classes, 8 transcripts)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b5YFRisPHrLBR2dRu9
This commit is contained in:
asmhatre
2026-11-17 01:03:44 +05:30
co-authored by Claude Sonnet 5.5
parent deb924febd
commit c57031aaeb
42 changed files with 2322 additions and 0 deletions
@@ -0,0 +1,22 @@
Hold expiry and payment timeout on a fake clock (TTL 5 minutes, no sleeping)
============================================================================
1. Pay one second before the deadline
hold placed T+00:00, expires T+05:00, pay pressed T+04:59
outcome: CONFIRMED charges: 1 refunds: 0
2. The deadline passes while Asha is on the payment page (she holds B1 and B2)
T+04:59 B1 reads as HELD
T+05:00 B1 reads as AVAILABLE (stored slot still says HELD: expiry is lazy)
T+05:01 Ravi asks for B1: BK-0002 PENDING_PAYMENT
T+05:02 Asha presses Pay: HOLD_EXPIRED_BEFORE_PAYMENT charges: 0
B1: HELD by BK-0002 until T+10:01 v2
B2: AVAILABLE v2
3. Pay pressed at T+04:59, the gateway takes two minutes, nobody else wants the seat
outcome: HOLD_LOST_AFTER_PAYMENT charges: 1 refunds: [BK-0001] booking: REFUNDED
4. Same slow payment, but Ravi takes B4 while the gateway is still working on Asha's charge
outcome: HOLD_LOST_AFTER_PAYMENT charges: 1 refunds: [BK-0001] booking: REFUNDED
B4: HELD by BK-0002 until T+11:59 v2
5. The card is declined
outcome: PAYMENT_DECLINED booking: PAYMENT_FAILED B5 now: AVAILABLE
Same log produced by all three inventories: true