If a statefile had resources with the same name in different modules, the sort order could be inconsistent between state refreshes. This adds the module to the Less() function used in sorting and a minimal test to verify consistent ordering.