Skip to content

Conversation

@vertex451
Copy link
Contributor

@vertex451 vertex451 commented Jan 5, 2026

Description

Moved x/provider/handler.ErrInternal to the chain-sdk/go/node/provider/v1beta4 package.

Must be merged after akash-network/chain-sdk#181

Testing

Tested by running single node script and querying the non-existed deployment.

Author Checklist

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • (n/a) included comments for documenting Go code
  • (n/a) updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

@vertex451 vertex451 requested a review from a team as a code owner January 5, 2026 09:58
@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Walkthrough

Replaced the handler package's exported ErrInternal with types.ErrInternal, switched imports to sdkerrors, and updated all error-wrapping sites and tests to reference the relocated error; also bumped a Go module dependency and added a changelog entry.

Changes

Cohort / File(s) Summary
Error handling changes
x/provider/handler/server.go, x/provider/handler/handler_test.go
Removed the exported ErrInternal declaration; updated error wrapping in Create/Update/Delete handlers to use sdkerrors.Wrapf(types.ErrInternal, ...); tests changed to assert/compare against types.ErrInternal.
Changelog
CHANGELOG.md
Added entry noting relocation of ErrInternal from x/provider/handler.ErrInternal to chain-sdk/go/node/provider/v1beta4 under Unreleased Bug Fixes.
Dependency bump
go.mod
Updated pkg.akt.dev/go version from v0.1.6 to v0.1.9-0.20260109003838-508f70669a8c.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A little hop, a tidy mend,
ErrInternal found a new friend,
Wrapped by sdkerrors, snug and neat,
Tests and changelog keep the beat,
I thump my paw — the change is well penned! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix!: moved ErrInternal to the chain-sdk' clearly summarizes the main change—moving ErrInternal error to an external package.
Description check ✅ Passed The description is directly related to the changeset, explaining the migration of ErrInternal to chain-sdk and providing testing details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch artem/fix/500-instead-of-404

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a00c30 and b92d711.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: network-upgrade
  • GitHub Check: tests
  • GitHub Check: lint-go
  • GitHub Check: coverage
  • GitHub Check: build-macos
  • GitHub Check: build-bins
  • GitHub Check: sims
  • GitHub Check: release-dry-run

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @x/provider/handler/server_test.go:
- Around line 1-33: The file ends without a final newline causing a formatting
lint failure; run gofmt (or add a trailing newline) on the test file so the file
containing TestErrorGRPCStatusCodes and references to handler.ErrInternal is
terminated with a newline character (i.e., ensure the file ends with a blank
line) and re-run static checks.
🧹 Nitpick comments (1)
x/provider/handler/server.go (1)

48-48: Inconsistent error wrapping style across the file.

The file uses two different error wrapping approaches:

  • Line 48: ErrInternal.Wrapf("err: %v", err) (method-style)
  • Line 69: sdkerrors.Wrapf(ErrInternal, "err: %v", err) (function-style)
  • Line 88: ErrInternal.Wrap("NOTIMPLEMENTED") (method-style)

For maintainability and code consistency, all error wrapping should use the same approach.

🔎 Standardize to method-style wrapping
-	return nil, sdkerrors.Wrapf(ErrInternal, "err: %v", err)
+	return nil, ErrInternal.Wrapf("err: %v", err)

Also applies to: 69-69, 88-88

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56645e3 and 6394498.

📒 Files selected for processing (2)
  • x/provider/handler/server.go
  • x/provider/handler/server_test.go
🧰 Additional context used
🧬 Code graph analysis (2)
x/provider/handler/server_test.go (1)
x/provider/handler/server.go (1)
  • ErrInternal (18-18)
x/provider/handler/server.go (1)
x/market/alias.go (1)
  • ModuleName (13-13)
🪛 golangci-lint (2.5.0)
x/provider/handler/server_test.go

[error] 34-34: File is not properly formatted

(gofmt)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: release-dry-run
  • GitHub Check: build-macos
🔇 Additional comments (2)
x/provider/handler/server.go (2)

6-7: LGTM! Proper imports for gRPC error mapping.

The addition of sdkerrors and google.golang.org/grpc/codes imports enables proper gRPC status code registration.


18-18: Excellent fix for proper HTTP/gRPC status mapping.

Using RegisterWithGRPCCode with codes.Internal ensures this error correctly maps to HTTP 500 (Internal Server Error) instead of defaulting to an incorrect status code. This aligns with the PR objective to fix error propagation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @x/provider/handler/server.go:
- Line 82: The build fails because server.go returns
types.ErrInternal.Wrap("NOTIMPLEMENTED") but the symbol types.ErrInternal is
undefined; fix by either (A) replacing that reference with an existing error
value or constructor used elsewhere (e.g., the project-wide internal error
constant/function) or (B) defining ErrInternal in the types package with the
same error type/shape expected here (and ensuring the Wrap method is available
or using the appropriate error-wrapping utility). Update the return in the
handler in server.go to use the correct existing error symbol or add ErrInternal
to the types package so the Wrap call compiles.
- Line 63: The error is caused by using sdkerrors.Wrapf(types.ErrInternal, ...)
and by types.ErrInternal being undefined; change this call to the same
method-syntax used elsewhere: use types.ErrInternal.Wrapf("err: %v", err). Also
ensure that the types package defines and exports ErrInternal (or import the
correct package that provides ErrInternal) so the symbol compiles; keep the
wrapping style consistent with the other usages (lines using
types.ErrInternal.Wrapf).
- Line 42: The code references types.ErrInternal which no longer exists; update
the call to use the correct error symbol and import (for example replace
types.ErrInternal.Wrapf(...) with sdkerrors.ErrInternal.Wrapf(...) and add the
import "github.com/cosmos/cosmos-sdk/types/errors" aliased as sdkerrors), or
alternatively replace the call with a local/internal error helper (e.g.,
fmt.Errorf or your package's ErrInternal) so the undefined types.ErrInternal is
removed; ensure the change is made where server.go returns nil,
types.ErrInternal.Wrapf(...) and adjust imports accordingly.
🧹 Nitpick comments (1)
x/provider/handler/server.go (1)

6-6: Import alias is fine, but usage is inconsistent.

The import alias change from errorsmod to sdkerrors improves clarity. However, the usage across the file is inconsistent: line 63 uses sdkerrors.Wrapf(types.ErrInternal, ...) while lines 42 and 82 use method syntax types.ErrInternal.Wrapf(...).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f5e093 and 2a00c30.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • x/provider/handler/handler_test.go
  • x/provider/handler/server.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md
🧰 Additional context used
🪛 GitHub Check: build-macos
x/provider/handler/server.go

[failure] 42-42:
undefined: types.ErrInternal


[failure] 63-63:
undefined: types.ErrInternal


[failure] 82-82:
undefined: types.ErrInternal

🪛 golangci-lint (2.5.0)
x/provider/handler/server.go

[error] 42-42: : # pkg.akt.dev/node/x/provider/handler
x/provider/handler/server.go:42:21: undefined: types.ErrInternal
x/provider/handler/server.go:63:37: undefined: types.ErrInternal
x/provider/handler/server.go:82:20: undefined: types.ErrInternal

(typecheck)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: lint-go
  • GitHub Check: release-dry-run
  • GitHub Check: build-bins
  • GitHub Check: tests
  • GitHub Check: sims
  • GitHub Check: coverage
🔇 Additional comments (1)
x/provider/handler/handler_test.go (1)

256-257: The test code at lines 256-257 is correct. types.ErrInternal is defined in the external package pkg.akt.dev/go/node/provider/v1beta4 and is actively used throughout the codebase (e.g., in x/provider/handler/server.go). No undefined error or build failure exists.

Likely an incorrect or invalid review comment.

@vertex451 vertex451 changed the title fix!: replaced sdkerrors.Register with sdkerrors.RegisterWithGRPCCode for the proper error propagation. fix!: moved ErrInternal to the chain-sdk Jan 7, 2026
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.2
pkg.akt.dev/go v0.1.6
pkg.akt.dev/go v0.1.9-0.20260109003838-508f70669a8c
Copy link
Contributor Author

@vertex451 vertex451 Jan 9, 2026

Choose a reason for hiding this comment

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

I used not released commit here to pass the CI.
I am not aware of the releasing strategy, if you need anything else to finish that PR - let me know
CC: @troian

@vertex451 vertex451 self-assigned this Jan 9, 2026
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.

2 participants