-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add GroupDependencySelector from per-directory merge logic #12911
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
Conversation
a85f6d0
to
65ea110
Compare
- Split merge_per_directory! method to fix Rubocop ABC size violation (35.48->compliant) - Extract helper methods: deduplicate_dependencies, collect_updated_files, create_merged_change - Add DependencyAttribution module for metadata management - Extend Dependency class with attribution support (getter/setter methods) - Implement comprehensive test coverage with 25 passing test cases - Add detailed logging and error handling for group filtering logic - Maintain backward compatibility with existing dependency change workflow Files added: - updater/lib/dependabot/updater/group_dependency_selector.rb (322 lines) - updater/lib/dependabot/dependency_attribution.rb (99 lines) - updater/spec/dependabot/dependency_attribution_spec.rb (220 lines) - updater/spec/dependabot/updater/group_dependency_selector_spec.rb (429 lines) Files modified: - common/lib/dependabot/dependency.rb (added attribution support)
… Dependency in specs
65ea110
to
c76a330
Compare
…dencies from FileParser
…sponsibilities and filtering logic
GroupDependencySelector Analysis - Group Consistency EnforcementProblem StatementWhen recreating or rebasing PRs for dependency groups, dependencies outside the group were being included (a superset), leading to inconsistent group dependency selection. This analysis examines whether the The Superset ProblemThe Core Filtering MechanismPrimary Method:
|
What are you trying to accomplish?
What: This PR introduces a new
GroupDependencySelector
model that consolidates dependency group filtering, merging, and selection logic into a dedicated class. The class provides structured methods for handling dependency changes across multiple directories while maintaining group membership rules and observability.Important
This PR should not interfere with existing functionality. We will start to utilize these new models in a follow up PR.
Why: Previously, dependency group logic was scattered across different parts of the updater system. This new model centralizes the responsibility for:
Issues addressed: Creates a clean abstraction for dependency group operations, improving code organization and making the group dependency workflow more maintainable and testable.
Anything you want to highlight for special attention from reviewers?
Approach chosen: I created a dedicated model class rather than adding methods to existing classes to maintain separation of concerns and improve testability. The new
GroupDependencySelector
class encapsulates all group-related dependency operations:filter_to_group!
: Filters dependencies based on group membership rules with experiment flag supportmerge_per_directory!
: Merges dependency changes from multiple directories with proper deduplicationannotate_dependency_drift!
: Adds metadata for observability and dependency drift detectiondeduplicate_dependencies
,collect_updated_files
,create_merged_change
for modular functionalityKey design decisions:
How will you know you've accomplished your goal?
Demonstrating success:
GroupDependencySelector
class provides a clean interface for dependency group operationsTesting performed:
Checklist
Files Changed:
updater/lib/dependabot/updater/group_dependency_selector.rb
(322 lines) - New dependency group selector modelupdater/lib/dependabot/dependency_attribution.rb
(99 lines) - Attribution utility moduleupdater/spec/dependabot/dependency_attribution_spec.rb
(220 lines) - Attribution testsupdater/spec/dependabot/updater/group_dependency_selector_spec.rb
(429 lines) - Main model testscommon/lib/dependabot/dependency.rb
- Added attribution supportTotal: 1,083 lines added across 5 files introducing new dependency group management functionality.