eclipse-tractusx / item-relationship-service

https://eclipse-tractusx.github.io/item-relationship-service/docs/
Apache License 2.0
7 stars 22 forks source link

bpns list in job response is empty ( in some cases ) #323

Closed ds-ext-sceronik closed 10 months ago

ds-ext-sceronik commented 11 months ago

Description

bpns list in job response is empty for some jobs

Current behaviour

Using uploaded test data -> https://github.com/eclipse-tractusx/traceability-foss/blob/main/tx-backend/testdata/CX_Testdata_MessagingTest_v0.0.12.json

when creating job with following request ->

{
    "aspects": [
        "SingleLevelBomAsBuilt",
        "SerialPart",
        "Batch"
    ],
    "bomLifecycle": "asBuilt",
    "collectAspects": true,
    "lookupBPNs": true,
    "direction": "downward",
    "depth": 2,
    "key": {
        "globalAssetId": "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f",
        "bpn": "BPNL00000003CML1"
    }
}

we get no bpns result in job response after completion of job

{
    "job": {
        "id": "c51080be-3e72-4b20-8769-88cb2786d7a0",
        "globalAssetId": "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f",
        "state": "COMPLETED",
        "exception": null,
        "createdOn": "2023-12-06T13:56:46.470816059Z",
        "startedOn": "2023-12-06T13:56:46.471049353Z",
        "lastModifiedOn": "2023-12-06T13:57:04.834606636Z",
        "completedOn": "2023-12-06T13:57:04.834612236Z",
        "owner": "sa-cl6-cx-10",
        "summary": {
            "asyncFetchedItems": {
                "running": 0,
                "completed": 1,
                "failed": 0
            },
            "bpnLookups": {
                "completed": 0,
                "failed": 0
            }
        },
        "parameter": {
            "bomLifecycle": "asBuilt",
            "aspects": [
                "SingleLevelBomAsBuilt",
                "SerialPart",
                "Batch"
            ],
            "depth": 2,
            "bpn": "BPNL00000003CML1",
            "direction": "downward",
            "collectAspects": true,
            "lookupBPNs": true,
            "callbackUrl": null
        }
    },
    "relationships": [],
    "shells": [
        {
            "administration": null,
            "description": [],
            "globalAssetId": "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f",
            "idShort": "a/devDoorKey",
            "id": "urn:uuid:2ec539cb-033c-40e9-94bb-b0f5c6786020",
            "specificAssetIds": [
                {
                    "name": "manufacturerPartId",
                    "subjectId": null,
                    "value": "8770123-80",
                    "semanticId": null
                },
                {
                    "name": "manufacturerId",
                    "subjectId": null,
                    "value": "BPNL00000003CML1",
                    "semanticId": null
                },
                {
                    "name": "partInstanceId",
                    "subjectId": null,
                    "value": "NO-246880451848384868750731",
                    "semanticId": null
                }
            ],
            "submodelDescriptors": [
                {
                    "administration": null,
                    "description": [],
                    "idShort": "SerialPart",
                    "id": "urn:uuid:ee6f31cf-1ea9-4880-bd4d-1c1dd80f0d1e",
                    "semanticId": {
                        "keys": [
                            {
                                "value": "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart",
                                "type": "GlobalReference"
                            }
                        ],
                        "type": "ExternalReference"
                    },
                    "endpoints": [
                        {
                            "protocolInformation": {
                                "href": "https://trace-x-edc-e2e-a-dataplane.dev.demo.catena-x.net/api/public/data/urn:uuid:ee6f31cf-1ea9-4880-bd4d-1c1dd80f0d1e",
                                "endpointProtocol": "HTTP",
                                "endpointProtocolVersion": [
                                    "1.1"
                                ],
                                "subprotocol": "DSP",
                                "subprotocolBody": "id=urn:uuid:88c9539f-d0cc-45a5-b8cd-30f705581600;dspEndpoint=https://trace-x-edc-e2e-a.dev.demo.catena-x.net",
                                "subprotocolBodyEncoding": "plain"
                            },
                            "interface": "SUBMODEL-3.0"
                        }
                    ]
                }
            ]
        }
    ],
    "tombstones": [],
    "submodels": [
        {
            "identification": "urn:uuid:ee6f31cf-1ea9-4880-bd4d-1c1dd80f0d1e",
            "aspectType": "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart",
            "payload": {
                "localIdentifiers": [
                    {
                        "value": "BPNL00000003CML1",
                        "key": "manufacturerId"
                    },
                    {
                        "value": "8770123-80",
                        "key": "manufacturerPartId"
                    },
                    {
                        "value": "NO-246880451848384868750731",
                        "key": "partInstanceId"
                    }
                ],
                "manufacturingInformation": {
                    "date": "2022-02-04T14:48:54",
                    "country": "DEU"
                },
                "catenaXId": "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f",
                "partTypeInformation": {
                    "manufacturerPartId": "8770123-80",
                    "customerPartId": "8770123-80",
                    "classification": "component",
                    "nameAtManufacturer": "a/dev Door Key",
                    "nameAtCustomer": "Door Key"
                }
            }
        }
    ],
    "bpns": []
}

Expected behavior

Steps to reproduce the Bug

For reproducing issues please contact @ds-ext-sceronik @ds-mwesener we can simulate it on running deployment

ds-ext-kmassalski commented 10 months ago

After overview and analysis I've had a meeting with @ds-ext-sceronik in which I explained why the above job does have empty BPNS list. Also explanation below:

The included dataset does not have the SingleLevelBomAsBuilt aspect (asBuilt&downward) that was requested for globalAssetId: "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f". Thats why job's response doesnt have any relationships, and since it does not have a relationship, there is no BPN id for which we could build a list - we are retrieving bpn's from relationship aspects as entry point (eg. SingleLevelBomAsBuilt#2.0.0 has businessPartner field). Taking above into account, if there would be a relationship in the job, bpn/or tombstone would also be there.

mkanal commented 10 months ago

@jzbmw Ready for PO review. Thank you very much.