How Foreman works with Puppet modules and classes?

Hello! We have faced an interesting issue with import of puppet modules and classes. I wonder if it is normal behavior or I do something wrong?

Problem:
We store puppet classes and modules in our local Gitlab and Artifactory and download them to Puppet with a r10k tool. After that script triggers Foreman api endpoint to import environments from puppet.
So the problem is in case when module wasn’t downloaded from Artifactory or Gitlab (due of network errors or any other reasons not related to Foreman).
Foreman after environment import deletes all of the smart class parameters and overrides related to this module, but the classes from this module are still exists in Foreman.
Next when module was successfully downloaded from external storage, and imported to Foreman from Puppet, smart class parameter appears but without any overrides that I have made in Foreman before.

Foreman and Proxy plugin versions:
We use Foreman 1.24 and Puppet 5, but I could reproduce this case in Foreman 3.2 and Puppet 6.

So, I want to figure out if it was normal behavior of Foreman or I faced some bugs? Is there any way to delete both smart class parameters and classes if module is missing in Puppet proxy? Is there any best practices to avoid such issues with environment import process.

Did you follow the manual?
https://docs.theforeman.org/3.2/Managing_Configurations_Puppet/index-katello.html#Enabling_Puppet_Integration_managing-configurations-puppet

Hello! Thanks for your reply. But my queston is about slightly different things.
Is it OK that the Foreman deletes all of class parameters and classes itself if corresponding puppet module is missing on puppet server when I import an environment?