Initial structure of per-scope constraint.

Add some on-create module validation to ensure that modules can't have invalid specification of scopes on them.

Implement mixed scope test.