eclipse-tractusx / traceability-foss

https://eclipse-tractusx.github.io/traceability-foss/docs/
Apache License 2.0
11 stars 22 forks source link

[BUG] Duplicated error messages #1188

Closed ds-crehm closed 1 month ago

ds-crehm commented 1 month ago

Links

Description

Whenever an error happens during the sending of a notification, a duplicated error message is created. This does not happen for successful messages.

Current behaviour

Image { "id": 1, "title": "POLICY TEST", "status": "SENT", "description": "INVALID POLICY TEST", "createdBy": "BPNL00000003CML1", "createdByName": null, "createdDate": "2024-07-08T12:10:39.756187Z", "updatedDate": "2024-07-08T12:31:01.799274Z", "assetIds": [ "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd" ], "channel": "SENDER", "sendTo": "BPNL00000003CNKC", "sendToName": null, "severity": "MINOR", "type": "INVESTIGATION", "targetDate": null, "messages": [ { "id": "c27b5520-d92a-4463-bb1c-e148ccf9f463", "sentBy": "BPNL00000003CML1", "sentByName": null, "sendTo": "BPNL00000003CNKC", "sendToName": null, "contractAgreementId": null, "notificationReferenceId": null, "edcNotificationId": "c27b5520-d92a-4463-bb1c-e148ccf9f463", "messageDate": "2024-07-08T12:10:48.260850", "messageId": "334f51d6-0859-47bd-8b8a-87091b4d07af", "status": "SENT", "errorMessage": "Failed to negotiate contract agreement: Policies [INVALID_POLICY_TEST] did not match with policy from BPNL00000003CNKC.", "message": null }, { "id": "01c8b491-af0f-4701-8689-ccdeea465c0d", "sentBy": "BPNL00000003CML1", "sentByName": null, "sendTo": "BPNL00000003CNKC", "sendToName": null, "contractAgreementId": null, "notificationReferenceId": null, "edcNotificationId": "01c8b491-af0f-4701-8689-ccdeea465c0d", "messageDate": "2024-07-08T12:10:52.145857", "messageId": "54a64fc5-7a76-4bf4-a068-4c2e4c988d2f", "status": "SENT", "errorMessage": "Failed to negotiate contract agreement: Policies [INVALID_POLICY_TEST] did not match with policy from BPNL00000003CNKC.", "message": null }, { "id": "5ef8ccc2-5571-4303-ad76-c3eb0f03e29b", "sentBy": "BPNL00000003CML1", "sentByName": null, "sendTo": "BPNL00000003CNKC", "sendToName": null, "contractAgreementId": null, "notificationReferenceId": null, "edcNotificationId": "5ef8ccc2-5571-4303-ad76-c3eb0f03e29b", "messageDate": "2024-07-08T12:22:44.157571", "messageId": "f4ef9aff-2a0a-49f6-81da-8123a9d4be8d", "status": "SENT", "errorMessage": "Failed to negotiate contract agreement: Policy from BPNL00000003CNKC has expired.", "message": null }, { "id": "51fbfc66-f5e8-409f-a39b-405c5a84cdd2", "sentBy": "BPNL00000003CML1", "sentByName": null, "sendTo": "BPNL00000003CNKC", "sendToName": null, "contractAgreementId": null, "notificationReferenceId": null, "edcNotificationId": "51fbfc66-f5e8-409f-a39b-405c5a84cdd2", "messageDate": "2024-07-08T12:22:47.724387", "messageId": "519b8f4b-1dff-4a1c-b689-fcd6fe42fe11", "status": "SENT", "errorMessage": "Failed to negotiate contract agreement: Policy from BPNL00000003CNKC has expired.", "message": null }, { "id": "828076e8-7408-4c6b-923e-a6251cf8a661", "sentBy": "BPNL00000003CML1", "sentByName": null, "sendTo": "BPNL00000003CNKC", "sendToName": null, "contractAgreementId": "dbdb35aa-9ec9-4a35-844a-7cc2a6784f65", "notificationReferenceId": null, "edcNotificationId": "828076e8-7408-4c6b-923e-a6251cf8a661", "messageDate": "2024-07-08T12:30:48.207708", "messageId": "1b05eeea-9940-4daa-b7bf-4714c973697e", "status": "SENT", "errorMessage": null, "message": null } ] }

Expected behavior

Only one error message is created.

Steps to reproduce the Bug

  1. Create alert with wrong BPN (e.g. BPNL00000003CNKD)
  2. Approve alert
  3. Go to detail view of alert
ds-lcapellino commented 1 month ago

There is a second call triggered to /approve, in case of errors:

Image

ds-mwesener commented 1 month ago

Hi @ds-mmaul please see image of lucas. It seems like frontend is triggering two calls.

ds-crehm commented 1 month ago

Tested on E2E: Only one error message is created in the backend and shown in the frontend: image image image

Ready for review

mkanal commented 1 month ago

https://github.com/eclipse-tractusx/traceability-foss/issues/1234 Now no message is created right now.

@ds-lcapellino @ds-mwesener

mkanal commented 1 month ago

@ds-crehm please retest

ds-crehm commented 1 month ago

@mkanal replicating the exact process from the bug ticket does create the error message like expected for me. My assumption is that the state of Trace-X at the time was the cause for those issues. Since a bug ticket is already created and I the acceptance criteria of this ticket are met I will move it back to review.

mkanal commented 1 month ago

@ds-crehm

There is no error. I have tested it again on e2e. https://traceability-portal-e2e-a.dev.demo.catena-x.net/inbox/237 Error situation seems to be resolved. This is a bug and it is related to the resolution of this ticket. So I will move the ticket back to wip.

image

ds-crehm commented 1 month ago

One situation where this happens is when a notification was edited and the senderBPN changed: https://github.com/eclipse-tractusx/traceability-foss/issues/1122 That is a situation that may never occur normally and in that situation the message creation process is never reached as this problem already happens before that. That's why there's nothing in the message history. The situation from your screenshot is the same situation. A notification on a tombstone cannot be sent right now. So the message creation process is never reached and no error message is created. For this I created another ticket: https://github.com/eclipse-tractusx/traceability-foss/issues/1270

Since both of these things are unrelated to the duplication of error messages and that specific issue is resolved, I will move this ticket again to review.

mkanal commented 1 month ago

LGFM. PO Acceptance in behalf of @jzbmw .