From 04b3469a216c2f4c6f7473dcdbc0f274106cbf41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 5 Aug 2026 03:23:45 +0300 Subject: [PATCH] =?UTF-8?q?test:=20=F0=9F=93=85=20prove=20a=20settled=20bo?= =?UTF-8?q?oking=20goes=20with=20its=20slot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `delete_free` cascades `DELETE appointment WHERE slot IN $slots` inside the slot delete's own transaction, but both existing tests stopped at the 204 — the cascade itself was never asserted. A booking left pointing at a deleted slot is a dangling link every read of it has to survive. The count is read from the database rather than off the response: a 204 was never proof the second statement ran. It passes, so the cascade holds today; this is the forcing function that keeps it holding. --- tests/integration.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index 6e475e9..43abdce 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -17472,6 +17472,16 @@ async fn slot_delete_waits_for_the_booking_to_settle() { ); let res = send(&app, "DELETE", &uri, Some(&ali), None).await; assert_eq!(res.status, StatusCode::NO_CONTENT, "{}", res.body); + // The settled booking goes with the slot, in the same transaction — it is + // history of a meeting that no longer exists, and a row left pointing at a + // deleted slot is a dangling link every read of it has to survive. The + // `204` alone never proved the cascade ran, so the count is read from the + // database (`pay_row_count` is this file's plain table count). + assert_eq!( + pay_row_count(&db, "appointment").await, + 0, + "the cancelled booking {booking} outlived its slot" + ); assert_eq!( send(&app, "DELETE", &uri, Some(&ali), None).await.status, StatusCode::NOT_FOUND