Spells/traits that say “when attacked” do not trigger if the attack results in 0 damage or a dodge. The spells/traits should either be reworded to say “when attacked and damaged” or allowed to work as worded.
For example, the spell gem Chastise states: Target takes a small amount of damage. This spell can not be cast manually, but has a 100% chance to trigger when it’s owner is attacked.
Which is false, because Chastise only triggers when it’s owner is attacked and takes damage from that attack.
Note: I haven’t tested the interaction with Barrier.