The gap next to the ridge board is normal and you should keep it unobstructed. This gap along the top edge of the roof sheathing is there in order for the ridge vent (special material along the top of the ridge on the outside) to function. It's how the hot air in your attic gets out, and it's crucial for proper attic ventilation.
As far as nails just coming through the shingles only, it might be an issue or not. Depends on whether they properly nailed the top row of shingles and the ridge materials in addition to missing the deck with all those nails. No way for me to tell without actually looking at your roof. I'd start by asking the roofer what's going on with those nails and see if he has a good explanation.
But as far as the gap goes, you want that gap there.
Hope this helps.