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

fix(validation): avoid policy evaluation on consumer side after agreement #2068

Merged

Conversation

ndr-brt
Copy link
Member

@ndr-brt ndr-brt commented Oct 10, 2022

What this PR changes/adds

Changes contract validation on consumer side when it receives the "confirmed" message from the provider, at this point the agreement is already reached and there should be only a formal validation of the id and the policy, no need to evaluate the latter.

Why it does that

It was an unnecessary evaluation.

Further notes

  • renamed the validate method to validateConfirmed to have a clear distinction on what's the purpose of the method avoiding confusion with the others.
  • refactored ContractId to a more object oriented one.
  • made validateConfirmed returns a Result, so the caller can obtain a detail on what was the problem.

Linked Issue(s)

Closes #1975

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • assigned appropriate label? (exclude from changelog with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and styleguide for details)

@ndr-brt ndr-brt added the bug Something isn't working label Oct 10, 2022
@ndr-brt ndr-brt temporarily deployed to Azure-dev October 10, 2022 13:01 Inactive
@ndr-brt ndr-brt changed the title fix(contract-validation): avoid policy evaluation on consumer side when agreement is received fix(validation): avoid policy evaluation on consumer side after agreement Oct 10, 2022
@ndr-brt ndr-brt temporarily deployed to Azure-dev October 10, 2022 13:37 Inactive
@ndr-brt ndr-brt temporarily deployed to Azure-dev October 10, 2022 14:07 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2022

Codecov Report

Base: 64.31% // Head: 64.56% // Increases project coverage by +0.24% 🎉

Coverage data is based on head (32365c0) compared to base (58f6aa1).
Patch coverage: 54.90% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2068      +/-   ##
==========================================
+ Coverage   64.31%   64.56%   +0.24%     
==========================================
  Files         780      783       +3     
  Lines       16564    16638      +74     
  Branches     1077     1078       +1     
==========================================
+ Hits        10653    10742      +89     
+ Misses       5461     5442      -19     
- Partials      450      454       +4     
Impacted Files Coverage Δ
...aceconnector/ids/core/IdsCoreServiceExtension.java 0.00% <0.00%> (ø)
.../dataspaceconnector/sql/lease/SqlLeaseContext.java 0.00% <0.00%> (ø)
...actdefinition/ContractDefinitionApiController.java 95.55% <ø> (-0.10%) ⬇️
...taspaceconnector/sql/assetindex/SqlAssetIndex.java 0.00% <0.00%> (ø)
...ctdefinition/store/SqlContractDefinitionStore.java 0.00% <0.00%> (ø)
...negotiation/store/SqlContractNegotiationStore.java 5.17% <0.00%> (+0.14%) ⬆️
...tor/sql/policy/store/SqlPolicyDefinitionStore.java 0.00% <0.00%> (ø)
...transferprocess/store/SqlTransferProcessStore.java 0.00% <0.00%> (ø)
...iation/ProviderContractNegotiationManagerImpl.java 90.55% <66.66%> (ø)
...ract/validation/ContractValidationServiceImpl.java 60.93% <66.66%> (+8.55%) ⬆️
... and 45 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ndr-brt ndr-brt temporarily deployed to Azure-dev October 11, 2022 14:14 Inactive
@ndr-brt ndr-brt merged commit 3fa9f3a into eclipse-edc:main Oct 12, 2022
@ndr-brt ndr-brt deleted the fix/1975-consumer-policy-enforcement branch October 12, 2022 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contract Requestor validates contract content against contract provider
5 participants