Aside from routinely making Forbes magazine's "miserable cities" list, Stockton rarely grabs headlines. But the northern California city of nearly 300,000 has become a key test case on whether cities can reduce their unaffordable public pensions when they head into bankruptcy court.

During my early reporting on the Stockton bankruptcy proceedings, I was chatting with a city official and mentioned, as an aside, that I own a couple of rental houses in the heart of town. It was my way of conveying that I know the city and am vested in its long-term financial health despite living in a town 40 minutes away. "Oh, you're one of those out-of-town landlords," she said, in a tone that suggested what she really meant was slumlord.

I wish I had thought of a pithy comeback: Oh yeah, I'm that slumlord who restored a decrepit 1930s bungalow (I bought light fixtures at Restoration Hardware, for heaven's sake!), and now rent it to a lovely family. The slumlords in this picture are not the private investors shoring up old properties, but the city officials and other public workers who have degraded the local infrastructure.

Stockton is a historic treasure—a Gold Rush–era city on the edge of the Sacramento–San Joaquin Delta—that has been allowed to fall apart. The salaries and benefit packages of the city's work force are so generous that the city literally can't afford to pay its bills or do its job adequately.

Local officials are quick to blame the real estate crash. A 45-minute drive from the edge of the pricey, growth-controlled San Francisco Bay area, San Joaquin County drew many long-distance commuters in the boom times of the mid-2000s. Stockton and other nearby cities were left devastated when housing prices dropped by as much as 75 percent from the market's height.

But Stockton's bankruptcy revealed a more fundamental problem. Officials for years had spent money like drunken longshoremen who had wandered away from the city's impressive inland port. They sprung for grandiose downtown redevelopment projects (sports venues, a hotel, entertainment) and lavished public employees with pay packages clocking in at 125 percent of state averages, despite living in a comparatively low-priced town. City workers received what one City Council member called a Lamborghini-style health plan, and police and firefighters could take advantage of a "3 percent at 50" pension formula that allowed them to retire at age 50 with 90 percent or more of their final pay.

The high pay levels and health plan were not "vested" benefits, so they were cut during bankruptcy. But Stockton officials chose not to even attempt to give pensioners a haircut.

Even Californians rarely think about Stockton. The weather is blistering hot in the summer and chilly in the winter. It's in a flat agricultural valley known for its polluted air—a blue-collar town, far removed from tonier places like Sausalito and Newport Beach. But even Angelenos have been paying attention to its bankruptcy proceedings, and for good reason.

Since 1999, California cities have been ramping up their pension promises. Unfunded liabilities are soaring. But California's union-dominated legislature, union-friendly governor, and union-supporting state constitutional officers have resisted change. The one reform that passed in 2012 was laughably modest, slightly limiting pensions for new hires and quashing pension spiking. It has already partially been gutted by the California Public Employees' Retirement System (CalPERS), which recently approved 99 categories of pension-spiking for new hires.

The courts have not been open to reform, because of something called the "California Rule," which means that once a pension increase has been granted by a city council or legislature, it can never be reduced. The rule came from a 1955 state Supreme Court ruling in a Long Beach case where the city tried to increase pension contributions. Yet reducing future-earned pension benefits for current employees is the key to reducing current unfunded liabilities. Cities such as Stockton have few other options for paring back costs.

The last chance for a "day of reckoning" is generally bankruptcy court. The thinking is that if a city can at least ditch its pension promises when it goes belly-up, unions will have an incentive to enact reforms before it's too late.

A federal judge in the Detroit, Michigan, bankruptcy case gave that city the go-ahead to cut pensions, but the California Public Employees' Retirement System has argued that California is different, and that state law trumps federal bankruptcy court rulings. CalPERS' argument, effectively, is that pension benefits can never be cut.

Vallejo, California, emerged from bankruptcy in 2011 without cutting pensions and continues to be plagued by fiscal problems. Stockton followed the Vallejo model, balancing its books on the backs of a major creditor (giving it 12 cents on the dollar) while fully protecting pensions. One of the city's own analyses reveals the error of that strategy: Stockton will be in deep financial trouble again within four years. It's nearly impossible to imagine a sustainable path that does not involve at least a slight trimming of pensions.

In a verbal ruling, Judge Christopher Klein, the chief federal bankruptcy judge for eastern California, encouraged reformers by declaring that pensioners are like any other creditor: vulnerable to a payout that is less than the full amount they are owed. But the same judge later OKed Stockton's workout plan, which allows the city to exit bankruptcy without doing anything to fix its biggest problem.

At least one other bankrupt city got the message. San Bernardino, California, which for a time stopped making pension contributions to CalPERS, recently agreed to pay into the retirement system all the money it owes.

The good news is that Judge Klein's first decision allows cities that go bankrupt in the future to try to reduce their pension benefits. The bad news is that his second decision affirms the course that most cities are taking—not trying to do so lest they endure the wrath of local unions and the politically powerful and legally formidable CalPERS.

Now some Democratic officials are talking about limiting the ability of municipalities to file for bankruptcy at all—just in case they want to give pension-paring a try. What can residents do other than watch their cities crumble around them?

It's a sad thing to witness. I bought houses in Stockton not just because they were cheap, but because the city has such wonderful architecture and atmosphere. I'm just an "out-of-town" landlord, but at least I'm investing my retirement money in the city rather than grabbing retirement payouts that deplete its chances of survival.