ImportFailure records created during file import should include IID in `external_identifiers` where possible.
While refining #425798 (closed) we found that the ImportFailure
records created for an invalid object don't include an identifier for the source object.
Having the source identifier stored will likely make it easier to perform a partial re-import from previous data.
Source data (missing title
attribute):
{"author_id":1,"project_id":47,"created_at":"2023-12-12T09:44:10.929Z","updated_at":"2023-12-12T09:44:10.929Z","description":"","iid":1,"updated_by_id":null,"weight":null,"confidential":false,"due_date":null,"lock_version":0,"time_estimate":0,"relative_position":513,"last_edited_at":null,"last_edited_by_id":null,"discussion_locked":null,"closed_at":null,"closed_by_id":null,"health_status":null,"external_key":null,"state":"opened","events":[{"project_id":47,"author_id":1,"created_at":"2023-12-12T09:44:11.414Z","updated_at":"2023-12-12T09:44:11.414Z","action":"created","target_type":"Issue","fingerprint":null}],"timelogs":[],"notes":[],"label_links":[],"resource_label_events":[],"resource_milestone_events":[],"resource_state_events":[],"designs":[],"design_versions":[],"issue_assignees":[],"zoom_meetings":[],"award_emoji":[],"work_item_type":{"base_type":"issue"},"resource_iteration_events":[]}
Resulting error:
=> #<ImportFailure:0x000000014a726ed8
id: 9,
relation_index: 0,
project_id: 52,
created_at:
Tue, 12 Dec 2023 10:03:08.792281000 UTC +00:00,
relation_key: "[FILTERED]",
exception_class: "ActiveRecord::RecordInvalid",
correlation_id_value: "01HHEQNT8KY2KKD9NZKGEHD5JA",
exception_message:
"Validation failed: Title can't be blank",
retry_count: 0,
group_id: nil,
source: "process_relation_item!",
external_identifiers: {}, # <-- 😡
user_id: nil>
In this situation we could populate external_identifiers
with something like:
{ iid: 1, object_type: :issue }