feat: Add cross-directory support for group_by_dependency_name #14046
+193
−7
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.
What are you trying to accomplish?
This PR implements Phase 2-3 of the
group-by: dependency-namefeature for grouping dependency updates by dependency name across multiple directories in a monorepo.Building on #14007, which added the
group_byattribute toDependencyGroup, this PR adds the cross-directory handling logic inDependencySnapshotandGroupDependencySelector.Why: In monorepos with many packages, updating the same dependency (e.g.,
lodash) across 10 directories creates 10 separate PRs. Whengroup-by: dependency-nameis enabled, dependencies need to be marked as handled across ALL directories, not just the current one. This prevents duplicate individual PRs from being created for the same dependency in different directories.Anything you want to highlight for special attention from reviewers?
DependencySnapshot changes:
group_by_dependency_name?is true, themark_group_handledmethod now includes dependencies from existing PRs across ALL directories, not just the current directory/fooand the group has an existing PR with deps from/fooand/bar, both deps are marked as handleddependencies_in_existing_pr_for_groupto correctly returnT::Array[T::Hash[String, T.untyped]]instead ofT::Array[String]GroupDependencySelector changes:
deduplicate_dependencies:group_by_dependency_name? = true: Deduplicate by name only (one entry per dependency name)group_by_dependency_name? = false: Deduplicate by directory + name (original behavior)deduplicate_dependencies_with_keywhich accepts a key extractor blockBackward Compatible: All changes check
group.group_by_dependency_name?before applying cross-directory logic, so existing behavior is preserved when the feature is not enabled.How will you know you've accomplished your goal?
DependencySnapshotandGroupDependencySelectorgroup_by_dependency_name?is truegroup_by_dependency_name?is falseTest coverage includes:
DependencySnapshot:/barare marked as handled when processing/foogroup_by_dependency_name?is falseGroupDependencySelector:group_by_dependency_name?is true (3 unique deps from 4 total)group_by_dependency_name?is false (4 deps kept)Checklist