Open
Conversation
danielpgross
reviewed
Sep 5, 2025
Collaborator
danielpgross
left a comment
There was a problem hiding this comment.
Approach looks good overall. What stood out:
- this approach can't recognize relocations, it will report them as archive + add new category. Maybe that's okay, but good to be aware of.
- Did you consider using mappings for this? They were built to capture basically this same information and are better because they capture relocations
We would also need unit tests added before merging
| end | ||
|
|
||
| desc "compare_categories VERSION_FOLDER", "Compare category changes between full_names.yml and categories.txt" | ||
| option :output_dir, type: :string, default: "exports", desc: "Output directory for CSV file" |
Collaborator
There was a problem hiding this comment.
It would be more flexible and idiomatic to accept the full output path of the CSV file (filename included), not just output dir
| AddValueCommand.new(options.merge(name:, attribute_friendly_id:)).run | ||
| end | ||
|
|
||
| desc "compare_categories VERSION_FOLDER", "Compare category changes between full_names.yml and categories.txt" |
Collaborator
There was a problem hiding this comment.
I think we can make the description clearer, maybe something like this:
Suggested change
| desc "compare_categories VERSION_FOLDER", "Compare category changes between full_names.yml and categories.txt" | |
| desc "compare_categories VERSION_FOLDER", "Generate a CSV report showing category changes between the current taxonomy and Shopify taxonomy VERSION" |
|
|
||
| desc "compare_categories VERSION_FOLDER", "Compare category changes between full_names.yml and categories.txt" | ||
| option :output_dir, type: :string, default: "exports", desc: "Output directory for CSV file" | ||
| def compare_categories(version_folder) |
Collaborator
There was a problem hiding this comment.
I find version_folder confusing here, isn't it just the version?
Suggested change
| def compare_categories(version_folder) | |
| def compare_categories(version) |
Comment on lines
+6
to
+8
|
|
||
| # Ignore exports folder | ||
| /exports |
Collaborator
There was a problem hiding this comment.
We don't need to add an exports folder, the user can choose to export the CSV to wherever they want. Let's remove this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add category comparison command
This PR adds a new CLI command to compare category changes between different versions of the taxonomy.
What it does
full_names.ymlfrom a specific version folder againstdist/en/categories.txtexports/folderUsage
Files changed
dev/lib/product_taxonomy/commands/compare_categories_command.rbexports/folder to.gitignoreExample output
The command generates CSV files with columns:
type,id,old_name,new_name