Skip to content

Truncate source_title & source_url when creating `BulkImports::Failure`

What does this MR do and why?

Whenever we create BulkImports::Failure record during Direct Transfer migration we populate source_title & source_url to present it back to the user, for convenience, so they can quickly identify which record failed to import (if title or url is available).

However, if during failure record creation source_title (or url) is longer than 255 chars, we raise an exception that is not handled properly, resulting in the batch to be aborted entirely (by the looks of it).

ActiveRecord::StatementInvalid
PG::CheckViolation: ERROR: new row for relation "bulk_import_failures" violates check constraint "check_74414228d4" DETAIL: Failing row contains (..., BulkImports::Projects::Pipelines::IssuesPipeline, Activ...

Truncate source title & url when creating failure records.

Mentions #438074 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Merge request reports

Loading