#4477 introduced a new mechanism for scoping that is somewhat related to the way we handling testing package for codegen.
There's a bit more work to be done here to still be able to override the output location of a scope, at which point these can be fully reconciled.