Environment leakage is one of the limitations of puppet environments.
Use one of the following methods to avoid environmental leakage:
For resource types, you can avoid environment leaks with the the puppet generate types command. This command generates resource type metadata files to ensure that each environment uses the right version of each type.
This issue occurs only with the Puppet::Parser::Functions API. To fix this, rewrite functions with the modern functions API, which is not affected by environment leakage. You can include helper code in the function definition, but if helper code is more complex, it should be packaged as a gem and installed for all environments.
Report processors and indirector termini are still affected by this problem, so put them in your global Ruby directories rather than in your environments. If they are in your environments, you must ensure they all have the same content.