-
Notifications
You must be signed in to change notification settings - Fork 994
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
make DependencySnapshot aware of multiple directories #8963
Merged
jakecoffman
merged 19 commits into
main
from
jakecoffman/fix-dependency-snapshot-multidir
Feb 23, 2024
Merged
make DependencySnapshot aware of multiple directories #8963
jakecoffman
merged 19 commits into
main
from
jakecoffman/fix-dependency-snapshot-multidir
Feb 23, 2024
Conversation
This file contains 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
# Conflicts: # updater/lib/dependabot/dependency_snapshot.rb
This reverts commit e7acca0.
Looking at the smoke test failures, it looks like this fixes some issues, and the setup was wrong on two of them so dependabot/smoke-tests#185 fixes that up. I think this is good to go! |
jurre
reviewed
Feb 14, 2024
jurre
reviewed
Feb 14, 2024
I'll fix the smoke tests once I start deploying, all the failures look correct, if that makes sense. |
jurre
approved these changes
Feb 23, 2024
1 task
5 tasks
5 tasks
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 PR refactors DependencySnapshot to be aware of multiple directories.
Why
Previously DependencySnapshot would take all of the dependency files and attempt to parse them to discover the dependencies. This breaks down with multi-dir, as really what we need to do is group the files by directory and then parse them, storing the dependencies for each directory separately.
Also, we need to keep track of
handled_dependencies
per directory as well or we end up thinking we've handled it in one directory, but when we encounter the same dependency in another directory then we've missed an update. Previously I was clearing thehandled_dependencies
between directories, but then the problem is we are dropping individual PRs that should have been created.Approach
For now I've encapsulated multi-dir support inside of DependencySnapshot by using
@current_directory
as a way to set which directory is currently being operated on. This prevents multi-dir from rippling out into the other non-group operations.The group operations will set
dependency_snapshot.current_directory(dir)
which then makes all of the pre-existing methods continue to work as they always have.If I had made all of the methods take a directory param instead I would have had to touch many many more files and specs (I started down this path at first and it was overwhelming!)
Admittedly this looks a bit complex, but I hope getting integration tests down outside of Ruby/rspec will allow us to take a bold refactor to make it all much simpler in the end.