sequencing bug in Dry::AutoInject when using Dry::Configurable

Hi Folks, I discovered a small bug today when combining auto inject and instance level config with dry configurable. it seems to be a sequencing issue but I’m not sure which gem should behave more politely:

versions:

Dry::Configurable::VERSION #=> "0.16.0"
Dry::AutoInject::VERSION #=> "0.9.0"

scenario: I have a namespace with a registered container and auto injector

class SomeContainer
  extend Dry::Container::Mixin

  register :logger do
    Logger.new(STDOUT)
  end
end

Import = Dry::AutoInject(SomeContainer)

I have a class that uses dry configurable for the instance

class SomeClass
  include Dry::Configurable

  setting :some_config
end

instance = SomeClass.new
instance.config.some_config = "some value"

In my experience today I discovered that when I also use the auto injector, the order matters:

class SomeClass
  include Dry::Configurable
  include Import["logger"]
end

fails with :

ArgumentError: wrong number of arguments (given 1, expected 0)
from .asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/dry-auto_inject-0.9.0/lib/dry/auto_inject/strategies/kwargs.rb:71:in `initialize'

the opposite works as expected

class SomeClass
  include Import["logger"]
  include Dry::Configurable
end

I could probably work on a fix, in Dec, I just need some guidance in terms of where you folks would want the contribution (which gem). Thanks!

I’ve noted a similar order-dependence between Dry::Monads::Do and Dry::Matcher.

I believe I have also encountered order-dependence between Dry::AutoInject and Dry::Initializer.