A Wall Street rating agency on Friday upgraded the Chicago Board of Education’s bond rating — from B-plus to BB-minus — citing a revised school funding formula that “should improve the amount, timing and potential volatility of state aid.”

Fitch acknowledged that the Chicago Public Schools are by no means out of the woods. CPS remains “highly dependent upon external cash flow borrowing.”

The rating agency also noted that pensions will “continue to be a pressure” as the Chicago Teachers Pension Fund has funding to cover just 39 percent of its liabilities “when adjusted to reflect an assumed return on investments of just six percent.”

But Fitch noted that the revised school funding formula approved by the Illinois General Assembly will result in a “material increase in state support” for CPS. That includes a “hold-harmless” provision that “should protect CPS from state aid declines based on demographic factors, enrollment, poverty rate, etc.”

“The hold harmless provision should be particularly beneficial given the trend of declining enrollment,” the rating agency said.

Fitch also credited Mayor Rahm Emanuel’s handpicked school team for making “a series of substantial cuts over the past several years, including administrative cutbacks, school closures and layoffs.”

“The moratorium on school closings expires at the end of this fiscal years, which may present an opportunity for efficiencies,” Fitch wrote.

The bottom line is that, although “CPS lacks sufficient cushion and is ill-prepared to withstand, even a moderate economic downturn,” the school system is on its way up from rock bottom.

Fitch noted that CPS expects an “ending general fund balance of $178 million or three percent of spending that could rise to $383 million or 7 percent if CPS executes a tentative debt restructuring.

That’s compared to fiscal 2016, when CPS reserves were “complete exhausted. That’s even after the school system relied upon “unsustainable practices” that include scoop-and-toss borrowing, “optimistic” revenue projections and “lengthening the accrual period for property tax collections.”

Schools CEO Forrest Claypool said Fitch obviously recognized that CPS has “eliminated a $1.1 billion deficit over the past two years, thanks to long-term structural revenues and sustainable management efficiencies.”

“The historic state education funding reform also provides a new framework that puts CPS on the path toward long-term sustainability,” Claypool was quoted as saying in an emailed statement.

“Fitch’s upgrade acknowledges this tremendous turnaround.”

Civic Federation President Laurence Msall called the upgrade “a sign of the positive impact” the influx of state funding has had on CPS finances, along with “the authorization for increased pension funding through the dedicated property tax levy.”

But Msall noted that the higher rating was still “non-investment grade.”

CPS still “faces many significant challenges including a cash-flow crisis, ongoing structural deficit and high debt burden, much of which incurs interest at a staggering rate and diverts hundreds of millions of taxpayer dollars away from the classroom,” he said.