Fix import regression for ActiveStorage::VariantRecord attachments#2732
Fix import regression for ActiveStorage::VariantRecord attachments#2732Mouxy wants to merge 1 commit intobasecamp:mainfrom
Conversation
ActiveStorage::VariantRecord (image thumbnails/resizes) was missing from INTERNAL_RECORD_TYPES, causing IntegrityError during import check when the export ZIP contained variant record attachments. This is a follow-up to basecamp#2707 which handled Export and Account::Import but missed this third internal type. - Add ActiveStorage::VariantRecord to INTERNAL_RECORD_TYPES - Filter variant blobs/files during import of old exports - Skip variant attachments during import check and import phases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes an import regression by adding support for filtering ActiveStorage::VariantRecord attachments and their associated blobs from account exports and imports. Previously, ActiveStorage::VariantRecord was not recognized as an internal record type, causing IntegrityError exceptions during import when exports contained variant record attachments. This is a follow-up to PR #2707 which addressed similar issues with Export and Account::Import record types.
Changes:
- Added
ActiveStorage::VariantRecordto theINTERNAL_RECORD_TYPESconstant inRecordSet - Updated blob and file record sets to identify and skip variant blobs during export and import
- Added
AttachmentRecordSetlogic to skip internal attachments during import check and import phases - Comprehensive test coverage including export validation, blob/file filtering, and attachment handling
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/models/account/data_transfer/record_set.rb | Added ActiveStorage::VariantRecord to INTERNAL_RECORD_TYPES constant |
| app/models/account/data_transfer/active_storage/blob_record_set.rb | Added logic to identify and skip internal blobs during import |
| app/models/account/data_transfer/active_storage/file_record_set.rb | Added logic to identify and skip internal blob storage files during import and check |
| app/models/account/data_transfer/active_storage/attachment_record_set.rb | Added check and import filtering for internal record type attachments |
| test/models/account/export_test.rb | Added test verifying exports exclude variant record attachments and blobs |
| test/models/account/data_transfer/active_storage/blob_record_set_test.rb | Added test verifying internal blobs are skipped during import |
| test/models/account/data_transfer/active_storage/file_record_set_test.rb | Added tests for skipping internal blob storage files |
| test/models/account/data_transfer/active_storage/attachment_record_set_test.rb | New test file covering attachment record set filtering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@flavorjones, I noticed this problem when I tried to import my account into a new "once" deployment I was testing, so I tried this end-to-end with a real account export ZIP. I exported the file, then manually patched the ZIP by removing The import completed successfully after that change. This aligns with the fix in this PR (excluding/skipping variant-derived internal records during export/import). |
ActiveStorage::VariantRecord(image thumbnails/resizes) was missing fromINTERNAL_RECORD_TYPES, causing IntegrityError during import check when the export ZIP contained variant record attachments.This is a follow-up to #2707 which handled Export and
Account::Importbut missed this third internal type.ActiveStorage::VariantRecordtoINTERNAL_RECORD_TYPES