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

Explain update not possible for bundler #2705

Merged
merged 13 commits into from
Nov 4, 2020

Conversation

jurre
Copy link
Member

@jurre jurre commented Oct 30, 2020

This adds a new method blocking_parent_dependencies to UpdateChecker, and implements it for bundler. It does this by traversing the dependency tree and finding all parent dependencies that are not satisfied by the target version.

It also outputs this in the dry-run script as follows:

=== kramdown (1.17.0) (vulnerable 🚨)
 => checking for updates
 => latest available version is 2.3.0
 => earliest available non-vulnerable version is 2.3.0
 => latest allowed version is 1.17.0
 => The update is not possible because of the following conflicting dependencies:
   github-pages (204) which requires:
     kramdown = 1.17.0
   jekyll (3.8.5) which requires:
     kramdown ~> 1.14

@jurre jurre requested a review from a team as a code owner October 30, 2020 12:14
Copy link
Contributor

@brrygrdn brrygrdn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find, 👍🏻

@jurre jurre force-pushed the jurre/improve-bundler-helper-errors branch 6 times, most recently from 7961ad6 to a0a87fc Compare November 3, 2020 21:10
@jurre jurre changed the title Raise descriptive error when update is not possible Explain update not possible for bundler Nov 3, 2020
@jurre jurre force-pushed the jurre/improve-bundler-helper-errors branch 2 times, most recently from 453d73c to 07e5dac Compare November 4, 2020 13:23
Copy link
Contributor

@thepwagner thepwagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - comments are all style/naming nits.

bin/dry-run.rb Outdated Show resolved Hide resolved
bin/dry-run.rb Outdated Show resolved Hide resolved
bin/dry-run.rb Outdated Show resolved Hide resolved
bundler/helpers/lib/functions/force_updater.rb Outdated Show resolved Hide resolved
common/lib/dependabot/update_checkers/base.rb Outdated Show resolved Hide resolved
@jurre jurre force-pushed the jurre/improve-bundler-helper-errors branch from ba2c145 to edd78f1 Compare November 4, 2020 14:47
Copy link
Contributor

@feelepxyz feelepxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this! This looks 💯 🙌

jurre and others added 13 commits November 4, 2020 17:15
Currently we are actually raising a `can't modify frozen NilClass` error
because we attempt to `instance_variable_set` on `nil`, as we try to
find `dependency` in the Gemfile.

This is a small step towards figuring out what dependency is blocking
for an update.
This returns a message from ForceUpdater that explains why a certain
update was not possible, by traversing the dependency tree and finding
all parent dependencies that are not satisfied by the target version.

Few things to improve:
- The message is now formatted in the native helper, I would prefer to
return raw data from there, and leave any formatting to whatever drives
dependabot.
- Because we currently depend on the native helper returning an error,
it is hard to pass data from the native function to dependabot-core.
- We need to call `latest_version_resolvable_with_full_unlock?` in order
to hit the error that sets this new message. I'd prefer to be able to
just call a method on the UpdateChecker instead.
- I dislike having to string compare against the native errors `error_type`, it
would be nice to have more granular errors that we can return from
there.
@jurre jurre force-pushed the jurre/improve-bundler-helper-errors branch from 8cfa8b2 to 2e50b1d Compare November 4, 2020 16:15
@jurre jurre merged commit aa5e415 into main Nov 4, 2020
@jurre jurre deleted the jurre/improve-bundler-helper-errors branch November 4, 2020 16:54
@jurre jurre mentioned this pull request Nov 5, 2020
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

Successfully merging this pull request may close these issues.

4 participants