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

[Updater] The Updater always expects job.dependency_groups to be defined #7216

Merged
merged 5 commits into from
May 4, 2023

Conversation

brrygrdn
Copy link
Contributor

@brrygrdn brrygrdn commented May 2, 2023

As we start to test configured Dependency Groups, we no longer need to rely on the Updater handling empty dependency groups by failing over to a "group everything in one PR" placeholder rule.

The service is now responsible for injecting this in places where it is required, otherwise we should treat an empty job.dependency_groups as a sign the feature is not being invoked since this is the target production behaviour.

Removing it now will avoid any debugging confusion as we start to test more widely.

Other Changes

As part of making this change I migrated the test that verifies that the GroupUpdateAllVersions class handles mixes of grouped and ungrouped dependencies properly from the "legacy" updater_spec.rb into the class-specific test.

This lead on to a further change in DependabotSnapshot#ungrouped_dependencies as it was surprising to find this set empty where no groups were defined.

I've added a guard clause to return the full list of allowed_dependencies when DependabotSnapshot#groups are empty so it can be asserted against in tests consistently and UpdateAllVersions no longer needs to be aware of whether groups exist or not.

@brrygrdn brrygrdn requested a review from a team as a code owner May 2, 2023 17:20
@brrygrdn
Copy link
Contributor Author

brrygrdn commented May 2, 2023

Note: this PR switches over the smoke test core uses from this one which has no configuration for dependency_groups to this one which does.

Once this PR merges, we will need to delete tests/smoke-bundler-grouped.yaml as it will start failing.

Comment on lines +78 to +80
# If no groups are defined, all dependencies are ungrouped by default.
return allowed_dependencies unless groups.any?

Copy link
Member

Choose a reason for hiding this comment

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

nice cleanup!

branch:
api-endpoint: https://api.github.com/
hostname: github.com
dependencies:
Copy link
Member

@Nishnha Nishnha May 3, 2023

Choose a reason for hiding this comment

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

I think you would want to include dummy-pkg-a and dummy-pkg-b under the dependencies key here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good eye - for "All Version" updates, we ignore any content in this array and the backend won't actually populate it so I've started leaving it blank when some of our older test fixtures fill it in.

Copy link
Member

@Nishnha Nishnha left a comment

Choose a reason for hiding this comment

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

I'm seeing the tests all pass 💚

I left a nit about including the dependencies being testing under the :dependencies key in the grouped + ungrouped job fixture so we don't leave a landmine for future tests using that fixture, but the code LGTM

@brrygrdn brrygrdn force-pushed the brrygrdn/updater-does-not-inject-groups branch from 8020195 to 057d1ee Compare May 4, 2023 10:24
@brrygrdn brrygrdn merged commit 3fef015 into main May 4, 2023
@brrygrdn brrygrdn deleted the brrygrdn/updater-does-not-inject-groups branch May 4, 2023 11:47
brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
…oes-not-inject-groups

[Updater] The Updater always expects job.dependency_groups to be defined
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.

2 participants