I've written a few notes at
about the use of registry-type objects in Foreman that hold global state
through class variables or singletons. It lists some of the problems
they introduce and some basic notes about how to rewrite/remove them.
If you're writing or reviewing code, please look out for them and try to
prevent new ones being introduced. This should help prevent new types of
test failures, reloading bugs in development and make code more testable.
Existing ones remain in app/registries/ until they're refactored, an
autoload_once version of app/services/.