Sparking from the top cover is the starter (+) wire, you'd be well served to remove the starter cover again to ensure that wire isn't sticking up to far (possibly rubbing the cover when installed).
I set a bike on fire neglecting this detail...
Current: 93 R100GS, 03 XR650R
Prior: 73 CB350, 77 R100/7, 83 R100RT, 04 XR650L
I love every motorcycle I've owned and even some that I haven't.