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

Hanami-DB 2.2 is not compatible with rom-repository 5.4 #698

Closed
wuarmin opened this issue Jan 9, 2025 · 3 comments
Closed

Hanami-DB 2.2 is not compatible with rom-repository 5.4 #698

wuarmin opened this issue Jan 9, 2025 · 3 comments

Comments

@wuarmin
Copy link

wuarmin commented Jan 9, 2025

Describe the bug

Due to yesterday's refactoring in repository/relation_reader.rb, the method ROM::Repository#set_relation, which is used in hanami/db, no longer exists. It was renamed to prepare_relation.

https://github.com/hanami/db/blob/344a14933f7e1c66304f353119d3467d15ae997e/lib/hanami/db/repo.rb#L43

To Reproduce

bundle update
bundle exec rspec spec/slices/my_slice/repos/user_repo_spec.rb

Backtrace:

 NoMethodError:
       undefined method 'set_relation' for an instance of MySlice::Repos::UserRepo
     # /usr/local/bundle/gems/hanami-db-2.2.0/lib/hanami/db/repo.rb:42:in 'Hanami::DB::Repo#initialize'
     # /usr/local/bundle/gems/rom-repository-5.4.0/lib/rom/repository/class_interface.rb:70:in 'Class#new'
     # /usr/local/bundle/gems/rom-repository-5.4.0/lib/rom/repository/class_interface.rb:70:in 'ROM::Repository::ClassInterface#new'
     # /usr/local/bundle/gems/hanami-2.2.1/lib/hanami/extensions/db/repo.rb:72:in 'block in define_new'
     # /usr/local/bundle/gems/hanami-2.2.1/lib/hanami/extensions/db/repo.rb:72:in 'block in define_new'
     # ./spec/slices/my_slice/repos/user_repo_spec.rb:17:in 'block (4 levels) in <top (required)>'

@flash-gordon What's the best way to bring back set_relation? Renaming prepare_relation to set_relation would fix the issue.

At the moment, every Hanami-db-app, which updates deps will run into this error.
It should be noted that set_relation was marked as a private api.

thanks

@wuarmin wuarmin changed the title Hanami 2.2 is not compatible with rom-repository 5.4 Hanami-DB 2.2 is not compatible with rom-repository 5.4 Jan 9, 2025
@flash-gordon
Copy link
Member

@wuarmin, thanks for reporting! Yes, since it was marked as private, I didn't think it was in use. We can then add an alias and deprecate it. I'll take a look later today and cut a release.

flash-gordon added a commit that referenced this issue Jan 9, 2025
It was part of private API used by hanami/db. This marks prepare_relation as replacement
flash-gordon added a commit that referenced this issue Jan 9, 2025
It was part of the private API used by hanami/db. This marks prepare_relation as a replacement
flash-gordon added a commit that referenced this issue Jan 9, 2025
It was part of the private API used by hanami/db. This marks prepare_relation as a replacement
@flash-gordon
Copy link
Member

@wuarmin I pushed rom-repo + rom 5.4.1 with deprecation and submitted a patch to hanami hanami/db#16

@wuarmin
Copy link
Author

wuarmin commented Jan 9, 2025

@flash-gordon thanks for the quick fix. It works now, and I see the deprecation.

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

No branches or pull requests

2 participants