-
Notifications
You must be signed in to change notification settings - Fork 926
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
[Grouped Updates] Refactor the DependencyGroupEngine into an object, Improved logging for empty groups #7548
Conversation
LGTM other than the smoke test failures, makes sense 👍 |
The remaining smoke test failure is actually an issue with the test rig, which I've fixed here: dependabot/smoke-tests#103 This does make me 🤔 about the decision to always parse the group configuration immediately after parsing dependencies in every job as some jobs may not actually involve using the groups like rebases but I think the problem here was ultimately a mandatory array being nil which is a defect we won't see in the real world. We could push the evaluation of groups later but since it only warns it still seems better to me to perform it at the same call sight as evaluating the manifests and parsing dependencies. In future it might make sense to move the operation split up so we don't bother parsing the files when we are told to update a specific dependency/and or rebase a PR? |
715ff71
to
e7804f5
Compare
@jakecoffman This should be good to go now |
e7804f5
to
15beeeb
Compare
…dependency-group-engine [Grouped Updates] Refactor the DependencyGroupEngine into an object, Improved logging for empty groups
Addresses #7075 (comment)
We currently implement the
DependencyGroupEngine
as a module which uses class variables to act a little like a singleton as we weren't sure how it would be injected into the Updater when we created it so we defaulted to global scope.With much of the architecture now settled, it makes sense to move away from this global object to instantiate it immediately after we parse the project's manifest files when creating a the
DependencySnapshot
This ensures that any fatal issues parsing the rules can be handled here:
dependabot-core/updater/lib/dependabot/update_files_command.rb
Lines 15 to 25 in 779657e
Improved handling of empty groups
Right now we quietly swallow any groups which are defined but do not correspond to any dependencies which means we fail over to doing single updates without calling out why the group wasn't attempted.
As part of this work, it became much easier to warn during the job startup when we find an empty group, which results in us logging a message like:
At runtime, we will now acknowledge the empty groups exist and specifically log that we are skipping them like so:
Rebasing
It is possible for us to find when rebasing a grouped PR that the group definition has now become empty due to all dependencies matching the group having been removed.
Rather than the job being a silent no-op, we will now close the pull request with the following comment:
TODO
dependency_group_empty
close reason