Skip to content

Problem: AIP–DIP relation (related_packages) is not created when DIP is generated via partial reingest #1774

@thales0591

Description

@thales0591

Expected behaviour

When a DIP is created during the original ingest using "Normalize for: preservation and access", the AIP record correctly includes the DIP identifier inside the related_packages array.
For example:

{
    "package_type": "AIP",
    "resource_uri": "/api/v2/file/f1af0200-0261-4524-943b-77283d84adf3/",
    "uuid": "f1af0200-0261-4524-943b-77283d84adf3",
    "related_packages": [
        "/api/v2/file/5e91e36d-91c8-4c26-b60e-05e195b4469e/"
    ],
    "status": "UPLOADED",
    "stored_date": "2025-11-01T11:48:04.611311"
}

This allows clients to discover the DIP UUID from the AIP and download the DIP via the API.
The expected behaviour is that the same AIP → DIP relation is created when a DIP is produced through partial reingest.

Current behaviour

When the DIP is created via partial reingest (normalize for access), the reingest process completes successfully and a DIP is generated, but the AIP returned by:

GET /api/v2/file/{aip-uuid}/

contains an empty related_packages array:

{
    "package_type": "AIP",
    "resource_uri": "/api/v2/file/3c967058-923d-4828-8505-9e3d11b2050b/",
    "uuid": "3c967058-923d-4828-8505-9e3d11b2050b",
    "related_packages": [],
    "status": "UPLOADED",
    "stored_date": "2025-11-25T16:19:43.708103"
}

The DIP produced by the reingest also does not reference the AIP.
As a result, there is no API-accessible relation between the AIP and the newly created DIP.

Additional incorrect behaviour

If an AIP originally had a DIP created during ingest (so the relation existed), performing a partial reingest:

  • clears the old AIP → DIP relation (expected if replacing it), but
  • does not create a new relation for the newly generated DIP.

Thus, related_packages ends up as:

[]

even though a new DIP was created.

Given that related_packages is an array, Archivematica should either:

  • store the old and new DIP IDs, or
  • replace the old DIP ID with the new one.

Currently, neither happens.

Steps to reproduce

  1. Perform an ingest with "Normalize for: preservation only" (no DIP created).

  2. After ingest completes, initiate a partial reingest:

    POST /api/v2/file/{aip-uuid}/reingest/

  3. Provide a processing configuration that normalizes for access.

  4. Approve the reingest:

    POST /api/ingest/reingest/approve

  5. Wait for the DIP to be generated.

  6. Query the AIP:

    GET /api/v2/file/{aip-uuid}/

  7. Observe that related_packages is empty and no AIP ↔ DIP relation exists.

(Optional reproduction)
8. Create a DIP during ingest (normalize for access).
9. Perform a partial reingest to generate a new DIP.
10. Observe that the previous relation is removed and no new relation is created.

Your environment

  • Archivematica 1.19.0
  • Docker environment

For Artefactual use

Before you close this issue, you must check off the following:

  • All pull requests related to this issue are properly linked
  • All pull requests related to this issue have been merged
  • A testing plan for this issue has been implemented and passed (testing plan information should be included in the issue body or comments)
  • Documentation regarding this issue has been written and merged (if applicable)
  • Details about this issue have been added to the release notes (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions