Skip to content

Fix import regression for ActiveStorage::VariantRecord attachments#2732

Open
Mouxy wants to merge 1 commit intobasecamp:mainfrom
Mouxy:Mouxy/fix-variant-import-v2
Open

Fix import regression for ActiveStorage::VariantRecord attachments#2732
Mouxy wants to merge 1 commit intobasecamp:mainfrom
Mouxy:Mouxy/fix-variant-import-v2

Conversation

@Mouxy
Copy link
Contributor

@Mouxy Mouxy commented Mar 19, 2026

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 #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

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>
Copilot AI review requested due to automatic review settings March 19, 2026 14:01
Copy link
Contributor

Copilot AI left a 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 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::VariantRecord to the INTERNAL_RECORD_TYPES constant in RecordSet
  • Updated blob and file record sets to identify and skip variant blobs during export and import
  • Added AttachmentRecordSet logic 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.

@Mouxy
Copy link
Contributor Author

Mouxy commented Mar 20, 2026

@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 ActiveStorage::VariantRecord related data (variant attachment records and their linked blob metadata), and re-imported it.

The import completed successfully after that change.

This aligns with the fix in this PR (excluding/skipping variant-derived internal records during export/import).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants