Again I would redirect you to the "why" of that decision.
Do you have kids?
If you were to write a schematic of this process, would you choose the path more likely to psychologically damage them?
Opening the door to trust issues, failed relationships, whoring etc?
How old are you?
Do you own a home? Or significant assets which you would be splitting in the event of a divorce?
Are you capable of choosing to never repeat that mistake again? Is your spouse happy and your relationship otherwise worth preserving outside of this hypothetical transgression?
Is it REALLY honesty driving this choice?
Or guilt?
Is it more selfish to place the burden of this act on your partner and put them through the emotional trauma or to shut the fuck up, move forward and be a better person in the future?
I will never have to worry about any of this, I won't cheat on my wife. But i have a happy marriage which makes that a pretty easy choice.
But to pretend it is so simple is disingenuous to me. Or even to attempt to box it in as "the right thing to do" when by the nature of the scenario the "right thing" is already off the table. At which point you are, imo, choosing between harm reduction and patting yourself on the back for a fairly empty gesture of "honesty" while choosing to leave a trainwreck of damage in your wake, most of which being dealt to someone else.