my best guess is that the facts wire format is not...
# puppet
h
my best guess is that the facts wire format is not including the environment key some times and so puppetdb just stores the default value of production