Skip to content

CLD-694: Catalog client error handling#514

Merged
DimitriosNaikopoulos merged 15 commits intomainfrom
CLD-694/catalog-error-handling
Oct 15, 2025
Merged

CLD-694: Catalog client error handling#514
DimitriosNaikopoulos merged 15 commits intomainfrom
CLD-694/catalog-error-handling

Conversation

@DimitriosNaikopoulos
Copy link
Contributor

@DimitriosNaikopoulos DimitriosNaikopoulos commented Oct 14, 2025

CLD-694: Catalog client error handling

  • Adds checkResponseStatus helper function to convert ResponseStatus to gprc errors
  • Handle errors in client using default grpc error handling
  • Fix linting issues were creds ServerName field is deprecated for grpc

Test require running catalog and currently are skipped in CI (functionality will be added in another ticket)
Local test execution

image

@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2025

🦋 Changeset detected

Latest commit: d362c1c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@DimitriosNaikopoulos DimitriosNaikopoulos marked this pull request as ready for review October 14, 2025 14:58
@DimitriosNaikopoulos DimitriosNaikopoulos requested a review from a team as a code owner October 14, 2025 14:58
Copilot AI review requested due to automatic review settings October 14, 2025 14:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves error handling in the catalog client by converting ResponseStatus objects to proper gRPC errors and fixes linting issues related to deprecated credentials fields.

  • Added a checkResponseStatus helper function to convert ResponseStatus to gRPC errors with proper error codes
  • Refactored all catalog store implementations to use standardized gRPC error handling instead of string-based error checking
  • Fixed credential test by removing deprecated ServerName field assertion

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
go.mod Updated dependency versions for chainlink-protos and grpc libraries
engine/cld/internal/credentials/credentials_test.go Removed deprecated ServerName field assertion from credentials test
datastore/catalog/remote/response_status.go Added helper function to convert ResponseStatus to gRPC errors
datastore/catalog/remote/response_status_test.go Added comprehensive tests for the response status conversion function
datastore/catalog/remote/env_metadata_store.go Refactored error handling to use gRPC status codes instead of string matching
datastore/catalog/remote/contract_metadata_store.go Refactored error handling to use gRPC status codes instead of string matching
datastore/catalog/remote/chain_metadata_store.go Refactored error handling to use gRPC status codes instead of string matching
datastore/catalog/remote/address_ref_store.go Simplified error handling to use the new checkResponseStatus helper
datastore/catalog/remote/address_ref_store_test.go Changed test skip to error for missing gRPC server connection
.changeset/eight-schools-glow.md Added changeset for the catalog error handling improvements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings October 14, 2025 16:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 14, 2025 16:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings October 14, 2025 16:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"google.golang.org/grpc/status"
)

// checkResponseStatus converts a ResponseStatus to a standard gRPC error.
Copy link
Collaborator

Choose a reason for hiding this comment

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

checkResponseStatus doeesnt seem like a good name as this performs conversion instead of just "checking"

What about parseResponse? Or any better name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed c61ab4d

if strings.Contains(response.Status.GetError(), "No records found") {
return datastore.AddressRef{}, datastore.ErrAddressRefNotFound
if statusErr := checkResponseStatus(response.Status); statusErr != nil {
st, _ := status.FromError(statusErr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we handle the error here instead of _ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed c61ab4d

Copilot AI review requested due to automatic review settings October 15, 2025 10:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@graham-chainlink graham-chainlink left a comment

Choose a reason for hiding this comment

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

Loooks like sonarqube is failing

@DimitriosNaikopoulos
Copy link
Contributor Author

@graham-chainlink

Loooks like sonarqube is failing

Yeap currently we do not have a way to run test in CI which causes causes sonarqube to report the code as untested. Although we have tests and I run the locally (see description).

I think @giogam mentioned that there is another ticket in the epic to work out a solution for catalog/remote tests by either mocking the service or spinning up a container

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
20.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

Merged via the queue into main with commit 406cb82 Oct 15, 2025
13 of 14 checks passed
@DimitriosNaikopoulos DimitriosNaikopoulos deleted the CLD-694/catalog-error-handling branch October 15, 2025 13:54
github-merge-queue bot pushed a commit that referenced this pull request Oct 23, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## chainlink-deployments-framework@0.58.0

### Minor Changes

-
[#514](#514)
[`406cb82`](406cb82)
Thanks [@DimitriosNaikopoulos](https://github.com/DimitriosNaikopoulos)!
- Handle Catalog ResponseStatus errors as grpc errors

-
[#518](#518)
[`99ee634`](99ee634)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! -
feat(offchain): new JD in memory client

-
[#522](#522)
[`0cbed61`](0cbed61)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! -
feat(engine): integrate memory JD to test runtime

-
[#529](#529)
[`4bb40fa`](4bb40fa)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! -
feat(catalog): new datastore field in domain.yaml

Field `datastore` is introduced to configure in future where should the
data be written to, either file(json) - current behaviour or remote on
the catalog service.
By default, this field will be set to file for backwards compatibility.

-
[#520](#520)
[`2cc6462`](2cc6462)
Thanks [@ecPablo](https://github.com/ecPablo)! - improve decoded
proposal error to use bullets instead of tables

-
[#517](#517)
[`5220e9a`](5220e9a)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! -
feat(engine/test): support memory catalog

### Patch Changes

-
[#527](#527)
[`8041f81`](8041f81)
Thanks [@giogam](https://github.com/giogam)! - chore: remove Catalog
field from Environment struct

-
[#524](#524)
[`41b8c65`](41b8c65)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - fix:
remove dep on chainlink-common

---------

Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants