-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update to inherit from correct Faraday error #1154
Update to inherit from correct Faraday error #1154
Conversation
The update to Faraday is causing `require "octokit"` to break. Updating to `Faraday::ClientError` fixes it and is correct based on Faraday code: https://github.com/lostisland/faraday/blob/master/lib/faraday/error.rb
Looks like the failed test is flaky given that it is to do with caching and unrelated to my change? 🤞 |
This will then assume that Faraday version is 0.16.0 and up. Some sort of fallback is more desirable. |
@gas You could add faraday as dependency to the gemspec with |
v0.15.0 uses this organization but has an alias that allows it to still work. This organization has been the current one since at least 0.9.0 (which was a long-standing release). They just removed the backwards-compatibility with 0.16.0. I suggest this change be merged. |
Specifically, it's this commit where they remove the aliases (see here for the specific lines). |
If the change was present in Faraday v0.9.0, then we would only need to update the gemspec with |
@avondohren I agree, currently "> 0.8" is required. Added |
Faraday has been maintaining a backward-compatibility layer for errors in the `Faraday::Error::` "namespace". These were removed with v0.16.0, which caused issues for dependents that use semantic versioning constraints. It would be best if these were deprecated with a warning message and then dropped in v1.0 in order to make sure transitive dependencies do not break. See octokit/octokit.rb#1154
Faraday has been maintaining a backward-compatibility layer for errors in the `Faraday::Error::` "namespace". These were removed with v0.16.0, which caused issues for dependents that use semantic versioning constraints. It would be best if these were deprecated with a warning message and then dropped in v1.0 in order to make sure transitive dependencies do not break. See octokit/octokit.rb#1154
Faraday has been maintaining a backward-compatibility layer for errors in the `Faraday::Error::` "namespace". These were removed with v0.16.0, which caused issues for dependents that use semantic versioning constraints. It would be best if these were deprecated with a warning message and then dropped in v1.0 in order to make sure transitive dependencies do not break. See octokit/octokit.rb#1154
I submitted a patch to restore the backward-compatibility layer to Faraday's 0.16.x releases. I think they want to drop it for 1.0 so this change should still be merged into Octokit. |
octokit.gemspec
Outdated
@@ -6,6 +6,7 @@ require 'octokit/version' | |||
Gem::Specification.new do |spec| | |||
spec.add_development_dependency 'bundler', '>= 1', '< 3' | |||
spec.add_dependency 'sawyer', '>= 0.5.3', '~> 0.8.0' | |||
spec.add_dependency 'faraday', '>= 0.9', '< 2.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will pick up v0.16.0, which is the affected version. I think we just want to change the constant.
spec.add_dependency 'faraday', '>= 0.9', '< 2.0' | |
spec.add_dependency 'faraday', '>= 0.9' |
If we want a version constraint, we want it as permissive as possible.
@Gasparila thanks for the PR, am I right in thinking that requiring Faraday At least that's how I understand what I'm reading on https://rubygems.org/gems/sawyer/versions/0.8.1 |
@tarebyte it looks like Sawyer supported 0.9 since version 0.1 (https://rubygems.org/gems/sawyer/versions/0.1.0) The |
TIL I have no idea how Rubygems short hand works. If you wouldn't mind accepting #1154 (comment) I think this'll be good to merge. Thanks ✨ |
Hmmm I disagree that we should be permissive of major version bumps, and all of the other dependencies specify a cap of the next major version. Originally, I had |
@Gasparila IMO you shouldn't restrict versions on the upperside unless you know for sure that a new version of the dependency is going to break something that this package uses. If you leave the top open, then you allow folks using this along with other gems that have the same dependency to keep upgrading. Once a breaking change is released, then you cap the upper bound if you need to as a patch release, or release a compatibility fix as appropriate. |
…ctokit.rb into kevin/fix_faraday_inheritance
Or you don't notice it and then your gem is broken, necessitating another PR like this one 😉 Regardless, I care most about getting this fixed so updated in d4d77dc |
In this case, the Faraday maintainers leaned into the "less than 1.0 means all bets are off" clause of SemVer. 😁 Because Faraday is such a common "plumbing" gem that ends up being a transitive dependency across libraries, I've found that keeping it with a relaxed constraint leads to a better user experience -- even when they break API compatibility -- because it avoids dependency hell where you have to fork it to unblock unrelated gem updates. |
Faraday has been maintaining a backward-compatibility layer for errors in the `Faraday::Error::` "namespace". These were removed with v0.16.0, which caused issues for dependents that use semantic versioning constraints. It would be best if these were deprecated with a warning message and then dropped in v1.0 in order to make sure transitive dependencies do not break. See octokit/octokit.rb#1154
Any update on this PR, whats needed or what it needs to be merged , I'm using slack-ruby-client and this gem which is in a dependency loop until this is solved by one or all of the gems. Really don't want to fork my production deployment if possible. |
@acidprime try a |
Interesting, I tried pinning the following and I'm still getting the error ruby '2.5.1'
source 'https://rubygems.org'
gem 'async-websocket', '~>0.8.0'
gem 'aws-sdk', '3.0.1'
gem 'faraday','0.16.2'
gem 'octokit', '4.13.0'
gem 'rugged', '0.27.5'
gem 'sawyer', '0.8.0'
gem 'slack-ruby-bot', :git => 'https://github.com/slack-ruby/slack-ruby-bot.git' gets me NameError: uninitialized constant Faraday::Error::ClientError
Did you mean? Faraday::ClientError
/usr/local/bundle/gems/octokit-4.13.0/lib/octokit/middleware/follow_redirects.rb:14:in `<module:Middleware>'
/usr/local/bundle/gems/octokit-4.13.0/lib/octokit/middleware/follow_redirects.rb:11:in `<module:Octokit>'
/usr/local/bundle/gems/octokit-4.13.0/lib/octokit/middleware/follow_redirects.rb:9:in `<top (required)>'
/usr/local/bundle/gems/octokit-4.13.0/lib/octokit/default.rb:1:in `require'
/usr/local/bundle/gems/octokit-4.13.0/lib/octokit/default.rb:1:in `<top (required)>'
/usr/local/bundle/gems/octokit-4.13.0/lib/octokit.rb:4:in `require'
/usr/local/bundle/gems/octokit-4.13.0/lib/octokit.rb:4:in `<top (required)>' |
And you're 100% sure you ran |
Its all ran in docker with no cache, so there is no "update" that would be relevant I believe. |
... until octokit has an actual release. See: octokit/octokit.rb#1154
This can be removed when octokit release a new version with octokit/octokit.rb#1154
Without this, we get failing builds with: ``` NameError: uninitialized constant Faraday::Error::ClientError Did you mean? Faraday::ClientError ``` This is documented in octokit/octokit.rb#1154.
Without this, we get failing builds with: ``` NameError: uninitialized constant Faraday::Error::ClientError Did you mean? Faraday::ClientError ``` This is documented in octokit/octokit.rb#1154.
The update to Faraday is causing
require "octokit"
to break. Updatingto
Faraday::ClientError
fixes it and is correct based on Faraday code:https://github.com/lostisland/faraday/blob/master/lib/faraday/error.rb
Before:
After: