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

revert changes to DependencyGroupChangeBatch #10228

Merged
merged 3 commits into from
Jul 17, 2024
Merged

Conversation

jakecoffman
Copy link
Member

@jakecoffman jakecoffman commented Jul 17, 2024

What are you trying to accomplish?

Reverting #9988 to see if anything breaks. The changes seem like they don't change behavior at all.

I came across this code while investigating rebase command issues.

Anything you want to highlight for special attention from reviewers?

DependencyGroupChangeBatch is only used here:

group_changes = Dependabot::Updater::DependencyGroupChangeBatch.new(
initial_dependency_files: dependency_snapshot.dependency_files
)

This method is already in the context of a single directory, so really there should only be one directory in this DependencyGroupChangeBatch. Also the updated_dependencies are never read, except to transform into a DependencyChange which is what gets returned.

The directory is actually set on the dependencies once the DependencyChange is initialized:

ensure_dependencies_have_directories

So this is why I think this change isn't needed. I think perhaps the thought here was to propagate it from this point instead of setting it in the DependencyChange.

How will you know you've accomplished your goal?

Nothing breaks!

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@jakecoffman jakecoffman marked this pull request as ready for review July 17, 2024 11:59
@jakecoffman jakecoffman requested a review from a team as a code owner July 17, 2024 11:59
@jurre
Copy link
Member

jurre commented Jul 17, 2024

What exactly does "nothing breaks" mean here? Where would we look for things breaking?

@jakecoffman
Copy link
Member Author

jakecoffman commented Jul 17, 2024

I was hoping to see a test fail. I can't tell how this change makes any functional difference so I'm not sure how exactly to verify that.

From the original PR:

For now this PR should have no effect, even when the feature flag is toggled.

🤷 I guess we didn't need this, I don't see a follow up PR that uses this change

@jakecoffman
Copy link
Member Author

I just confirmed that it's this test which verifies the behavior this fix was trying to solve:

-- input-preexisting.yml --
job:
package-manager: "silent"
source:
directories:
- "/foo"
- "/bar"
provider: example
hostname: example.com
api-endpoint: https://example.com/api/v3
repo: dependabot/smoke-tests
dependency-groups:
- name: all
rules:
patterns:
- "*"
existing-group-pull-requests:
- dependency-group-name: all
dependencies:
- dependency-name: dependency-a
dependency-version: 1.2.5
directory: "/foo"
- dependency-name: dependency-b
dependency-version: 2.2.5
directory: "/foo"
- dependency-name: dependency-b
dependency-version: 2.2.5
directory: "/bar"
- dependency-name: dependency-c
dependency-version: 3.2.5
directory: "/bar"
experiments:
dependency_has_directory: true

It still works without this code so therefore this change is not needed.

@jakecoffman jakecoffman merged commit d8cdcbc into main Jul 17, 2024
121 checks passed
@jakecoffman jakecoffman deleted the revert-batch-changes branch July 17, 2024 18:04
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.

3 participants