=== Race Condition Tests for Waiter API === Test 1: Table Availability Race Condition (TOCTOU) Testing concurrent order creation for same table... Using table ID: 61 ✗ FAIL: Expected 1 success, 1 failure. Got 2 success, 0 failures Test 2: Concurrent Item Addition to Same Order Testing concurrent item addition... Created order ID: 8040 ✓ PASS: Order has correct item count (1) ✓ PASS: Order subtotal is correct (1.5) Test 3: Concurrent KOT Creation Testing concurrent KOT creation for same order... Created order ID: 8041 in 'kot' status Total KOTs: 1 ✓ PASS: KOT count is reasonable (race condition prevented) Test 4: Concurrent Status Updates Testing concurrent status updates... Created order ID: 8042 Final status: ready ✓ PASS: Order status is correct (race condition prevented) Test 5: Concurrent Order Count Check Testing concurrent order creation with limit... Note: This test requires max_concurrent_orders to be set in settings ✓ PASS: Lock acquisition is implemented (manual verification needed) Test 6: Total Calculation Accuracy Under Concurrency Testing order total accuracy with concurrent modifications... Initial total: 3.0000 ✓ PASS: Subtotal matches calculated total (3) === Race Condition Tests Complete === Note: Some tests may require specific conditions (tables, menu items, settings) Review results above and verify all critical operations are protected.