The threat of damage from overheating applies primarily to roofs that have wood shingles. These shingles contain moisture and can dry out if they are exposed to too much heat from the sun, causing them to split or curl. Foam insulation in the attic attaches to the underside of the roof. On a hot, sunny day, this insulation will prevent the air in the home, which is cooler than the air outside, from cooling the roof from below, increasing both roof temperature and the chances of damage.
One way to protect a roof despite the presence of foam insulation is through venting. Attic venting can consist of simple openings that allow hot air to escape under the eaves of the roof or a more complex system of fans that expel hot air during warm weather. In either case, venting allows you to insulate the roof efficiently with foam but manage its temperature as needed by opening vents or running fans.
Besides venting, you can keep a roof cool by selecting the right color. Dark roofs tend to absorb heat, increasing the risk of overheating. Light-colored roofs will reflect heat, keeping them much cooler and reducing the rick of damage. In the case of a wooden roof, painting pressure-treated or kilned shingles with light colors will keep heat from collecting on the surface of the roof or entering your attic, regardless of how much foam insulation you have.
Applying foam insulation in the attic presents a trade-off between controlling the temperature of the roof and the temperature of your home. While removing insulation or never installing it will allow the roof to breathe, it will also allow your home to lose cool or warm air. This will increase energy costs as you heat or cool the home while air is escaping. Insulating the roof with foam and selecting a roof that can handle the associated heat is a good way to save on energy and have a roof that will last.