Repository navigation
feat(place/booking_approver): optionally reject bookings for undefined assets - #643
Merged
Merged
Conversation
…d assets Adds a `reject_undefined_assets` mode. When enabled, the driver caches the asset ids defined in the level zone metadata of every building (refreshed on `bookable_assets_cache_cron`, default midnight) for each type in `approve_booking_types`. New bookings whose assets aren't in the cache are rejected; the rest are approved as before. - booking_type => metadata key is configurable via `asset_metadata_keys` - a failed refresh keeps the existing cache; bookings are never rejected before the cache has loaded - already rejected bookings are skipped and excluded from the missed sweep - adds a spec Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Tested e2e OK on a UAT cluster |
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
Adds an optional mode to
Place::BookingApproverthat rejects bookings for assets that aren't defined in building zone metadata, instead of approving everything that matches the zone and type filters.How it works
When
reject_undefined_assetsis enabled:approve_booking_types, the driver collects the asset ids undermetadata.<key>.details[].idfrom the level zones of every building (staff_api.metadata_children(building_id, key)). It stores them as aSet(String)per booking type.bookable_assets_cache_cron(default0 0 * * *, midnight, intime_zoneif set) and once shortly after settings load.createevent that passes the existing zone and type filters, every asset on the booking must be in the cache.utm_source: "booking_approval_driver".Safety
New settings
Other changes
rejected: false. Without this, the sweep would re-reject the same bookings every 10 minutes. It also means the sweep no longer approves bookings that someone rejected manually, which it could do before.statusnow also reportsbookings_rejectedand the number of cached assets per type. The cache size is exposed as thebookable_assetsstate key too.@bookings_approved : Int32 = 0u32(type mismatch) to= 0.Testing
New
booking_approver_spec.crcovers:idare skipped.The spec passes locally (Crystal 1.22.1, placeos-driver 8.1.7).
Known limitations (unchanged)
approve_booking_types.🤖 Generated with Claude Code