The great government shutdown of 2019 is over. (For at least three weeks.)

After 35 days of pointless posturing and reckless damage to the fabric of the American state, President Donald Trump has agreed to sign a continuing resolution that will fund the government through February 15 without appropriating any money for the construction of a border wall.

In exchange, Democrats made the minor concession of agreeing to participate in a bicameral bipartisan committee on border security legislation — a classic punting of the issue to let Trump back down while claiming he didn’t really back down.

Consequently, federal workers are going to get paid and key government services will resume, while a new tone is set for the conduct of politics in the post-midterm era where Trump can no longer count on a consistently friendly Congress to do his governing for him.

Here’s who wins and who loses.

Winner: Nancy Pelosi

Not only did she prevail narrowly on the question of the shutdown and the wall, but over the past five weeks, Speaker Nancy Pelosi has silenced her intraparty critics and reminded everyone of what her supporters had been saying all along: She was a good choice for speaker because she was good at the job.

Six months ago, there were real doubts as to whether Pelosi would be able to reobtain her party’s support as speaker. By the time the midterms rolled around, she no longer had a viable challenger in the field, but her position nevertheless seemed distinctively weak as she veered this way and that to placate various factions and put her winning coalition together.

Today, she stands triumphant as the person who did the thing Democrats have been waiting for someone to do for years — beat and humiliate Donald Trump.

Her approval ratings have soared throughout the shutdown period as her co-partisans rallied behind their newly visible and effective leader and her critics in the Democratic Caucus have gone silent. Congressional leadership is an inherently difficult job, and Pelosi will no doubt face more troubled times in the future. But today, she’s the big winner who not only beat her critics but proved them conclusively wrong.

Loser: Donald Trump

Pretty much everyone in politics — up to and including Mitch McConnell and Paul Ryan — told Trump that shutting down the government over wall funding was a bad idea.

But Trump didn’t get to the White House by listening to conventional wisdom or kowtowing to party leaders, so he opted to chart his own course. And even though the vast majority of Republicans on Capitol Hill had their doubts about Trump’s strategy, they were willing to follow him.

It turned out he was wrong and everyone else was right.

The shutdown tanked Trump’s approval ratings, united his enemies, and ultimately forced him to back down and agree to reopen the government while negotiations on border security continue on a separate track. It’s conceivable that these negotiations will produce something Trump likes (though it clearly won’t be “the wall” that Trump campaigned on), but he could have started a bipartisan congressional negotiation on border security at any time without shutting down the government.

Trump escapes from the shutdown with barely even a face-saving fig leaf. He was reduced to claiming in his speech announcing the deal that he’d never proposed building a long concrete wall. But we all saw him do it — and it’s not going to happen.

Winner: air traffic controllers

The Professional Air Traffic Controllers Organization (PATCO) endorsed Ronald Reagan in the 1980 election thinking they could get a larger raise out of him than incumbent President Jimmy Carter had been willing to offer. That proved wrong; Reagan instead drove a hard bargain, which led PATCO to call a strike in 1981. It was illegal for air traffic controllers to go on strike, but PATCO leadership figured there was no way to operate the air traffic control system without them, so they would win.

They did not win.

Instead, Regan fired every striker and put together a staff of scabs who managed to get American aviation back up and running in a viable way. The union itself was decertified, and the strikers spent years ineligible for public employment, their careers ruined. It was a signature moment for Reagan and a watershed moment for the American labor movement, which learned that strikebreaking was back in style in a big way.

Consequently, there’s an amazing symbolic symmetry in the fact that of all the many problems unleashed by the shutdown, it was sickouts from air traffic controllers leading to plane delays that finally forced Trump to surrender. Trashing national parks, depriving Native Americans of vital services, and even jeopardizing FBI investigations proved tolerable. But air traffic controllers had the power.

Loser: DREAMers

The shutdown once again briefly raised the prospect of some kind of “go big” deal on immigration in which Democrats would agree to support Trump’s wall and, in exchange, the young unauthorized immigrants known as DREAMers would get legal status and a path to citizenship.

But every time this possibility comes up, immigration hawks end up scuttling it because at the end of the day, they know that the wall is silly and unimportant and they don’t want to give up anything of value for it.

Consequently, the offer on the Deferred Action for Childhood Arrivals program that Trump wound up giving was fundamentally low-value — not legal status or a path to citizenship, but a three-year reprieve from deportation at a time when the whole thing is tied up in the courts anyway.

Democrats, naturally, didn’t go for that. And while there are reports that some in the White House were urging Trump to put a more generous offer on the table in an effort to get his wall, ultimately the White House decided it was better to give up on the wall than sweeten the pot. That probably made sense tactically — the surrender is humiliating but dividing his own coalition would have been dangerous for Trump — but it means that once again, hundreds of thousands of young Americans have been used as a political football without ultimately experiencing any upside.

Loser: basic rationality and people who like to plan

This entire shutdown was incredibly pointless from day one.

Nobody thought Trump’s plan would work, and Trump’s own party does not believe that the border wall is genuinely important. The wall was born as a political stunt, so there was no reason to deploy it in a context where it would do enormous substantive damage and hurt Trump politically.

And yet it happened. And while Friday’s deal will reopen the government and get federal employees some much-needed paychecks, it still doesn’t provide an ultimate resolution to the situation. Trump ranted for quite some time Tuesday afternoon about how his wall is somehow the key to reducing crime in America, continues to threaten various emergency declaration scenarios, and at least in theory could shut everything down again on February 15.

On its face, I’m inclined to say that’s too ridiculous to be conceivable, but the shutdown was extremely ridiculous in the first place, and, of course, the whole idea of the former host of The Apprentice becoming president of the United States by claiming that he was going to coerce Mexico into paying for a 2,000-mile concrete wall is itself one of the most ridiculous things to happen in American history.