The only problem here is the lie Data tells Riker back on the ship. And it IS a lie in the legal sense, Data with held information either through misdirection or omission.
I'm not really disputing that he withheld the fact that he purposely fired, but the conversation was hardly legal in nature or even official. Riker didn't even put a question to him directly. It was an offhand remark, as in "Oh... by the by... O'Brien said the weapon was in a state of discharge"
"Perhaps something happened during transport" Yeah, something did
happen. He pulled the trigger on that jerk's monkey ass,
Now, it's clear Riker was suspicious of that remark, & if he had followed up with "You know of no specific reason why
it would have been discharging? Under that line of questioning, I'm betting Data would have admitted it
But Riker didn't pursue it... purposely. They both knew what that meant, & chose to let it be