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

feat: Handle Error in Background Jobs - Improve the way we store errors and defects in DB #1218

Merged
merged 3 commits into from
Jun 27, 2024

Conversation

FabioPinheiro
Copy link
Contributor

@FabioPinheiro FabioPinheiro commented Jun 21, 2024

Description:

ATL-6931
Note the branch name is wrong

Checklist:

  • My PR follows the contribution guidelines of this project
  • My PR is free of third-party dependencies that don't comply with the Allowlist
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked the PR title to follow the conventional commit specification

Copy link
Contributor

github-actions bot commented Jun 21, 2024

Unit Test Results

 96 files  ±0   96 suites  ±0   21m 52s ⏱️ -35s
826 tests ±0  818 ✅ ±0  8 💤 ±0  0 ❌ ±0 
833 runs  ±0  825 ✅ ±0  8 💤 ±0  0 ❌ ±0 

Results for commit 26ae6a0. ± Comparison against base commit e5e3411.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jun 24, 2024

Integration Test Results

16 files  ±0  16 suites  ±0   2s ⏱️ ±0s
34 tests ±0  34 ✅ ±0  0 💤 ±0  0 ❌ ±0 
59 runs  ±0  59 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 26ae6a0. ± Comparison against base commit e5e3411.

♻️ This comment has been updated with latest results.

@FabioPinheiro FabioPinheiro marked this pull request as ready for review June 24, 2024 16:42
@FabioPinheiro FabioPinheiro force-pushed the feat/ATL-6932 branch 2 times, most recently from b13b4dc to 59b30d0 Compare June 25, 2024 10:50
@FabioPinheiro
Copy link
Contributor Author

@bvoiturier can you review?

@@ -0,0 +1,3 @@
-- Clear content of meta_last_failure
UPDATE public.issue_credential_records SET meta_last_failure=NULL;
Copy link
Contributor Author

@FabioPinheiro FabioPinheiro Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am cleanup the meta_last_failure columns like this.

wip

Signed-off-by: FabioPinheiro <fabiomgpinheiro@gmail.com>

wip

fix tests

cleanup

Fix tests

scalafmt

one more fix and rebase

remove FixmeStatusCode

scalafmt

cleanup
Copy link
Contributor

@bvoiturier bvoiturier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @FabioPinheiro! I left some comments...

) extends Failure {
override val namespace = "DIDCommControllerError"
sealed trait DIDCommControllerError extends Failure {
override def namespace = "DIDCommControllerError"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason why you changed the previous construct and the below case class declaration? If not, I propose to stay consistent with the rest of the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make final case class RecipientNotFoundError() an object

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as a case class, then. I don't think it is worth the trouble. Who knows, maybe we will need to some kind of message ID as a parameter in the future.

import org.hyperledger.identus.shared.models._

import java.io.IOException

package object error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need all this complex error types hierarchy? It seems @CryptoKnightIOG was able to simplify it nicely in his last PR, but it was rolled back in this one. To be honest, this MercuryException|Throwable|Error construct is something I can't really wrap my head around for some time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum this is weird because I also remove this.
I did after making MercuryError extends Failure

It was most certainly merge conflict.

@bvoiturier That MercuryThrowable was a hackys solution to integration with the rest of the Open Enterprise Agent. That required Throwable in many places. So instead of adding Throwable in a few more places and making the problem even bigger.
I add the type alias MercuryThrowable for me to just know where I need to remove in the future. I even have a comment // TODO REMOVE Throwable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for the explanation! 👌

@FabioPinheiro
Copy link
Contributor Author

Hey @CryptoKnightIOG do you want to have a look at this PR. Since you are doing ATL-6933:

The ErrorResponse stored in DB should then be exposed through the REST API for later retrieval by the user. Those should be returned as part of the connect, issue, and present flow records.

In shared/core/src/main/scala/org/hyperledger/identus/shared/models/Failure.scala I'm adding a case class FailureInfo just to read the error from the DB.
We don't have access to the error type (because we do not encode that) but we have all the necessary information to inform the user. What do you think?

Signed-off-by: FabioPinheiro <fabiomgpinheiro@gmail.com>
@FabioPinheiro FabioPinheiro merged commit e3cadc9 into main Jun 27, 2024
12 checks passed
@FabioPinheiro FabioPinheiro deleted the feat/ATL-6932 branch June 27, 2024 13:36
hyperledger-bot added a commit that referenced this pull request Jul 1, 2024
# [1.37.0-snapshot.test.1](cloud-agent-v1.36.1...cloud-agent-v1.37.0-snapshot.test.1) (2024-07-01)

### Bug Fixes

* avoid name and operationId conflict when creating oas client ([#1233](#1233)) ([73e8e24](73e8e24))
* incorrect parsing of public key coordinates and enable some tests again ([#1215](#1215)) ([5398a75](5398a75))
* KeyID from String to Opaque Type and presentation job cleanup  ([#1190](#1190)) ([b813faf](b813faf))
* make init-script.sh idempotent [#1173](#1173) ([#1194](#1194)) ([1712062](1712062))
* migrate and repair in case of renaming issues ([#1211](#1211)) ([cb4d479](cb4d479))
* Present Error Handling (Part 1: Repo Changes) ([#1172](#1172)) ([13e2447](13e2447))
* Present Error Handling Job ([#1204](#1204)) ([3191d8b](3191d8b))
* present error handling Part 2 ([#1177](#1177)) ([9ac6e52](9ac6e52))
* Verification Policy Error Handling ([#1228](#1228)) ([6117a3c](6117a3c))

### Features

* add oidc4vci protocol MVP ([#1182](#1182)) ([3ae91dc](3ae91dc))
* add schemaId to the issuance session ([#1199](#1199)) ([97f5d83](97f5d83))
* add support for EcdsaSecp256k1Signature2019Proof and fix pk encoding for EddsaJcs2022Proof ([#1127](#1127)) ([e617ded](e617ded))
* **agent:** add browser fingerprint label to http metrics ([#1231](#1231)) ([f090554](f090554))
* ATL 6829 - Integrate ZIO failures and defects ADR in credential status list ([#1175](#1175)) ([dffad1d](dffad1d))
* ATL-6832 ZIO failures and defects in entity controller ([#1203](#1203)) ([9050094](9050094))
* ATL-6833 integrate ZIO failures and defects in wallet event controller ([#1186](#1186)) ([8bc2018](8bc2018))
* ATL-6834 Use ZIO Failures and Defects effectively in the Issue flow ([#1139](#1139)) ([ede7b77](ede7b77))
* Handle Error in Background Jobs - Improve the way we store errors and defects in DB ([#1218](#1218)) ([e3cadc9](e3cadc9))
* implement ADR Use ZIO Failures and Defects Effectively - Mercury should not throw exceptions ([#1192](#1192)) ([a4ce87f](a4ce87f))
* improve OpenAPI's PresentProof to make more consistent ([#1130](#1130)) ([bdc5d20](bdc5d20))
* Integrate ZIO failures and defects ADR in DID Registrar Controller and Mercury ([#1180](#1180)) ([d8e2120](d8e2120))
* SDJWT holder key binding ([#1185](#1185)) ([628f2f0](628f2f0))
* use kid in the jwt proof header of OID4VCI CredentialIssue request ([#1184](#1184)) ([ee53eda](ee53eda))
* use the compact format in SD-JWT ([#1169](#1169)) ([65da651](65da651))

Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
patlo-iog pushed a commit that referenced this pull request Jul 1, 2024
# [1.37.0-snapshot.test.1](cloud-agent-v1.36.1...cloud-agent-v1.37.0-snapshot.test.1) (2024-07-01)

### Bug Fixes

* avoid name and operationId conflict when creating oas client ([#1233](#1233)) ([73e8e24](73e8e24))
* incorrect parsing of public key coordinates and enable some tests again ([#1215](#1215)) ([5398a75](5398a75))
* KeyID from String to Opaque Type and presentation job cleanup  ([#1190](#1190)) ([b813faf](b813faf))
* make init-script.sh idempotent [#1173](#1173) ([#1194](#1194)) ([1712062](1712062))
* migrate and repair in case of renaming issues ([#1211](#1211)) ([cb4d479](cb4d479))
* Present Error Handling (Part 1: Repo Changes) ([#1172](#1172)) ([13e2447](13e2447))
* Present Error Handling Job ([#1204](#1204)) ([3191d8b](3191d8b))
* present error handling Part 2 ([#1177](#1177)) ([9ac6e52](9ac6e52))
* Verification Policy Error Handling ([#1228](#1228)) ([6117a3c](6117a3c))

### Features

* add oidc4vci protocol MVP ([#1182](#1182)) ([3ae91dc](3ae91dc))
* add schemaId to the issuance session ([#1199](#1199)) ([97f5d83](97f5d83))
* add support for EcdsaSecp256k1Signature2019Proof and fix pk encoding for EddsaJcs2022Proof ([#1127](#1127)) ([e617ded](e617ded))
* **agent:** add browser fingerprint label to http metrics ([#1231](#1231)) ([f090554](f090554))
* ATL 6829 - Integrate ZIO failures and defects ADR in credential status list ([#1175](#1175)) ([dffad1d](dffad1d))
* ATL-6832 ZIO failures and defects in entity controller ([#1203](#1203)) ([9050094](9050094))
* ATL-6833 integrate ZIO failures and defects in wallet event controller ([#1186](#1186)) ([8bc2018](8bc2018))
* ATL-6834 Use ZIO Failures and Defects effectively in the Issue flow ([#1139](#1139)) ([ede7b77](ede7b77))
* Handle Error in Background Jobs - Improve the way we store errors and defects in DB ([#1218](#1218)) ([e3cadc9](e3cadc9))
* implement ADR Use ZIO Failures and Defects Effectively - Mercury should not throw exceptions ([#1192](#1192)) ([a4ce87f](a4ce87f))
* improve OpenAPI's PresentProof to make more consistent ([#1130](#1130)) ([bdc5d20](bdc5d20))
* Integrate ZIO failures and defects ADR in DID Registrar Controller and Mercury ([#1180](#1180)) ([d8e2120](d8e2120))
* SDJWT holder key binding ([#1185](#1185)) ([628f2f0](628f2f0))
* use kid in the jwt proof header of OID4VCI CredentialIssue request ([#1184](#1184)) ([ee53eda](ee53eda))
* use the compact format in SD-JWT ([#1169](#1169)) ([65da651](65da651))

Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
Signed-off-by: Pat Losoponkul <pat.losoponkul@iohk.io>
patlo-iog pushed a commit that referenced this pull request Jul 1, 2024
# [1.37.0-snapshot.test.1](cloud-agent-v1.36.1...cloud-agent-v1.37.0-snapshot.test.1) (2024-07-01)

### Bug Fixes

* avoid name and operationId conflict when creating oas client ([#1233](#1233)) ([73e8e24](73e8e24))
* incorrect parsing of public key coordinates and enable some tests again ([#1215](#1215)) ([5398a75](5398a75))
* KeyID from String to Opaque Type and presentation job cleanup  ([#1190](#1190)) ([b813faf](b813faf))
* make init-script.sh idempotent [#1173](#1173) ([#1194](#1194)) ([1712062](1712062))
* migrate and repair in case of renaming issues ([#1211](#1211)) ([cb4d479](cb4d479))
* Present Error Handling (Part 1: Repo Changes) ([#1172](#1172)) ([13e2447](13e2447))
* Present Error Handling Job ([#1204](#1204)) ([3191d8b](3191d8b))
* present error handling Part 2 ([#1177](#1177)) ([9ac6e52](9ac6e52))
* Verification Policy Error Handling ([#1228](#1228)) ([6117a3c](6117a3c))

### Features

* add oidc4vci protocol MVP ([#1182](#1182)) ([3ae91dc](3ae91dc))
* add schemaId to the issuance session ([#1199](#1199)) ([97f5d83](97f5d83))
* add support for EcdsaSecp256k1Signature2019Proof and fix pk encoding for EddsaJcs2022Proof ([#1127](#1127)) ([e617ded](e617ded))
* **agent:** add browser fingerprint label to http metrics ([#1231](#1231)) ([f090554](f090554))
* ATL 6829 - Integrate ZIO failures and defects ADR in credential status list ([#1175](#1175)) ([dffad1d](dffad1d))
* ATL-6832 ZIO failures and defects in entity controller ([#1203](#1203)) ([9050094](9050094))
* ATL-6833 integrate ZIO failures and defects in wallet event controller ([#1186](#1186)) ([8bc2018](8bc2018))
* ATL-6834 Use ZIO Failures and Defects effectively in the Issue flow ([#1139](#1139)) ([ede7b77](ede7b77))
* Handle Error in Background Jobs - Improve the way we store errors and defects in DB ([#1218](#1218)) ([e3cadc9](e3cadc9))
* implement ADR Use ZIO Failures and Defects Effectively - Mercury should not throw exceptions ([#1192](#1192)) ([a4ce87f](a4ce87f))
* improve OpenAPI's PresentProof to make more consistent ([#1130](#1130)) ([bdc5d20](bdc5d20))
* Integrate ZIO failures and defects ADR in DID Registrar Controller and Mercury ([#1180](#1180)) ([d8e2120](d8e2120))
* SDJWT holder key binding ([#1185](#1185)) ([628f2f0](628f2f0))
* use kid in the jwt proof header of OID4VCI CredentialIssue request ([#1184](#1184)) ([ee53eda](ee53eda))
* use the compact format in SD-JWT ([#1169](#1169)) ([65da651](65da651))

Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
Signed-off-by: Pat Losoponkul <pat.losoponkul@iohk.io>
patlo-iog pushed a commit that referenced this pull request Jul 1, 2024
Signed-off-by: Pat Losoponkul <pat.losoponkul@iohk.io>

test: remove println

Signed-off-by: Pat Losoponkul <pat.losoponkul@iohk.io>

chore(release): cut Identus Cloud agent 1.37.0-snapshot.test.1 release

* avoid name and operationId conflict when creating oas client ([#1233](#1233)) ([73e8e24](73e8e24))
* incorrect parsing of public key coordinates and enable some tests again ([#1215](#1215)) ([5398a75](5398a75))
* KeyID from String to Opaque Type and presentation job cleanup  ([#1190](#1190)) ([b813faf](b813faf))
* make init-script.sh idempotent [#1173](#1173) ([#1194](#1194)) ([1712062](1712062))
* migrate and repair in case of renaming issues ([#1211](#1211)) ([cb4d479](cb4d479))
* Present Error Handling (Part 1: Repo Changes) ([#1172](#1172)) ([13e2447](13e2447))
* Present Error Handling Job ([#1204](#1204)) ([3191d8b](3191d8b))
* present error handling Part 2 ([#1177](#1177)) ([9ac6e52](9ac6e52))
* Verification Policy Error Handling ([#1228](#1228)) ([6117a3c](6117a3c))

* add oidc4vci protocol MVP ([#1182](#1182)) ([3ae91dc](3ae91dc))
* add schemaId to the issuance session ([#1199](#1199)) ([97f5d83](97f5d83))
* add support for EcdsaSecp256k1Signature2019Proof and fix pk encoding for EddsaJcs2022Proof ([#1127](#1127)) ([e617ded](e617ded))
* **agent:** add browser fingerprint label to http metrics ([#1231](#1231)) ([f090554](f090554))
* ATL 6829 - Integrate ZIO failures and defects ADR in credential status list ([#1175](#1175)) ([dffad1d](dffad1d))
* ATL-6832 ZIO failures and defects in entity controller ([#1203](#1203)) ([9050094](9050094))
* ATL-6833 integrate ZIO failures and defects in wallet event controller ([#1186](#1186)) ([8bc2018](8bc2018))
* ATL-6834 Use ZIO Failures and Defects effectively in the Issue flow ([#1139](#1139)) ([ede7b77](ede7b77))
* Handle Error in Background Jobs - Improve the way we store errors and defects in DB ([#1218](#1218)) ([e3cadc9](e3cadc9))
* implement ADR Use ZIO Failures and Defects Effectively - Mercury should not throw exceptions ([#1192](#1192)) ([a4ce87f](a4ce87f))
* improve OpenAPI's PresentProof to make more consistent ([#1130](#1130)) ([bdc5d20](bdc5d20))
* Integrate ZIO failures and defects ADR in DID Registrar Controller and Mercury ([#1180](#1180)) ([d8e2120](d8e2120))
* SDJWT holder key binding ([#1185](#1185)) ([628f2f0](628f2f0))
* use kid in the jwt proof header of OID4VCI CredentialIssue request ([#1184](#1184)) ([ee53eda](ee53eda))
* use the compact format in SD-JWT ([#1169](#1169)) ([65da651](65da651))

Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
Signed-off-by: Pat Losoponkul <pat.losoponkul@iohk.io>
hyperledger-bot added a commit that referenced this pull request Jul 1, 2024
# [1.37.0](cloud-agent-v1.36.1...cloud-agent-v1.37.0) (2024-07-01)

### Bug Fixes

* avoid name and operationId conflict when creating oas client ([#1233](#1233)) ([73e8e24](73e8e24))
* incorrect parsing of public key coordinates and enable some tests again ([#1215](#1215)) ([5398a75](5398a75))
* KeyID from String to Opaque Type and presentation job cleanup  ([#1190](#1190)) ([b813faf](b813faf))
* make init-script.sh idempotent [#1173](#1173) ([#1194](#1194)) ([1712062](1712062))
* migrate and repair in case of renaming issues ([#1211](#1211)) ([cb4d479](cb4d479))
* Present Error Handling (Part 1: Repo Changes) ([#1172](#1172)) ([13e2447](13e2447))
* Present Error Handling Job ([#1204](#1204)) ([3191d8b](3191d8b))
* present error handling Part 2 ([#1177](#1177)) ([9ac6e52](9ac6e52))
* Verification Policy Error Handling ([#1228](#1228)) ([6117a3c](6117a3c))

### Features

* add oidc4vci protocol MVP ([#1182](#1182)) ([3ae91dc](3ae91dc))
* add schemaId to the issuance session ([#1199](#1199)) ([97f5d83](97f5d83))
* add support for EcdsaSecp256k1Signature2019Proof and fix pk encoding for EddsaJcs2022Proof ([#1127](#1127)) ([e617ded](e617ded))
* **agent:** add browser fingerprint label to http metrics ([#1231](#1231)) ([f090554](f090554))
* ATL 6829 - Integrate ZIO failures and defects ADR in credential status list ([#1175](#1175)) ([dffad1d](dffad1d))
* ATL-6832 ZIO failures and defects in entity controller ([#1203](#1203)) ([9050094](9050094))
* ATL-6833 integrate ZIO failures and defects in wallet event controller ([#1186](#1186)) ([8bc2018](8bc2018))
* ATL-6834 Use ZIO Failures and Defects effectively in the Issue flow ([#1139](#1139)) ([ede7b77](ede7b77))
* Handle Error in Background Jobs - Improve the way we store errors and defects in DB ([#1218](#1218)) ([e3cadc9](e3cadc9))
* implement ADR Use ZIO Failures and Defects Effectively - Mercury should not throw exceptions ([#1192](#1192)) ([a4ce87f](a4ce87f))
* improve OpenAPI's PresentProof to make more consistent ([#1130](#1130)) ([bdc5d20](bdc5d20))
* Integrate ZIO failures and defects ADR in DID Registrar Controller and Mercury ([#1180](#1180)) ([d8e2120](d8e2120))
* SDJWT holder key binding ([#1185](#1185)) ([628f2f0](628f2f0))
* use kid in the jwt proof header of OID4VCI CredentialIssue request ([#1184](#1184)) ([ee53eda](ee53eda))
* use the compact format in SD-JWT ([#1169](#1169)) ([65da651](65da651))

Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants