Strange dry-validation / dry-schema bug

Ran into this NilClass exception coming from dry-logic, via dry-schema and dry-valiation.

Code in question: https://github.com/ronin-rb/ronin-app/blob/e7b0b7880f1e5c41a29750596d951ba6b0bb35f1/lib/ronin/app/validations/recon_params.rb#L41-L62
Spec Failure: allow `ignore` to be empty since it's submitted via an HTML form. · ronin-rb/ronin-app@e7b0b78 · GitHub

  1) Ronin::App::Validations::ReconParams rules :ignore must allow an empty value for :ignore
     Failure/Error:
       result = subject.call(
         {
           scope:  'example.com',
           ignore: ''
         }
       )

     NoMethodError:
       undefined method `map' for nil:NilClass
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/each.rb:12:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/and.rb:23:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/key.rb:37:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/implication.rb:19:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/rule_applier.rb:30:in `block in call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/rule_applier.rb:27:in `each'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/rule_applier.rb:27:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/step.rb:34:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor_steps.rb:38:in `block in call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor_steps.rb:36:in `each'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor_steps.rb:36:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor.rb:79:in `block in call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/result.rb:35:in `new'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor.rb:78:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-validation-1.10.0/lib/dry/validation/contract.rb:98:in `call'
     # ./spec/validations/recon_params_spec.rb:69:in `block (4 levels) in <top (required)>'

I am not sure what is trigger the exception or why. Obviously this needs some guard logic or a better exception message.

Versions:

  • dry-core (1.0.1)
  • dry-types (1.7.1)
  • dry-logic (1.5.0)
  • dry-schema (1.13.3)
  • dry-validation (1.10.0)