Repository navigation
Delete a booking for a GDPR erasure request - #280
Mehr-Vertrieb wants to merge 1 commit into
Conversation
Owners and admins can permanently remove a booking from the Bookings list
(DELETE /v1/bookings/{id}). One transaction removes the booking, its
cascaded rows (attendees, answers, manage tokens, host assignments) and
the rows that name the person without a cascade: webhook deliveries and
their queued jobs, reminder jobs, idempotency records, transcripts and
notes. No email, no webhook.
Refused with a 409 code naming the step to take first: upcoming
confirmed bookings (cancel first), paid bookings (payment record),
bookings with recordings (files in object storage) and cancelled
bookings whose calendar event removal is still pending. A past meeting's
calendar event is left alone, because removing it through the provider
would email the guest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015iakVADVRvb5zkK5sEwxtg
There was a problem hiding this comment.
Important
A successful DELETE /v1/bookings/{id} can return 204 while the participant's display name written into meeting_consents for the booking's video room is still in the database. That store survives both this transaction and the recording deletion the recordings_first refusal points the admin to — see the inline comment.
Approach: sound — one ordered transaction, an explicit refusal with a stable code for each unsafe state, and no notification side effects. The structural gap is that the removal list is hand-maintained and misses a store keyed to the booking's room.
Reviewed changes
- Erasure service —
booking.Service.Deleterefuses upcoming, paid, recorded and calendar-pending bookings, then removes the non-cascading rows and the booking in one transaction. - Admin endpoint —
DELETE /v1/bookings/{id}, admin-only, each refusal as a409code the UI can act on. - Bookings UI — trash action on cancelled/ended free bookings with a destructive
ConfirmDialog; the refusal codes map to translated next steps. - Strings and changelog —
en/frcatalogue entries and the CHANGELOG "Added" entry. - Tests — handler coverage for the row cleanup, the four refusals, the second-delete
404, and member403.
ℹ️ Cancel-then-delete can still notify the person whose data was erased
Upcoming bookings must be cancelled before deletion, and CancelBooking starts the cancellation side effects in a goroutine after it responds. A delete that lands after loadCancellationData has read the attendee but before SendCancellationToAttendee runs still emails the erased name and address; one that lands before the webhook enqueue makes booking.cancelled fail the webhook_deliveries.booking_id foreign key and be dropped. The window is seconds, but this is the exact flow the cancel_first refusal prescribes.
Technical details
# Cancel side effects are not fenced by the delete
## Affected sites
- internal/handler/booking_handler.go:1821 — `go h.cancelSideEffects(*b)` after the cancel response
- internal/handler/booking_handler.go:2153 — `loadCancellationData` ignores a missing attendee row
- internal/handler/booking_handler.go:1932 — `SendCancellationToAttendee` runs after the per-host calendar calls
- internal/handler/booking_handler.go:1949 — `Enqueue("booking.cancelled", ...)` inserts `webhook_deliveries.booking_id`, which fails once the booking row is gone (`internal/webhook/webhook.go:461`)
## Required outcome
- A delete that follows a cancel must not send cancellation mail, or lose the `booking.cancelled` webhook, because it raced the background goroutine.
## Suggested approach (optional)
- Mark cancellation side effects as pending and have `Delete` refuse until they settle, or have `cancelSideEffects` confirm the booking still exists before sending.
## Open question
- Whether an already-claimed `webhook.deliver` job (the payload is read before the POST) should be treated the same way, since it can also deliver after the `204`.deepseek-v4.1-flash | 𝕏
| {"webhook deliveries", `DELETE FROM webhook_deliveries WHERE booking_id = ?`}, | ||
| {"idempotency keys", `DELETE FROM idempotency_keys WHERE booking_id = ?`}, | ||
| {"transcripts", `DELETE FROM transcripts WHERE booking_id = ?`}, | ||
| {"notes", `DELETE FROM notes WHERE booking_id = ?`}, |
There was a problem hiding this comment.
meeting_consents stores the display name each participant types into the LiveKit room, keyed by room = 'booking-<id>', and nothing deletes those rows: not the recording deletion the recordings_first refusal sends the admin to, and not this transaction. So a successful delete returns 204 while the person's name is still in the database — the outcome this feature exists to prevent. Add a step for the booking's room and seed a consent row in the handler test.
Technical details
# meeting_consents is not part of the erasure
## Affected sites
- internal/booking/delete.go:95-103 — the steps slice removes jobs, webhook deliveries, idempotency keys, transcripts and notes, but not meeting_consents
- internal/db/migrations/00044_meeting_consents.sql:5 — keyed (room, participant_identity); no FK to bookings, so the cascade never reaches it
- internal/handler/livekit_recording.go:207 — the only writer; room is `booking-<id>` (internal/handler/booking_handler.go:1168)
- internal/handler/livekit_recording.go:439 — `deleteRecordingArtifacts` removes the file, transcripts, notes and the recordings row only; there is no `DELETE FROM meeting_consents` anywhere in the repo
## Required outcome
- After `Delete` commits, no `meeting_consents` row remains for the booking's room.
- `internal/handler/booking_delete_test.go` seeds a consent row for the booking room and asserts it is gone (the fixture currently never creates one).
## Suggested approach
- Add `{"meeting consents", `DELETE FROM meeting_consents WHERE room = 'booking-' || ?`}` to the steps slice, before the bookings delete.
## Open question
- The room holds hosts and attendees alike; erasing the whole room's consent log is the simplest reading of the erasure request, but confirm that is the intent.| {"notes", `DELETE FROM notes WHERE booking_id = ?`}, | |
| {"notes", `DELETE FROM notes WHERE booking_id = ?`}, | |
| {"meeting consents", `DELETE FROM meeting_consents WHERE room = 'booking-' || ?`}, |

What
Owners and admins can permanently delete a booking from the Bookings list (trash icon with a destructive
ConfirmDialog;DELETE /v1/bookings/{id}, admin only).One transaction removes:
ON DELETE CASCADEits attendees, intake answers, manage tokens and host assignments;webhook.deliverjobs that would send them;reminder.sendjobs;No email is sent and no webhook fires: the person asked for their data to be removed, not to be told about a cancellation.
Why
Under the GDPR (Art. 17, right to erasure), an operator in the EU has to delete a person's personal data on request without undue delay. Today Calnode can only cancel a booking. After a cancellation the attendee's name, email, answers and webhook payloads stay in the database indefinitely, and there is no way to remove them short of editing SQLite by hand. That makes Calnode hard to run for EU operators who receive deletion requests, for example from people who booked a sales call and later ask to be forgotten.
What it refuses, and why
Each refusal is a
409with a stable code; the admin UI turns it into the step to take first:cancel_firstpaid_bookingrecordings_firstcalendar_pendingDeliberately not touched
sendUpdates=all) would email the guest a cancellation for a meeting that already happened. The confirmation dialog tells the admin to delete it there without notifying guests.Notes
enandfr. The German strings follow with Add German admin UI and localise operator-facing emails #276, which adds thedeadmin catalogue.requireAdmin); members cannot erase bookings, not even their own.Checks
gofmt -l .clean,go vet ./...,go build ./....internal/handler/booking_delete_test.go:go test ./...is green exceptTestCreateWebhook_*,TestDeleteWebhook_success,TestListWebhook*, which fail identically on unmodifiedmainin my sandbox (no DNS for the webhook URL check).pnpm check(0 errors),pnpm check:i18n, catalogue unit tests.