September 03, 2025 · Read time: 1 min

In reply to: @dcrossney@ruby.social

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!

2 Damian C. Rossney Tim Riley

Chatter

Damian C. Rossney @dcrossney@ruby.social September 4, 2025 at 1:22 PM
@stephanhagemann.com I've been struggling to finish an article of my own. ???? I started to write it after reading the Packwerk Retrospective article and Eileen Uchitelle's conference talk. I'm writing mostly to put my own thoughts in order. But when it's done. I'd like to share it on the Rails...

These are webmentions via the IndieWeb. Mention this post from your site:


Except where otherwise noted, content on stephanhagemann.com is licensed under CC BY 4.0 by Stephan Hagemann