Encapsulate A/C duct inside roof deck insulation?
How big is the attic space? Maybe forget ducts and put in a mini-split system instead for the attic.

But your contractor is nuts. Two inches of foam is not enough to prevent significant heating/chilling of the ducts from the roof. And spraying foam OVER or next to the duct does nothing to insulate the duct from the roof deck.

Your contractor will probably counter with "but it's only a couple of feet, so you might get a hot/cold blast when the system starts, but then it'll be fine". No. Even when your fan is not running, air is flowing through the system due to convection. So your attic ducts will continually heat/cool the whole house.