Skip to content

feat: read desks from assets behind use_desk_assets - #646

Merged
stakach merged 18 commits into
masterfrom
feat/desk-assets
Nov 1, 2026
Merged

stakach merged 18 commits into
masterfrom
feat/desk-assets

Conversation

@stakach

@stakach stakach commented Nov 1, 2026

Copy link
Copy Markdown
Member

Closes #645

Desks are moving from desks zone metadata to _DESKS_ assets (init migrate:desk_assets). This PR moves every driver that reads desk metadata onto a shared mixin. One setting, use_desk_assets, switches the source of truth, so production systems can move over one at a time.

Changes

  • staff_api
    • assets takes limit/next_page. Like get_members, the first result carries a next_page link, which callers pass back to fetch the next page.
    • New update_asset (PATCH /api/engine/v2/assets/:id).
  • Place::DeskSource (drivers/place/desk_source.cr)
    • level_desks and building_desks return one Desk shape from either source.
    • Custom keys (floorsense_id, gobright_desk_name, …) come from other_data in both modes, through desk[key]? / desk.value(key).
    • The legacy metadata readers are @[Deprecated("desk metadata: set use_desk_assets and remove")].
  • Drivers moved to the mixin, each with use_desk_assets: false by default and one commit per driver:
    • floorsense: custom_bookings_sync, mobile_checkin_logic
    • desk_bookings_locations
    • booking approval: booking_approver, booking_approval_workflows
    • area_management
    • desk: control, allocations
    • grant_area_access
    • orbility approvals
    • gobright location_service
    • asset_name_resolver, with auto_release, at_capacity_mailer and booking_notifier
    • llm: workplace, campus

Rollout

  1. Run task migrate:desk_assets from init. Unmapped desk keys are kept in Asset#other_data.
  2. Set use_desk_assets: true on the org zone. The setting is inherited by every driver.

Cleanup

Running grep -rn 'Deprecated("desk metadata' drivers finds every legacy path: desk_source.cr (×2), desk/allocations.cr (metadata write) and bookings/asset_name_resolver.cr. Compiling any driver that still uses them prints a deprecation warning.

Review

  • Harness: 17 tested, 0 failures, 0 timeouts, 0 without spec across every touched driver. Each spec covers both modes, and assets mode includes a two-page response. Empty spec stubs were built out for custom_bookings_sync, desk/allocations, grant_area_access, orbility/approvals and area_management (whose spec used to test AreaCount).
  • Behaviour to check:
    • desk/allocations: the CSV export and allocation import use a stable external id (map_id in assets mode, which the migration fills from the original desk id). The external desk management tool doesn't see Asset#ids. Writes go to the assets.
    • grant_area_access: assets can have several security groups, so desks, the sync_blocked status and security_zone_report now hold arrays of groups instead of a single string.
    • area_management: desk ids sent to locations are the desk map_id, which is the floor-plan id rather than asset-xxx.
    • The mixin is more tolerant of incomplete metadata:
      • a desk with no id falls back to map_id
      • a missing groups is treated as empty
      • bookable: "FALSE" means not bookable
      • a missing gobright_desk_name skips that desk rather than raising
    • llm/workplace and llm/campus: they return a slim DeskDetails, so other_data never reaches the LLM.

🤖 Generated with Claude Code

stakach and others added 18 commits November 2, 2026 07:43
assets returns a next_page link on the first result (like get_members).
Adds the Place::DeskSource mixin for reading desks from assets or metadata.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Single placeos_desk_metadata built from level_desks, with specs for metadata and asset modes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Find the scanned desk in level_desks; specs cover metadata and asset modes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
map_ids built from building_desks so booking map_ids resolve from assets or metadata

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
booking types mapped to desks cache bookable ids from building_desks, other types still use metadata

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
users_with_invalid_desk_bookings uses building_desks groups and returns the users it finds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
level desk ids and desk_id_mappings come from assets or metadata, other level metadata unchanged

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desk_ids maps desk id to desk_id_key via Desk#value, cache cleared on settings change

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
allocation changes are written with update_asset in assets mode, metadata write deprecated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tool

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desks can grant multiple whitelisted security groups (security_system_groups)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
assigned desks come from building_desks, removing the per level metadata lookup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gobright desk names and departments come from desk other_data, desks without a gobright name are skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desk names come from desk assets when use_desk_assets is set (auto_release, at_capacity_mailer, booking_notifier)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Desk listing, counts, map ids and bookings use level_desks; LLM desk responses keep the same slim shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Desk listing, counts, map ids and bookings use level_desks; LLM desk responses keep the same slim shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stakach
stakach merged commit d49ab8c into master Nov 1, 2026
1 of 4 checks passed
@stakach
stakach deleted the feat/desk-assets branch November 1, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate desk metadata consumers to desk assets

1 participant