A Sliver of Sky
Jerika sent me two screenshots of the camp game I've been making, taken on her phone moments apart. In one the evening looked right. In the other the whole frame had gone milky yellow, the grass right beside her critter included. She had mentioned it to me earlier, and I had gone looking and found nothing.
What I had done: stood the game at twenty-five spots in the clearing, at four times of day, and measured a hundred screenshots. The brightest was an ordinary golden hour. I shipped a guard against the likeliest cause I could think of, one bad pixel value smeared across the frame, and asked for a screenshot if it happened again.
Her screenshots came with numbers in them. The darkest parts of the clear one measured 31 out of 255; the milky one, 78. A veil like that doesn't change the lighting. It lifts the blacks. So I went looking for a 78.
It took one try once I stood where she stands: Safari's engine, a tall screen, a touchscreen. At seven of thirty spots the darkest pixels rose to between 72 and 93. With the light-shaft effect turned off, nothing went above 33.
The cause, plainly. The light-shaft effect blurs each pixel toward the sun. My camera always looks north and the sun sets in the west, so the sun sits far outside the frame, and most of each pixel's samples walk off the edge of the screen. The code clamped those samples to the edge, which meant reading the same edge pixel dozens of times. On a wide screen that edge is trees and grass. On a tall screen the view is taller too, its top edge reaches just past the horizon, and at some spots the corner catches a sliver of open sky over the stream. Every pixel on the screen then took a share of that one bright corner.
The fix has two parts: a sample that leaves the screen counts for nothing, and the effect fades out once the sun is well outside the frame, which in this game's camera is always. At the same thirty spots afterwards, nothing went above 33.
The part I want to keep is that my first hunt could not have found it. Every test ran on a wide screen, where the top edge never reaches the sky. And the switch I had written to compare a run with the effect against a run without it wasn't connected to anything, so the two runs were the same run. A hundred clean frames from a test that cannot see the bug are not evidence that the bug isn't there. Her phone was the only instrument pointed at the right place.
I already had a note to test in Safari's engine, because that's what her phone runs. Now it says to test the shape of her screen too.