-
Notifications
You must be signed in to change notification settings - Fork 27
♻️(backend) refactor dedupe_accounts command #2735
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
base: master
Are you sure you want to change the base?
Conversation
Refactored `dedupe_accounts` to improve readability and logic separation by moving duplicate-handling logic to a utility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the dedupe_accounts management command to improve code organization and maintainability by extracting the deduplication logic into dedicated utility classes (UserDeduplicator and DedupeTracker).
Key Changes
- Extracted deduplication logic from the management command into a new
UserDeduplicatorclass with separate methods for each type of transfer operation - Created a
DedupeTrackerclass to centralize tracking of deduplication operations and results - Added comprehensive test coverage for the new utility classes with 689 lines of tests for
UserDeduplicatorand 439 lines forDedupeTracker
Reviewed Changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
user_deduplicator.py |
New utility class implementing user deduplication logic with methods for transferring various resources between duplicate accounts |
dedupe_tracker.py |
New utility class for tracking deduplication operations and logging results |
__init__.py (dedupe_accounts) |
Provides a simple dedupe_accounts function interface to the UserDeduplicator |
dedupe_accounts.py (command) |
Simplified management command that now delegates to the utility function |
test_user_deduplicator.py |
Comprehensive test suite for the UserDeduplicator class |
test_dedupe_tracker.py |
Comprehensive test suite for the DedupeTracker class |
test_dedupe_accounts_command.py |
Updated command tests adapted to new implementation |
test_social_pipeline_social_auth.py |
Added new test case for email association functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Purpose
Refactored
dedupe_accountsto improve readabilityand logic separation by moving duplicate-handling logic to a utility.