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

stop processing if updated_deps is empty #8193

Merged
merged 8 commits into from
Oct 24, 2023

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Oct 13, 2023

As part of the work inside Azure DevOps to improve dependabot (see #8179) there were other updates that needed to be split out into their own PR, specifically not continuing with an update if the updated set was empty.

Comment on lines 103 to 105
if updated_deps.empty?
return Dependabot.logger.info(
"No update possible for #{dependency.name} #{dependency.version}"
)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Under what situation can this happen? A test would help

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand either why this is needed. If there's no update possible, we should be returning an :update_not_possible result from the UpdateChecker (a few lines above this).

If that's not happening, that sounds like a bug in the update checking process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We found an instance internally where the NuGet updater errored out and the result was an empty update set. While we fixed the specific issue we had, there still remains the possibility that another updater could also error out and result in an empty set, and that's why we ultimately added this check as well, to prevent the pr creator from crashing. If there is a better place for this check we can certainly move it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see.

I think it makes sense to avoid crashing randomly while trying to create a PR. However, I don't think this is an expected error condition, but a situation that's pointing at a Dependabot bug somewhere.

So, instead of just logging a message, we should be raising an error if this happens. Maybe something like:

raise "Dependabot found some dependency requirements to unlock, yet it failed to update any dependencies"

@ryanbrandenburg ryanbrandenburg force-pushed the dev/brettfo/empty-update branch 2 times, most recently from 770f4d7 to cd0b8ad Compare October 17, 2023 23:55
@github-actions github-actions bot added L: go:modules Golang modules L: python and removed L: go:modules Golang modules L: python labels Oct 17, 2023
@ryanbrandenburg
Copy link
Contributor

I have adjusted the change per your suggestion, added a test for this scenario, and updated the branch. The PR should be ready for re-review.

JoeRobich and others added 2 commits October 19, 2023 09:10
Generating the PR title errors when updated_deps is empty.

Related work items: #2087651
@jakecoffman jakecoffman merged commit 3677631 into dependabot:main Oct 24, 2023
114 checks passed
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.

7 participants