But I'm trying to muddle out what VW did. Did they just switch programs for the EPA emission test cars and then run a higher performance program in the production cars?
No, the engine control software is the same and somehow (there are innumerable ways to accomplish this) operates differently on the road than in the test cell. It’s NOT clear if it meets emissions while while driving on city streets in LA and doesn’t while driving in the mountains surrounding the Basin enough to have somehow annoyed the EPA (and CARB, I assume).
They evidently ran a program that sensed the OBD2 port in use and defaulted to a cleaner tune.