My only concern with the spray foam is leaks.
I was a big proponent of the spray foam until my neighbor had it done. A few years later his roof had rotted to the point of collapsing. Indeed, a hail storm poked holes through the effected area, which is how he found out about it.
The foam did such a great job it prevented water from dripping through which hid the area where the leak was.
The real kicker was his insurance company would not cover the damage citing it was owner created.
Just be careful with the spray foam and check with your insurance company about liability in case of damage.
Don't think you ever want to coat the underside of you roof/shingles with foam. You want all the insulation on the top side of your ceiling. Let the attic ventilate.