In reply to:
Can you talk a little more about managing the “hidden” coupling of two packs using the same ActiveRecord model?
Good question!
There are indeed some subtleties when it comes to ActiveRecord. However, just because it is ActiveRecord does not mean it is invisible to Packwerk (note that I have been using pks for a couple of years now). If two packs refer to the constant, at least one of them is going to have a dependency or a violation. Associations are parsed and surfaced by Packwerk, so there is at least some visibility for those too.
If you use Sorbet or some other way of typing parts of your app, you will have less hidden models in the areas where you use it.
Your post assumes they don’t [exist] (it seems), but this sounds like a common occurrence in discussions of Packwerk that I’ve seen.
I, indeed, did not talk about this as a problem because it is simply a limitation of the way Packwerk does its work that it doesn’t “see” all dependencies. When Shopify’s Gannon McGibbon and Chris Salzberg published A Packwerk Retrospective I got a lot of questions and comments suggesting that this was the nail in the coffin of Packwerk. I don’t think it is … if we use it in a way where we’re clear about what we want to use the tool for.
I’ve been meaning to write my own Packwerk retrospective. Your question is an encouragement to do so!
Chatter
Please do! I see those two things as a package too and want to reflect on both of them. I’ll race you :D
Note that we moved from the Ruby/Rails modularity slack to https://rubyrailsmodularity.com.
These are webmentions via the IndieWeb. Mention this post from your site: