Have been doing some thinking and digging. Here are some suggestions:
Those words ending in a hard "y" [shy/wry etc], many of which derive from early Germanic words with endings in -ig[h], do not change to "i" in front of "ness".
Those words ending in a short "y" [happy/lucky etc] change to "i" in front of "ness".
The first group are discrete words, the second group are words to which a suffix [-y] has already been added.