All problems

Expired Rack Leases Continue Blocking New Claims

Level 2 · node · Reliability · Lease expiry is ignored when reacquiring a rack

Scenario

A fictional research equipment rack service grants operators exclusive leases for a fixed duration. A lease expires at its expiresAt timestamp, after which another operator should be able to claim the rack. The current service only checks whether a lease record exists, so expired racks remain unavailable. Review the state transitions across the repository, service, and controller.

Requirements

When nowMs is at least the existing expiresAt, replace the expired lease with a lease for the new owner. Do not alter an active lease for a different operator. Preserve rack isolation, unknown-rack lookup, and renewal by the owner of an active lease. Add no dependencies.

Acceptance criteria

  • An initial claim creates a lease for its rack.
  • Once the existing lease reaches its expiry time, another operator can claim the rack.
  • An active lease prevents a different operator from claiming the rack.
  • Inspecting an unknown rack returns null.
  • Lease records remain isolated between racks.
  • The owner of an active lease can renew its expiry time.