dry-rb / dry-configurable

A simple mixin to make Ruby classes configurable
https://dry-rb.org/gems/dry-configurable/
MIT License
410 stars 56 forks source link

0.16.0 breaks Zeitwerk integration for other gems #156

Closed Azdaroth closed 2 years ago

Azdaroth commented 2 years ago

Describe the bug

I'm not sure if this is exactly the problem of dry-configurable or karafka, but bumping the version from 0.15.0 to 0.16.x causes the issue.

I'm using dry-configurable and karafka 1.4x. After the update to 0.16.x, this is what I get when running bundle exec karafka server:

/Users/karol/.rvm/gems/ruby-3.1.2/gems/karafka-1.4.13/lib/karafka/server.rb:6:in `<class:Server>': uninitialized constant Concurrent::Array (NameError)

    @consumer_threads = Concurrent::Array.new
                                  ^^^^^^^
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/karafka-1.4.13/lib/karafka/server.rb:5:in `<module:Karafka>'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/karafka-1.4.13/lib/karafka/server.rb:3:in `<top (required)>'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:27:in `require'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:27:in `require'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb:127:in `const_get'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb:127:in `cget'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader.rb:239:in `block (2 levels) in eager_load'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb:41:in `block in ls'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb:27:in `each'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb:27:in `ls'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader.rb:234:in `block in eager_load'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader.rb:219:in `synchronize'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.1/lib/zeitwerk/loader.rb:219:in `eager_load'
  from <internal:kernel>:90:in `tap'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/karafka-1.4.13/lib/karafka.rb:70:in `<top (required)>'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/karafka-1.4.13/bin/karafka:3:in `require'
  from /Users/karol/.rvm/gems/ruby-3.1.2/gems/karafka-1.4.13/bin/karafka:3:in `<top (required)>'
  from /Users/karol/.rvm/gems/ruby-3.1.2/bin/karafka:25:in `load'
  from /Users/karol/.rvm/gems/ruby-3.1.2/bin/karafka:25:in `<main>'
  from /Users/karol/.rvm/gems/ruby-3.1.2/bin/ruby_executable_hooks:22:in `eval'
  from /Users/karol/.rvm/gems/ruby-3.1.2/bin/ruby_executable_hooks:22:in `<main>'

Based on the changelog, it looks like Zeitwerk has been recently introduced so probably it's related to that, but don't know yet what exactly went wrong that causes the issue for concurrent-ruby.

solnic commented 2 years ago

This is a missing require in karafka. It used to work because dry-configurable used to depend on concurrent and now it's not the case so it exposed a missing require in karafka as a side-effect. Nothing to do on our side so I'm gonna close this one.