fix: remove redundant rollback, document asymmetry in cancellation notifications
CI / Go build (push) Successful in 1m42s
CI / Secrets scan (push) Successful in 1m56s
CI / Env docs check (push) Successful in 1m55s
CI / Frontend major deps (push) Successful in 2m6s
CI / Frontend deps check (push) Successful in 1m30s
CI / Nginx config check (push) Successful in 2m48s
CI / Docker compose check (push) Successful in 2m50s
CI / Frontend build (push) Successful in 3m7s
CI / Go vet (dev) (push) Successful in 1m14s
CI / go mod tidy (push) Successful in 33s
CI / Knip (push) Successful in 1m15s
CI / Go vulnerabilities (push) Successful in 1m46s
CI / Frontend QC (audit) (push) Successful in 46s
CI / Staticcheck (prod) (push) Successful in 3m36s
CI / Frontend a11y check (push) Successful in 2m17s
CI / Staticcheck (dev) (push) Successful in 3m51s
CI / golangci-lint (push) Failing after 4m8s
CI / Frontend QC (typecheck) (push) Successful in 1m25s
CI / Go vet (prod) (push) Has been cancelled
CI / Security scan (dev) (push) Has been cancelled
CI / Security scan (prod) (push) Has been cancelled
CI / Tests (prod) (push) Has been cancelled
CI / Tests (dev) (push) Has been cancelled
CI / Race (prod) (push) Has been cancelled
CI / Race (dev) (push) Has been cancelled
CI / Svelte strict check (push) Has been cancelled
CI / Frontend QC (lint) (push) Has been cancelled

This commit is contained in:
2026-07-11 17:45:24 +01:00
parent 0edc111bfe
commit 0bef0f7973
6 changed files with 16 additions and 17 deletions
+4 -2
View File
@@ -3173,11 +3173,13 @@ func ConfirmBookingHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("ALERT: failed to scan total_duration_minutes for booking %s: %v", bookingID, err) log.Printf("ALERT: failed to scan total_duration_minutes for booking %s: %v", bookingID, err)
durationMinutes = 60 durationMinutes = 60
} }
_ = dav.Service.CreateEvent(1, dav.EventInput{ if err := dav.Service.CreateEvent(1, dav.EventInput{
Summary: "Crussell Booking", Summary: "Crussell Booking",
Start: booking.StartTime, Start: booking.StartTime,
End: booking.StartTime.Add(time.Duration(durationMinutes) * time.Minute), End: booking.StartTime.Add(time.Duration(durationMinutes) * time.Minute),
}) }); err != nil {
log.Printf("Failed to create DAV calendar event for booking %s: %v", bookingID, err)
}
} }
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
+3
View File
@@ -232,6 +232,9 @@ func AdminCancelBookingHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
// No admin notification needed for pending/admin-initiated cancellations —
// the admin is the one performing the cancellation, so notifying them would
// be self-referential.
// Only notify on cancellation if booking was not pending (e.g. confirmed, in_progress) // Only notify on cancellation if booking was not pending (e.g. confirmed, in_progress)
if originalStatus != "pending" { if originalStatus != "pending" {
notificationQuery := ` notificationQuery := `
-1
View File
@@ -1802,7 +1802,6 @@ func CreateTipPayment(w http.ResponseWriter, r *http.Request) {
paymentID, err := service.CreatePaymentRecordTx(r.Context(), tx, record, nil) paymentID, err := service.CreatePaymentRecordTx(r.Context(), tx, record, nil)
if err != nil { if err != nil {
_ = tx.Rollback(r.Context())
log.Printf("Failed to create payment record: %v", err) log.Printf("Failed to create payment record: %v", err)
http.Error(w, "internal server error", http.StatusInternalServerError) http.Error(w, "internal server error", http.StatusInternalServerError)
return return
@@ -1019,11 +1019,6 @@ func TestCreateBookingPayment_MultiplePartialAllowed(t *testing.T) {
} }
} }
func TestSquareWebhook_DevMode_NoSignature(t *testing.T) {
t.Parallel()
t.Skip("webhook handler tested in webhooks package")
}
// ============================================================ // ============================================================
// User Booking Payment Tests — deposit, full, partial, balance // User Booking Payment Tests — deposit, full, partial, balance
// ============================================================ // ============================================================
+4 -2
View File
@@ -322,7 +322,7 @@ func computeAggregateSummary(r *http.Request, rangeStart, rangeEnd time.Time) *D
) sub ON true ) sub ON true
WHERE b.start_time >= $1 AND b.start_time < $2 WHERE b.start_time >= $1 AND b.start_time < $2
` `
_ = db.Conn.QueryRow(r.Context(), query, rangeStart, rangeEnd).Scan( if err := db.Conn.QueryRow(r.Context(), query, rangeStart, rangeEnd).Scan(
&summary.TotalPaymentsToday, &summary.TotalPaymentsToday,
&summary.TotalTipsToday, &summary.TotalTipsToday,
&summary.TotalVATCollected, &summary.TotalVATCollected,
@@ -335,7 +335,9 @@ func computeAggregateSummary(r *http.Request, rangeStart, rangeEnd time.Time) *D
&summary.LastCustomerName, &summary.LastCustomerName,
&summary.LastCustomerVisits, &summary.LastCustomerVisits,
&summary.GuestCustomers, &summary.GuestCustomers,
) ); err != nil {
log.Printf("Failed to scan today summary: %v", err)
}
// Customers served = new + returning + guest (distinct people, not bookings) // Customers served = new + returning + guest (distinct people, not bookings)
summary.CustomersServed = summary.NewCustomers + summary.ReturningCustomers + summary.GuestCustomers summary.CustomersServed = summary.NewCustomers + summary.ReturningCustomers + summary.GuestCustomers
+5 -7
View File
@@ -563,10 +563,8 @@ func TestDeleteAccount_WithProfilePicture(t *testing.T) {
// Handler returns 204 regardless of goroutine result // Handler returns 204 regardless of goroutine result
assert.Equal(t, http.StatusNoContent, w.Code) assert.Equal(t, http.StatusNoContent, w.Code)
// Allow goroutines to start before test cleanup // Best-effort wait for background goroutine to initiate
assert.Eventually(t, func() bool { time.Sleep(50 * time.Millisecond)
return true
}, 100*time.Millisecond, 10*time.Millisecond)
} }
// ============================================================================= // =============================================================================
@@ -592,7 +590,7 @@ func TestDeleteAccount_WithSquareClient(t *testing.T) {
handler.ServeHTTP(w, req) handler.ServeHTTP(w, req)
assert.Equal(t, http.StatusNoContent, w.Code) assert.Equal(t, http.StatusNoContent, w.Code)
assert.Eventually(t, func() bool { // Best-effort wait for background goroutine to initiate
return true time.Sleep(50 * time.Millisecond)
}, 100*time.Millisecond, 10*time.Millisecond)
} }