Most Modular Monoliths I have worked on started with boundaries everyone agreed on in a design session. A few months later someone needs a customer's credit limit inside Payments, the internal class that holds it is one import away, and the pull request goes through because nothing in the build objects. Nothing physically stops a module from reaching into another module's internals, so the boundary holds only as long as every developer on every change decides it should.
Architecture tests move that decision into the build. On JVM codebases I have used three ways of doing it: writing the rules directly in ArchUnit, adopting Spring Modulith's verification, and Modulith Rules, the rule set I maintain.…