from __future__ import annotations from cloud.internal_api.models import HeartbeatRequest def test_heartbeat_request_defaults_mcp_busy_device_ids_to_empty() -> None: req = HeartbeatRequest(host_id="h1") assert req.mcp_busy_device_ids == [] def test_heartbeat_request_accepts_mcp_busy_device_ids() -> None: req = HeartbeatRequest(host_id="h1", mcp_busy_device_ids=["phone-1"]) assert req.mcp_busy_device_ids == ["phone-1"] def test_heartbeat_request_omitting_field_is_backward_compatible() -> None: """Old host-agents that don't send the field must still validate.""" raw = {"host_id": "h1", "devices": []} req = HeartbeatRequest.model_validate(raw) assert req.mcp_busy_device_ids == []