hood deflector on the front edge of the hood has done an amazing job over the last three years making sure the rocks/etc don't even impact my windshield
my dad's lexus had a sunroof warning if you left it open
on my 2016 VW, you can use the equivalent of FORSCAN
assuming you had the right sensors already present to
automatically close the sunroof if it detects liquid precipitation.