Skip to content

serviceability: restrict delete instructions to valid statuses#2870

Open
martinsander00 wants to merge 2 commits intomainfrom
ms/2223
Open

serviceability: restrict delete instructions to valid statuses#2870
martinsander00 wants to merge 2 commits intomainfrom
ms/2223

Conversation

@martinsander00
Copy link
Contributor

@martinsander00 martinsander00 commented Feb 8, 2026

Resolves: #2223

Summary

  • Delete instructions for all serviceability entities (Location, Exchange, Contributor, Device, Link, User, MulticastGroup) now verify the account is in an appropriate status before allowing deletion
  • Entities with a Suspended status (Location, Exchange, Contributor, MulticastGroup) allow deletion from both Activated and Suspended
  • Device allows all operational statuses: Activated, DeviceProvisioning, LinkProvisioning, and Drained. Like links, devices go through provisioning phases after activation (DeviceProvisioningLinkProvisioningActivated) and can be drained for maintenance. Restricting to only Activated would leave devices stuck in provisioning or drained states with no way to clean them up.
  • Link allows all active statuses: Activated, Provisioning, SoftDrained, and HardDrained. Links go through a Provisioning phase after activation (before the link health oracle transitions them to Activated), and can also be drained for maintenance.
  • User allows Activated, SuspendedDeprecated, and Banned to support the ban-then-delete workflow used in the E2E user ban test

Testing Verification

  • New integration tests added and passing for delete-from-Suspended:
    • test_contributor_delete_from_suspended
    • test_exchange_delete_from_suspended
    • test_location_delete_from_suspended
  • New integration tests for link delete status restrictions:
    • test_link_delete_fails_from_pending — verifies deletion from Pending returns InvalidStatus
    • test_link_delete_from_soft_drained — verifies deletion from SoftDrained succeeds
    • test_link_delete_from_hard_drained — verifies deletion from HardDrained succeeds
  • New integration tests for device delete status restrictions:
    • test_device_delete_fails_from_pending — verifies deletion from Pending returns InvalidStatus
    • test_device_delete_from_drained — verifies deletion from Drained succeeds
  • Device and link provisioning cases are covered by the E2E backward compatibility test (entities stay in provisioning states in that environment)
  • Full test suites for contributor, exchange, location, link, and device pass with no regressions

Same pattern as link: devices go through DeviceProvisioning →
LinkProvisioning → Activated and can be Drained. Restricting delete
to only Activated would leave devices stuck in these states.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant