Conversation
Base automatically changed from
brrygrdn/extract-updater-error-responsibility
to
main
March 16, 2023 10:37
a688cea to
6083e09
Compare
Contributor
Author
|
I've added one additional commit which uses the new class to push the The Service being responsible for serialising a business object ( DependencySnapshot ) for the ApiClient feels more correct and moves another private method unto an explicit receiver so operation classes can access it without duplicating it. It makes more sense to do that as part of this PR than in a follow up. |
landongrindheim
approved these changes
Mar 17, 2023
Contributor
landongrindheim
left a comment
There was a problem hiding this comment.
Looks good to me! 🚀
updater/lib/dependabot/service.rb
Outdated
updater/lib/dependabot/updater.rb
Outdated
9baa4df to
6732de2
Compare
6732de2 to
f8f2fa2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is another clear-the-way PR for #6663 [Prototype] Generating grouped update PRs.
Depends on #6846
A Dependabot update process has three broad steps:
Currently, step(1) is performed as a single command so we do not need to provide repository credentials to the Update step and it hands files over to step(2) by encoding them into a 'job definition' along with the workload description it used to fetch them.
As we start to break the
Dependabot::Updaterclass out into a set of components we can compose to create grouped updates, one difficulty is that step(2) is performed lazily insideDependabot::Updater#dependencieswhich ostensibly functions like a getter method but in reality mixes the responsibility of parsing the files with filtering them according to the update strategy to be performed.Changes
This PR introduces a new
DependencySnapshotobject which encapsulates the responsibility of retrieving and decoding the files from step(2) and correctly hydrating them intoDependabot::Dependencyobjects to result in a value class which describes the starting state of the update.Rationale
This value class is used like a shim right now, with the parsing still being performed lazily inside
Dependabot::Updater#dependenciesin order to minimise the blast radius of refactoring the code, so initially it only provides value by reducing the number of argumentsDependabot::Updaterrequires, but it sets us up for two fast-follows:Dependabot::Updaterclass responsibilities which accept this object as an argument and proactively evaluate it to start refactoring the call site and flushing out assumptions about performing the parse/filter in a single method.Dependabot::Updaterand make it easier to reason about.