Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CONTRACT][DATA_SOV] Display of contracts in the Contract View that were concluded during the exchange of notifications via the EDC #985

Closed
4 tasks done
mkanal opened this issue May 15, 2024 · 12 comments · Fixed by #1106, #1109, #1111, #1113 or #1121
Assignees
Labels
3 - Data Souvereignty & Data Ingest backend Backend related issues contract_management contract_management in trace-X data_souvereignty Issues refering to the catena-X data sovereignty principals frontend Frontend related Issues

Comments

@mkanal
Copy link
Contributor

mkanal commented May 15, 2024

As an admin user responsible for compliance,
I want to have view contracts of notification exchanged via the EDC in the Contract View,
so that I am able to view the contracts and policies, the notification were exchanged.

Link

Hints / Details

Acceptance Criteria

  • Contracts for notification exchanged over EDC are available in ContractView
  • User is able to devide/filter between contracts of notification exchange, contracts of aas shells consumption and contracts of submodel consumption (tabs are suitable as well for parts/notifications/tombstones)
  • [Click here] Contract of successful notification exchange as well as unsuccessful exchange of notifications are displayed. The user can distinguish between successful and unsuccessful notification exchange
  • In case user selects a notification contract, I can view the associated notification
  • User could investigate contract when selecting a notification which was already exchanges

NFR

  • The functionality should be responsive and performant, even with a large number of contracts. 10.000 +

Out of Scope

@mkanal mkanal added this to Trace-X May 15, 2024
@github-project-automation github-project-automation bot moved this to inbox in Trace-X May 15, 2024
@mkanal mkanal changed the title Display of contracts in the Contract View by means of which notifications are exchanged with partners [CONTRACT][DATA_SOV] Display of contracts in the Contract View that were concluded during the exchange of notifications via the EDC May 15, 2024
@mkanal mkanal added data_souvereignty Issues refering to the catena-X data sovereignty principals contract_management contract_management in trace-X labels May 15, 2024
@mkanal mkanal moved this from inbox to backlog in Trace-X Jun 18, 2024
@mkanal mkanal moved this from backlog to next in Trace-X Jun 21, 2024
@ds-mwesener ds-mwesener moved this from next to wip in Trace-X Jun 24, 2024
@ds-mwesener ds-mwesener self-assigned this Jun 24, 2024
@ds-mwesener
Copy link
Contributor

ds-mwesener commented Jun 27, 2024

Frontend Tasks:

  1. Add column: contractType
  2. Add 3 buttons like in parts table to quick filter for contractType -> same logic as in partsTable
    Per button this filter:
    Either: "contractType,EQUAL,ASSET_AS_BUILT,AND"
    Or: "contractType,EQUAL,ASSET_AS_PLANNED,AND"
    Or: "contractType,EQUAL,NOTIFICATION,AND"
  3. Change button from contractTable -> redirect with contractAgreementId to parts AND redirect with contractAgreementId to Notifications
  4. From frontend call notifications filtered by contractAgreementId -> extract the notification
  5. Open the detail view of the notification

Derive story for having consistency on assets redirecting to the parts detail view instead of the parts table component (as it is right now)

@ds-mwesener
Copy link
Contributor

Hi @mkanal / @ds-crehm regarding the following AC:

Contract of successful notification exchange as well as unsuccessful exchange of notifications are displayed. The user can distinguish between successful and unsuccessful notification exchange

A contract can only be shown if it was successful negotiated. Otherwise we do not have any information about an agreement or an contract because it does not exist within the edc or other sources.

There are some technical cases where a contract does a transition into a TERMINATED state - which is actually an ERROR state. Examples can be server is not available etc. We will have that information in the STATE field within our contract table.

Therefore we cannot implement tombstones for contracts.

@ds-mwesener ds-mwesener added frontend Frontend related Issues backend Backend related issues labels Jun 27, 2024
@ds-mwesener
Copy link
Contributor

Backend part has been implemented and merged. @ds-mmaul will take over for frontend adjustments.

@mkanal
Copy link
Contributor Author

mkanal commented Jun 27, 2024

Hi @ds-mwesener ,
Unsuccessful in this case is mentioned by missing or missing policy constraints, In this case the negotiation should be shown including the policy. So user has the opportunity to create the policy for the BPN to have future data exchange based on the policy.

@ds-mwesener
Copy link
Contributor

ds-mwesener commented Jun 27, 2024

Hi @ds-mwesener , Unsuccessful in this case is mentioned by missing or missing policy constraints, In this case the negotiation should be shown including the policy. So user has the opportunity to create the policy for the BPN to have future data exchange based on the policy.

Hi @mkanal understood. To solve this issue we could show the information that the policy did not match on the part itself.

Scenario: User tries to fetch data via edc with wrong policy included

<!--
Sequence Diagram:

1) Trace-X Frontend requests sync part from Trace-X Backend.
2) Trace-X Backend initiates a job via IRS.
3) IRS getsCatalog from the EDC.
4) EDC returns CatalogOffers including policies.
5) IRS tries to negotiate a contract for the offer.
6) EDC returns error and does not return a contract.
   - Therefore, there is no access to any contract-related info.
7) IRS returns a tombstone with information that the policy did not match and therefore the negotiation was cancelled.
   - Tombstone does not contain information about any contract, because as mentioned in step 6) there is no contract.
8) Trace-X Backend shows policy violation within the Trace-X Frontend.

Diagram:

   +--------------------+             +--------------------+             +------------+             +----------------+
   |  Trace-X Frontend  |             |  Trace-X Backend   |             |     IRS    |             |      EDC       |
   +--------------------+             +--------------------+             +------------+             +----------------+
            |                            |                            |                            |
            |   1) syncPart()            |                            |                            |
            |--------------------------->|                            |                            |
            |                            |   2) initiateJob()         |                            |
            |                            |--------------------------->|                            |
            |                            |                            |   3) getCatalog()          |
            |                            |                            |--------------------------->|
            |                            |                            |                            |
            |                            |                            |   4) CatalogOffers         |
            |                            |                            |<---------------------------|
            |                            |                            |                            |
            |                            |                            |   5) negotiateContract()   |
            |                            |                            |--------------------------->|
            |                            |                            |                            |
            |                            |                            |   6) Error: No contract    |
            |                            |                            |<---------------------------|
            |                            |                            |                            |
            |                            |   7) return tombstone      |                            |
            |                            |<---------------------------|                            |
            |   8) Show policy violation |                            |                            |
            |<---------------------------|                            |                            |
            |                            |                            |                            |
            +----------------------------+                            +----------------------------+
                                     Policy of part does not match application policy and EDC policy
 
-->

@ds-mwesener
Copy link
Contributor

Hi @mkanal here the notification flow for the discussion:

Scenario: User tries to send notification via edc with wrong policy included

<!--
Sequence Diagram:

1) Trace-X Frontend sends a notification via Trace-X Backend.
2) Trace-X Backend getsCatalog from the EDC.
3) EDC returns CatalogOffers including policies.
4) Trace-X Backend tries to negotiate a contract for the offer.
5) EDC returns error and does not return a contract.
   - Therefore, there is no access to any contract-related info.
6) Trace-X Backend shows invalid policy on the notification with information that the policy did not match and therefore the negotiation was cancelled.
   - The notification does not contain information about any contract, because as mentioned in step 5) there is no contract.

Diagram:

   +--------------------+             +--------------------+             +----------------+
   |  Trace-X Frontend  |             |  Trace-X Backend   |             |      EDC       |
   +--------------------+             +--------------------+             +----------------+
            |                            |                            |
            |  1) sendNotification       |                            |
            |--------------------------->|                            |
            |                            |   2) getCatalog()          |
            |                            |--------------------------->|
            |                            |                            |
            |                            |   3) CatalogOffers         |
            |                            |<---------------------------|
            |                            |                            |
            |                            |   4) negotiateContract()   |
            |                            |--------------------------->|
            |                            |                            |
            |                            |   5) Error: No contract    |
            |                            |<---------------------------|
            |                            |                            |
            |  6) show invalid policy    |                            |
            |<---------------------------|                            |
            |                            |                            |
            +----------------------------+                            +----------------------------+
                                     Policy of notification contract does not match application policy and EDC policy

-->

@ds-mwesener
Copy link
Contributor

ds-mwesener commented Jun 28, 2024

Decision in parking lot:
Instead of create a tombstone in the contracts table.
We need to see the policy and the bpn within the error message if it comes to an error in regards of policy mismatch.

The messages will be implemented as following examples:

  • Policies default-policy, default-policy1, default-policy2 did not match with policy default-policy from BPNL00000003CNKC
  • Policy default-policy, default-policy1, default-policy2 did not match with policy abc from BPNL00000003CNKC
  • Policy abc from BPNL00000003CNKC has expired.

Since our policies are a list of accepted policies and the policy of the catalog is only one because we are following the findFirstContractOffer approach the messages should be appropriate.

Since the messages will be added in: #1041 we can test and close this issue after verification @ds-crehm

ds-mmaul added a commit that referenced this issue Jun 28, 2024
@ds-mmaul
Copy link
Contributor

Frontend Tasks:

  1. Add column: contractType
  2. Add 3 buttons like in parts table to quick filter for contractType -> same logic as in partsTable
    Per button this filter:
    Either: "contractType,EQUAL,ASSET_AS_BUILT,AND"
    Or: "contractType,EQUAL,ASSET_AS_PLANNED,AND"
    Or: "contractType,EQUAL,NOTIFICATION,AND"
  3. Change button from contractTable -> redirect with contractAgreementId to parts AND redirect with contractAgreementId to Notifications
  4. From frontend call notifications filtered by contractAgreementId -> extract the notification
  5. Open the detail view of the notification

Derive story for having consistency on assets redirecting to the parts detail view instead of the parts table component (as it is right now)

  1. Column added
  2. As discussed, there are two buttons "Parts" and "Notifications" without the separation of asBuilt or asPlanned parts.
  3. implemented dependent on contract type (view part / view notification)
  4. implemented
  5. implemented

--> Also implemented for parts, no new Issue needed. With the merge of #1127 the changes take effect on e2e.

ds-mwesener added a commit that referenced this issue Jun 28, 2024
…-reference

chore(contracts): 985 implement contract reference to notification or…
@ds-mwesener ds-mwesener moved this from wip to test in Trace-X Jun 28, 2024
@ds-lcapellino
Copy link
Contributor

We found out, that we have no access to the policy ID in the EDC dependencies.
Changes to error messages:

  • Policies default-policy, default-policy1, default-policy2 did not match with policy from BPNL00000003CNKC.
  • Policy from BPNL00000003CNKC has expired.

@ds-crehm
Copy link
Contributor

ds-crehm commented Jul 3, 2024

Tested on E2E:
grafik
Why is it called quality incidents? I would have expected it to be called quality notifications.
In German it is correct-> Qualitätsthemen - like the tab in the navigation.

Also, the end date is shown as 1970-01-01 00:00 even though the contract does not have an end date:
grafik
-> Created a bug ticket for this: #1151

@ds-crehm ds-crehm moved this from test to wip in Trace-X Jul 3, 2024
@ds-mmaul ds-mmaul moved this from wip to test in Trace-X Jul 3, 2024
ds-mwesener added a commit that referenced this issue Jul 3, 2024
…-reference

chore(contracts): 985 change labelling
@mkanal mkanal reopened this Jul 3, 2024
@ds-crehm
Copy link
Contributor

ds-crehm commented Jul 4, 2024

E2E: Naming of quality notification contracts is fixed now. There is currently another issue with notifications, which will be addressed in #639 - right now the link to the notifications doesn't work always. Since this was already tested before and there were no changes done related to this, this issue can be ignored here and will be examined in the linked ticket instead.

Ready for review.

@ds-crehm ds-crehm moved this from test to review in Trace-X Jul 4, 2024
@ds-crehm ds-crehm assigned mkanal and unassigned ds-mmaul and ds-crehm Jul 4, 2024
@mkanal
Copy link
Contributor Author

mkanal commented Jul 4, 2024

LGFM PO acceptance in behalf of @jzbmw

@mkanal mkanal closed this as completed Jul 4, 2024
@mkanal mkanal moved this from review to done in Trace-X Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment