Summary
In workos 7.0.0, any call to Zeitwerk::Loader.eager_load_all crashes with NameError: uninitialized constant WorkOS::Inflections. This breaks Rails production boot when config.eager_load = true and any tooling that globally
eager-loads (e.g. Tapioca, Sorbet setup).
Reproduction
gem install workos -v 7.0.0
ruby -rworkos -e 'Zeitwerk::Loader.eager_load_all'
Output:
…/zeitwerk-2.7.5/lib/zeitwerk/cref.rb:62:in 'Module#const_get':
uninitialized constant WorkOS::Inflections (NameError)
@mod.const_get(@cname, false)
Expected
eager_load_all succeeds.
Actual
It raises because the gem's Zeitwerk loader expects lib/workos/inflections.rb to define WorkOS::Inflections, but the file
actually defines a top-level WORKOS_INFLECTIONS constant (which is then passed to loader.inflector.inflect(...)).
Proposed fix
Ignore inflections.rb in the loader setup, right next to the existing errors.rb ignore in lib/workos.rb:
loader.ignore("#{__dir__}/workos/errors.rb")
loader.ignore("#{__dir__}/workos/inflections.rb") # add this
loader.setup
The file is already loaded explicitly via require_relative "workos/inflections" earlier in lib/workos.rb, so ignoring it in
Zeitwerk is the correct pattern.
Environment
- workos 7.0.0
- zeitwerk 2.7.5 (latest)
- Ruby: 4.0.2
Summary
In
workos7.0.0, any call toZeitwerk::Loader.eager_load_allcrashes withNameError: uninitialized constant WorkOS::Inflections. This breaks Rails production boot whenconfig.eager_load = trueand any tooling that globallyeager-loads (e.g. Tapioca, Sorbet setup).
Reproduction
gem install workos -v 7.0.0 ruby -rworkos -e 'Zeitwerk::Loader.eager_load_all'Output:
Expected
eager_load_allsucceeds.Actual
It raises because the gem's Zeitwerk loader expects
lib/workos/inflections.rbto defineWorkOS::Inflections, but the fileactually defines a top-level
WORKOS_INFLECTIONSconstant (which is then passed toloader.inflector.inflect(...)).Proposed fix
Ignore
inflections.rbin the loader setup, right next to the existingerrors.rbignore inlib/workos.rb:The file is already loaded explicitly via
require_relative "workos/inflections"earlier inlib/workos.rb, so ignoring it inZeitwerk is the correct pattern.
Environment