Shield spell Casting time line says (PHB, p. 275):
1 reaction, which you take when you are hit by an attack or targeted by the magic missile spell.
(bold highlight by me)
PHB, p. 194, 1st paragraph under "Attack Rolls" say:
To make an attack roll, roll a d20 and add the appropriate modifiers. If the total of the roll plus modifiers equals or exceeds the target's Armor Class (AC), the attack hits.
So, disregarding the magic missile spell case, the trigger for the Shield is the fact of hit, i.e. attack roll was made and it was determined that the target was hit. What would be the point of casting the Shield spell at this point if attack is already resolved?
Spell effect description says:
An invisible barrier of magical force appears and protects you. Until the start of your next turn, you have a +5 bonus to AC, including against the triggering attack, and you take no damage from magic missile.
(again, bold highlight is mine)
The description seem to imply that it retroactively changes the outcome of the attack roll, otherwise the bolded text does not make any sense; but on the other hand it does not spell it out explicitly and it specifically has different wording for being hit by an attack vs. being targeted by magic missile (if the intention was to retroactively make attack miss, the wording could have used "targeted" for both cases; and PHB, p.194 explicitly mentions picking a target for attack, so targeting is a well-defined step).
Is there something that supports retroactive outcome change?