Repository navigation
fix(gallagher/parking_approvals): prevent duplicate approval emails - #649
Merged
Merged
Conversation
added 2 commits
November 2, 2026 23:22
…ng model and gallagher parking approval driver use .asset_ids. Update the shared Booking model to be compatible with the Booking signal params
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Parking approval emails could be sent repeatedly when a stale booking snapshot was written back after a successful approval.
The Staff API merges incoming
extension_datainto the persisted booking. Allocation/restore were sending the entireextension_datahash from an older fetch, which could overwriteparking_notifiedand resetemails_sent. The next sweep then saw the booking as unapproved/wait-listed and sent another approval email.Manual-allocation
staff/booking/changedevents also carry a point-in-time snapshot, which may already be stale by the time it is processed.Changes
process_state/notification ledger to decide whether an email is still owed.extension_datahash fromallocate/restore_allocation.location,parking_group) viabooking_extension_data, leavingparking_notified,emails_sent, and other concurrent fields untouched.get_booking.resource_id/resource_idsevent payloadsWhy this matters
Without this, a stale sweep or stale event could erase a successful approval’s ledger entry, causing the user to receive the same “Parking space approved” email multiple times.
Testing
./harness report drivers/gallagher/parking_approvals_spec.cr Result: 1 tested, 0 failures, 0 timeouts, 0 without spec Deployment notes - Driver-only change; no database migrations or setting changes. - Publish the updated driver and restart the affected ParkingApprovals modules.