Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with dry-initializer 2.6.0 #503

Closed
gingerhendrix opened this issue Sep 19, 2018 · 16 comments
Closed

Incompatible with dry-initializer 2.6.0 #503

gingerhendrix opened this issue Sep 19, 2018 · 16 comments

Comments

@gingerhendrix
Copy link

Describe the bug

Attempting to use Commands fails with a Dry::Types::ContraintError

/home/gareth/.rvm/gems/ruby-2.5.1/gems/dry-types-0.12.2/lib/dry/types/constrained.rb:28:in `block in call': nil violates constraints (type?(Symbol, nil) AND included_in?([:create, :update, :delete], nil) failed) (Dry::Types::ConstraintError)

Forcing the previous version of dry-initializer solves the problem.

see: https://github.com/dry-rb/dry-initializer/blob/master/CHANGELOG.md#260-2018-09-09

To Reproduce

Gemfile:

source "https://rubygems.org"

gem "rom"
gem "rom-sql"
gem "sqlite3"

Output of bundle list:

Gems included by the bundle:
  * bundler (1.16.2)
  * concurrent-ruby (1.0.5)
  * dry-configurable (0.7.0)
  * dry-container (0.6.0)
  * dry-core (0.4.7)
  * dry-equalizer (0.2.1)
  * dry-inflector (0.1.2)
  * dry-initializer (2.6.0)
  * dry-logic (0.4.2)
  * dry-struct (0.4.0)
  * dry-types (0.12.3)
  * ice_nine (0.11.2)
  * inflecto (0.0.2)
  * rom (4.2.1)
  * rom-changeset (1.0.2)
  * rom-core (4.2.1)
  * rom-mapper (1.2.1)
  * rom-repository (2.0.2)
  * rom-sql (2.5.0)
  * sequel (5.12.0)
  * sqlite3 (1.3.13)
  * transproc (1.0.2)

Example script from: https://github.com/rom-rb/rom/blob/master/repository/examples/sql.rb

require 'rom-repository'

conf = ROM::Configuration.new(:sql, 'sqlite::memory')

migration = conf.gateways[:default].migration do
  change do
    create_table(:users) do
      primary_key :id
      column :name, String, null: false
      column :email, String, null: false
    end
  end
end

migration.apply(conf.gateways[:default].connection, :up)

class Users < ROM::Relation[:sql]
  schema(infer: true)

  def by_id(id)
    where(id: id)
  end
end

conf.register_relation(Users)
rom = ROM.container(conf)

class UserRepo < ROM::Repository[:users]
  commands :create, update: :by_id, delete: :by_id

  def [](id)
    users.by_id(id).one!
  end

  def all
    users.to_a
  end
end

user_repo = UserRepo.new(rom)

user = user_repo.create(name: 'Jane', email: 'jane@doe.org')

puts user.inspect

Expected behavior

Should run without exceptions.

Workaround

Adding

gem 'dry-initializer', "2.4.0"

and running bundle update solves the problem.

Your environment

  • Affects my production application: NO
  • Ruby version: 2.5.1
@solnic
Copy link
Member

solnic commented Sep 20, 2018

hey @nepalez why did this start breaking?

@flash-gordon
Copy link
Member

@gingerhendrix thanks for reporting

@nepalez
Copy link
Member

nepalez commented Sep 20, 2018

@solnic Sorry, but I can do nothing for now because I’m on vacation without any notebook. I could look at it only in a week. It’s sad, but the only proposal from me for now is locking the dependency at 2.5.0

@timriley
Copy link
Member

@nepalez is there any way you could eg. change your rubygems.org password, from your phone, then privately share it with one of us so that we could log in, grant access to the gem to the rest of the core team, and then we can coordinate the gem yanking/republishing from there?

I imagine this could be done without your laptop?

@nepalez
Copy link
Member

nepalez commented Sep 20, 2018

Hi @timriley
Yes, I could send it you via keybase.io (nepalez as usual)

@timriley
Copy link
Member

@nepalez Great, thank you! I just followed you on key base. tbh I'm not 100% sure how it's meant to work but I am ready to receive your login details.

@nepalez
Copy link
Member

nepalez commented Sep 20, 2018

Bingo! I’ve sent you the creds

@timriley
Copy link
Member

@nepalez Mind checking key base again and letting me into the chat? I had problems with my account and had to reset things 🙄

@nepalez
Copy link
Member

nepalez commented Sep 20, 2018

@timriley done

@timriley
Copy link
Member

@nepalez I'm sorry mate, I seriously can't seem to get keybase to work. Your earlier messages show errors for me and new chat lines I initiate all fail. Can you send me the password in some other way? (at worst, you can use the email listed on my GitHub profile)

@timriley
Copy link
Member

Or maybe you could try the standard keybase plain message encryption: https://keybase.io/encrypt

@timriley
Copy link
Member

@nepalez You may need to "refresh" my profile on keybase since I set it up with a new key/proof earlier.

@timriley
Copy link
Member

@nepalez I have to go to sleep now. Can you please coordinate the password exchange with @solnic or @flash-gordon? It'd be good to get this resolved properly today.

@solnic
Copy link
Member

solnic commented Sep 20, 2018

FYI I just pinged @nepalez on keybase

@nepalez
Copy link
Member

nepalez commented Sep 20, 2018

@solnic I’ve sent the creds to you on the keybase

@timriley
Copy link
Member

I've yanked dry-initializer 2.6.0 and have updated its CHANGELOG accordingly.

I'll open another issue on dry-initializer to start discussion around the best way to release the breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants