I have been discussing the need for some duplicate detection rules for our custom entities with a client. I created them. I published them. I tested them, they worked great, and I deleted the duplicate records in our test environment.
A few days later the testers noticed there were new duplicates in the system, so I checked and the duplicate detection rules I had created were unpublished in our UAT (User Acceptance Test) environment. I assumed I’d forgotten to publish the rules after I created them in our UAT environment, so I published them (again) and cleaned up the data manually (again).
The next day, I imported and published the new set of customizations I’d been working on from my development environment to UAT. When the testers went in to test the new customizations, they noticed that duplicates were being introduced in the system (yet again).
Sure enough, when I looked at the duplicate detection rules, they were unpublished (again). This time, I knew I’d published them previously and investigated more deeply. I discovered this is expected behavior. By design, whenever any entity metadata is changed all duplicate rules associated with that entity are unpublished.
Therefore, make sure you add a new step to your deployment scripts, when you verify the changes that you made transferred correctly, you should also make sure that the duplicate detection rules are all published.