For Gov. Mark Dayton and his finance team, last week’s news that Minnesota’s Standard & Poor’s bond rating had been upgraded to AAA — the top rung for states — was a bit like a student learning that he had aced a final exam.

The new rating matched the top marks Minnesota regained from the Fitch agency in 2016 and scored again last week for the third straight year. A third agency, Moody’s, held the state’s rating at Aa1, where it has been since the state budget deficit repair job of 2003. Moody’s explained its reluctance to give Minnesota top marks by noting that the state’s “sound management tools” are “somewhat mitigated by recurring governance issues” — things, we imagine, like a gubernatorial veto of a massive 1,000-page spending bill.

Still, praise from two of Wall Street’s big three rating agencies validates one of the two-term DFL governor’s favorite bragging points: On his watch, Minnesota has regained sound fiscal health.

That’s a notable and relatively rare achievement. Last year, just 14 of the 50 U.S. states were granted S&P’s coveted AAA rating. Minnesota lost that top score in 2011 after DFLer Dayton and a Republican-controlled Legislature agreed to a number of one-time gimmicks to reach a shutdown-ending budget deal. Though Minnesota has eschewed such gimmickry since then, the AA+ rating lasted for seven years, translating into increased interest rates — and hence higher debt-service costs for taxpayers — whenever the state or its related local governments issued long-term bonds.

Why the upgrade now? Both Fitch and S&P praised Minnesota’s strong economy, while noting that a tightening labor market could slow the growth rate in the coming decade. Dayton, in turn, credited Minnesotans’ enterprise for the good marks.

But two recent moves by state lawmakers have made a particularly positive impression on rating agencies:

• State government has amassed $1.95 billion in a reserve and cash flow account, thanks in part to a mechanism enacted in 2014 for adding to reserves automatically when surplus state budget funds are forecast until a target level — currently $2.2 billion — is reached. That target is within striking distance before Dayton leaves office at year’s end.

• The 2018 Legislature’s public employee pension bill shrank the state’s net pension liability by $3.4 billion, enough to turn rating agency heads. They liked the bill’s balanced approach, mandating higher annual contributions from both employers and employees while reducing annual cost-of-living increases for retirees.

The raters also like the $1.3 billion that remains on the bottom line in the current state budget period and what S&P called Minnesota’s “moderate debt levels.” But those are more the consequences of those “governance issues” that Moody’s detected than of bipartisan accord. Minnesota’s 2018-19 operating budget is well into the black in part because major spending and tax bills were vetoed this year. Its debt levels are low in part because the Legislature failed to enact a bonding bill in 2016 and cut Dayton’s bid on this year’s bonding bill by a third.

Those special circumstances notwithstanding, sound fiscal management of a $23-billion-a-year public enterprise typically does not happen by accident. It requires a governor who makes the state’s fiscal health a priority and legislators in both parties who understand that all of Minnesota suffers if state government can’t keep its books in the black.

Candidates for those offices should signal their intention to manage the state budget in a manner that keeps Minnesota’s bond rating high.