A future trivia question and historical footnote, the spectacular 10-day flameout of Anthony Scaramucci qualifies as the most entertaining episode yet of the ongoing reality show that is the Trump presidency. (Working title: “The Pompadours of 1600 Pennsylvania.”) But even as the cocksure sycophant’s gobsmacking spectacle stole the show, something of real importance took place a bit lower on the radar.

At five separate junctures, the sinews of our democracy held against the careening recklessness of this presidency. Consequently, Donald Trump’s worst week proved a particularly fine hour for American democracy:

1. The military says no to Trump on the transgender ban.

Well, not directly — that’s insubordination — but with rather elegant circumspection. The president tweeted out a total ban on transgender people serving in the military. It came practically out of nowhere. (A House vote to continue funding for sex-change operations may have triggered Trump’s blanket ban.) The military brass, not consulted, were not amused. Defense Secretary Jim Mattis, in the middle of a six-month review of the issue, was reportedly appalled.

What was done? Nothing. The chairman of the Joint Chiefs simply declared that a tweet is not an order. Until he receives a formal command and develops new guidelines, the tweet will be ignored.

(Whitney Leaming,Dani Player,Malcolm Cook/The Washington Post)

In other words, the military told the commander in chief to go jump in a lake. Generally speaking, this is not a healthy state of affairs in a nation of civilian control. It does carry a whiff of insubordination. But under a president so uniquely impulsive and chronically irrational, a certain vigilance, even prickliness, on the part of the military is to be welcomed.

The brass framed their inaction as a matter of procedure. But the refusal carried with it a reminder of institutional prerogatives. In this case, the military offered resistance to mere whimsy. Next time, it could be resistance to unlawfulness.

2. The Senate saves Sessions.

Trump’s relentless public humiliation of Attorney General Jeff Sessions was clearly intended to get him to resign. He didn’t, in part because of increasing support from Congress. We discount here the solemn praise Sessions garnered from hypocritical Democrats who just weeks ago were denouncing him as an unreconstructed racist. Sessions’ former Republican colleagues came out strongly in his defense and some openly criticized the president’s shabby treatment of his first and most fervent senatorial supporter.

Indeed, Chuck Grassley, chairman of the Judiciary Committee, warned Trump not to fire Sessions because he wouldn’t get another attorney general — the committee’s entire 2017 schedule was set and there would be no hearings to approve a new AG. That was a finger to the eye of the president. Every once in a while, the Senate seems to remember that it belongs to a coequal branch.

3. Senate Republicans reject the Obamacare repeal.

The causes here are multiple, most having nothing to do with Trump. Republicans are deeply divided on the proper role of government in health care. This division is compounded by the sea change in public opinion as, over seven years, Obamacare has become part of the fabric of American medicine, and health care has come to be seen as a right rather than a commodity.

(David Jorgenson/The Washington Post)

Nonetheless, the stunning Senate rejection of repeal was also a pointed rejection of Trump’s health-care hectoring. And a show of senatorial disdain for Trump craving a personal legislative “win” on an issue about whose policy choices he knew nothing and cared less.

4. The Boy Scouts protest.

In a rebuke not as earthshaking but still telling, the chief executive of the Boy Scouts found it necessary to apologize for the president’s speech last week to their quadrennial jamboree. It was a wildly inappropriate confection, at once whining, self-referential, partisan and political.

How do you blow a speech to Boy Scouts? No merit badge for the big guy.

5. The police chiefs chide.

In an address to law enforcement officials, Trump gave a wink and a nod to cops roughing up suspects. Several police chiefs subsequently reprimanded Trump for encouraging police brutality — a mild form, perhaps, but brutality still.

Press secretary Sarah Huckabee Sanders said it was all a joke. Nonsense. It was an ugly sentiment, expressed coyly enough to be waved away as humor but with the thuggish undertone of a man who, heckled at a campaign rally, once said approvingly that in the old days “guys like that” would “be carried out on a stretcher.”

Whatever your substantive position on the various issues involved above, we should all be grateful that from the generals to the Scouts, from the senators to the cops, the institutions of both political and civil society are holding up well.

Trump is a systemic stress test. The results are good, thus far.

Read more from Charles Krauthammer’s archive, follow him on Twitter or subscribe to his updates on Facebook.