Step flashing gap detail (roof to wall)

Wanted to inquire as to the gap you leave between the vertical leg of step flashing and the shingles. I am not talking about a 1 inch gap between siding and the roof, but specifically if you leave any gap (1/8-1/4 inch) between shingle edge and leg of flashing against the wall? Similar concept to leaving a channel between a roofing boot and shingles so water does not get trapped. I see multiple examples online, some have a small gap for a channel while others butt them up flush. I tend to leave about 1/8-1/4. My thought is that the siding will end up being above that portion (with its own gap, of course) - only water that will get there will be in stormy windy rain and will have an easy way to escape down through kickout flashing, while the gap will prevent shingle buckling during expansive hot season. Not sure if I am doing a disservice with that. Or if the gap is negligible detail that will do no good and is unnecessary. Will it do any harm?

Another point, since I use copper step flashing, I also use copper nail (2 of them) at the very top of flashing to nail to roof. Those nails will also penetrate the top of the shingle below. The next shingle and layer of flashing will overlap the nails, so leaks are unlikely. I use 5 inches for both planes (roof and wall) with steps of 8 inches up the roof. Since I do not nail the shingle to the step flashing, I end up running last shingle nail right next to where the step flashing should end, then run a couple above it, a few inches above the strip. To mitigate possibility of blow off (highly unlikely by the wall), I run a small bead of polyurethane sealant right under the shingle to seal it to the flashing. I do it vertically as to not trap any moisture. No horizontal caulking! This is about 1/2 from shingle edge, so you cannot see it is caulked. Anyone do this or have other suggestion for keeping shingle secure?

Thank you all for all the help throughout the years! I like to understand small details to produce great work. I am happy to be a part of this community!

I always cut my steps at 3"up - 5"out 2x shingle exposure, 1 nail high. On a high wind wall/low pitch, vertical caulk at the roof edge of the flashing for insurance. If you wanted to horizontal caulk, it would only be at the TOP of the flashing. Factory shingle cut against the wall, minimum 12", butted up snug. Seemed to me that if I left a gap, 1/8 or so, it would drain better, but if you look at it, there would be an open channel all the way up the wall and blowing rain would find it for sure. Fasten steps to the roof, counters to the wall.