User ran /jmchilton:dedup command to analyze the last commit for code duplication.
The last commit (fdd6036cb4) added functionality to preserve a user's update_time when an admin archives their history. Files changed:
lib/galaxy/celery/tasks.pylib/galaxy/managers/hdas.pylib/galaxy/model/__init__.pylib/galaxy/webapps/galaxy/services/histories.pytest/integration/test_history_archiving.py
Group 1: _export_history vs _export_history_to_permanent_storage
Type III (Near-miss duplication) - Two nearly identical implementations:
_export_history_to_permanent_storage(lines 221-236)_export_history(lines 344-352) - new in this commit
Key differences:
| Aspect | Version 1 | Version 2 |
|---|---|---|
| target_uri | Optional w/ default | Required |
| model_store_format | Configurable | Hardcoded ROCRATE_ZIP |
| export_records assertion | == 1 |
>= 1 |
Group 2: Test Class Setup Boilerplate
Type II (Structural duplication) - Both test classes had identical:
dataset_populator: DatasetPopulatortask_based = Truehandle_galaxy_config_kwdsclassmethodsetUpmethod
Give me a plan that just universally changes those assertions to >= 1. Also do the refactoring that lets the second class subclass the first but change the name of the second class to TestHistoryArchivingAdmin.
- Changed
_export_history_to_permanent_storageassertion from== 1to>= 1 - Changed
_export_history_to_short_term_storageassertion from== 1to>= 1 - Made
TestHistoryArchivingUserUpdateTimesubclassTestHistoryArchivingWithExportRecord - Renamed class to
TestHistoryArchivingAdmin - Removed duplicate boilerplate (class attributes,
handle_galaxy_config_kwds,setUp) - Removed duplicate
_export_historymethod, updated calls to use inherited_export_history_to_permanent_storage
Net reduction of ~21 lines while maintaining functionality. The subclass now only contains:
require_admin_user = True(unique to this class)- The two test methods specific to admin behavior
https://github.com/jmchilton/claude-commands/blob/main/dedup.md