I selected 4 of the possible options because it is really a case by case basis...and different classes function differently. What will happen to a Warlock is not the same as what could happen to a Cleric (or Paladin).
I don't actually use Warlocks in my setting/homebrew games. The reason, primarily, is that since the class' introduction, there seems to be a real lack of comprehension what a "Pact" is.
"Here's your powers in exchange for some story/fluff X that will never actually come into play. And when you're 10th or 12th level and you and all of your 10th-12th level buddies come to kill me, I'm just out of luck and have to kick myself that I should never have given you those magic secrets and know-how and [potentially, depending on how you fluff it] raw energy to use."
I mean, has anyone ever heard of Rumplestilskin? That's a pact. Make sure you "read the fine print" of a Faustian contract with a devil. That's a pact.
"Here. Take all this power and I'll tell you how to use it however you want. Nah, I don't hold any actual mechanical power over you. [Your DM doesn't have any right to remove your powers]." That is NOT a pact.
Line #1 in the fine print of any Warlock-style class pact/contract would be "If you raise a finger against me, for any reason, or play any part of a plot against me, the pact is void. I summarily rescind my favors and remove my knowledge that I have, graciously and in my most generous spirit, allowed you to partake." (i.e. You will immediately lose all powers.)
Or maybe bury it as the 5th or 15th thing in the fine print. Along with other things like "You will conduct no less than one task for me as appointed by a) myself; or b) an official recognized agent of mine; betwixt each solstice and equinox." Asking you to do stuff, and either failing or being thwarted, could result in a visit from one of the patron's agents for a "reminder" or some "discipline"...up to and including "IF you don't get this other thing done instead, we're going to have to revise what powers you have access to until it's done." or some such.
Now, the OP does stipulate it's a "grave" transgression. For that, for clerics, it's actually a bit easier. PResuming the cleric is of a high enough level that they are being survailed by the agents of the deity, if not the deity themselves, (I'd say a minimum of 5th or 7th level, wherein angels/archons/whatnot will be making "reports" to the deity about your actions -and may attempt to intervene with you directly, depending on how good you've been up to the transgression, the nature of the transgression, and whatever other narrative thigns the PC and DM have going on- I am going to presume, that's going to be a gradual removal of spells, from the higher levels to the lower. But that would probably be more of a "warning you're on the wrong path/making mistakes" kind of thing before the taps are fully turned off. Or begin with the channels -POOF! You can't effect undead til you atone...and you're not going to be able to replace spells you use...so be wise with what you've got.
Same for Paladins. A "grave" transgression would probably BEGIN with the removal of Smiting at all. Then siphon off spell power.
There is the option -as we've recently seen in Vox Machina- of just a flat out deity "turns their back" to the cleric and you get bupkus -no spells, no channels, no meditations, nada- HOPEFULLY, until you've suitably atoned...but again, depending on the transgression, maybe for good.
The god of the hunt is unlikely to hold it too much against you if you slay some extra deer...or, say, a tribe of fiendish goblins that is doing wanton harm to the forest. The goddess of life, on the other hand, that has a direct 'Do no harm to others, but in self defense" tenet/dogma/taboo, is going to be more than "miffed" when you use your own hands/spells/HER power to wipe out those demon-goblin young.
I can hear the wails now, "What?! So I'm just supposed to be some healbot, wimpering behind the barbarian and knight?! That sucks!" Well, then maybe choosing the goddess of life, with the established teachings and priorities (that would absolutely be shared with the player in a session zero/before play begins), so that you'd have access to higher levels heal spells and Raise Dead, wasn't really the way you should have gone.
And, no, I am not of the mind "just get a different god" as a viable option (for clerics or paladins)...other than the case of going directly to the former deity's direct nemesis. Otherwise, like minded/aligned entities are going to know/think, "You couldn't maintain your faith in/properly serve (your former god). Why would I trust you will serve me any better, let alone grant you any of MY actual divine power?"
Evil deities, of course, (not to mention Warlock patrons of various ilk) will be thrilled to scoop you up, though. ...and that, of course, can make for quite the wild ride in a campaign that would permit such a thing (I tend to be a "no Evil PCs" table...but I could see circumstances/narrative reasons that could make for a great twist and good/better story for the player/table).
So, yeah, it's a very complex question. The "gravity" of what a 'grave transgression" is not constant. Nor the reactions of deities vs. patrons vs. deities/patrons of these types and alignments vs. deities/patrons of those types and alignments vs. class X vs. class Y...
Lots for a DM to consider...and, of course, hopefully, make the call that will present the most fun and challenge for their table...
But a Pact, gods dash it all, needs to be an actual Pact. Not just some DM/player meaningless agreement (or, worse, just unilateral player-generated fluff) that is forgotten/ignored, cuz all we really want is blasty/spammable magic powers with no consequences and the flimsiest story to justify it.