Lib folder classes automatically public when privacy enabled

Hi,

We’ve started experimenting the PackwerkExtensions Privacy functionality. We would like to try the “sigil” approach because we don’t want to be constrained to everything public living in a single folder.

Relatedly, we would like to be able to mark classes in the “lib” folder as public…but instead we found that everything that isn’t autoloaded is automatically public, which is undesirable for us.

I’m curious if anyone else has run into this. Should we try to autoload “lib” for a pack when Packwerk check is running?

Thanks,
Sarah

Update:

I suspect that this is because our pack lib folders are not autoloaded by Rails, and so remain as UnresolvedReferences, which are not in the mappings, and thus wouldn’t get labeled as private.

I’m curious if everyone else autoloads their pack lib folders?

I believe we switched to autoloader lib folders with the update to Rails 7.1 (and its lib autoloading change).

crates.io: Rust Package Registry, with the experimental parser, could be around this problem.

1 Like

Thanks, for sharing, Stephan. And thanks for the article, that’s a great summary.