When I run a role-playing game, I have a standard operating procedure when it comes to a player-character taking an action that requires a roll. Before the player commits to the action, I will offer an accurate estimate of its difficulty: easy, moderate, hard, etc. Once the player commits, I reveal the actual numerical difficulty or armor class. As I see it, once the risk is undertaken, the odds are revealed. There is no point in punishing the player in the name of immersion. I contend that not revealing the odds is a violation of verisimilitude. Once you attempt something, you can usually gauge your chance of success with a reasonable amount of accuracy simply by being aware of your own capabilities and the challenges you face in the moment. Furthermore, if you withhold the odds, you are withholding knowledge of the character's environment that a player-character needs in order to make meaningful decisions. It is frankly an infringement of player agency, and that, as far as I am concerned, is a breach of the role-playing social contract.
Withholding the odds can be even more consequential if a role-playing game employs a meta-currency such as luck. Why would anyone be motivated to use a scarce resource without knowing the odds? It makes game play less meaningful and, in my experience, less enjoyable. It makes more sense not to engage with that aspect of the rules at all, especially if the resource is rarely, if ever, replenished. But where is the fun in that?
The person running the game already has a vast informational advantage. In the name of good sportsmanship, at least let the players know what their chances are.