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

Removed the handler package's exported ErrInternal, replaced usages with types.ErrInternal and sdkerrors wraps in provider handlers and tests, updated CHANGELOG, and applied multiple dependency version bumps in go.mod.

Changes

Cohort / File(s) Summary
Error handling changes
x/provider/handler/server.go, x/provider/handler/handler_test.go
Removed exported ErrInternal; updated Create/Update/Delete handlers to use sdkerrors.Wrapf(types.ErrInternal, ...); tests updated to assert/check against types.ErrInternal.
Changelog
CHANGELOG.md
Added Unreleased note that ErrInternal moved from x/provider/handler.ErrInternal to the provider types package.
Dependencies
go.mod
Bumped multiple module versions and indirects (e.g., cosmossdk.io/*, cosmos/cosmos-sdk, spf13/*, golang.org/x/sync, pkg.akt.dev/go, bytedance/sonic, etc.) with several transitive updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through files to make things right,
ErrInternal tucked in a cozy night,
Wrapped in sdkerrors, tests salute,
Changelog sings and modules reboot,
A carrot crunch — the code feels light. 🥕

🚥 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 'refactor!: moved ErrInternal to the chain-sdk' clearly and specifically summarizes the main change of moving ErrInternal to the chain-sdk package.
Description check ✅ Passed The description is directly related to the changeset, explaining the movement of ErrInternal to chain-sdk with testing details and dependency information.

✏️ 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 b92d711 and 9d545aa.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod
🧰 Additional context used
🪛 golangci-lint (2.5.0)
go.mod

[error] 40-40: : # pkg.akt.dev/node/x/market/keeper_test [pkg.akt.dev/node/x/market/keeper.test]
x/market/keeper/keeper_test.go:40:33: cannot use testutil.OrderID(t) (value of struct type v2beta1.OrderID) as "pkg.akt.dev/go/node/market/v1".OrderID value in argument to keeper.GetOrder
x/market/keeper/keeper_test.go:95:31: cannot use testutil.BidID(t) (value of struct type v2beta1.BidID) as "pkg.akt.dev/go/node/market/v1".BidID value in argument to keeper.GetBid
x/market/keeper/keeper_test.go:142:33: cannot use testutil.LeaseID(t) (value of struct type v2beta1.LeaseID) as "pkg.akt.dev/go/node/market/v1".LeaseID value in argument to keeper.GetLease
x/market/keeper/keeper_test.go:358:50: cannot use group.GroupSpec (variable of struct type "pkg.akt.dev/go/node/deployment/v1beta5".GroupSpec) as "pkg.akt.dev/go/node/deployment/v1beta4".GroupSpec value in argument to keeper.CreateOrder
x/market/keeper/keeper_test.go:364:16: cannot use group.GroupSpec (variable of struct type "pkg.akt.dev/go/node/deployment/v1beta5".GroupSpec) as "pkg.akt.dev/go/node/deployment/v1beta4".GroupSpec value in return statement

(typecheck)

🔇 Additional comments (3)
go.mod (3)

7-7: Clarify scope: Are all dependency updates necessary for this PR?

This PR includes numerous dependency updates beyond the main pkg.akt.dev/go change. While some may be transitive dependencies pulled in by the primary update, others appear unrelated to moving ErrInternal to chain-sdk.

Consider whether:

  1. These updates are all transitive requirements of pkg.akt.dev/[email protected]
  2. Unrelated dependency updates should be split into a separate PR for easier review and rollback if needed
  3. Each update has been tested for compatibility

Also applies to: 11-11, 19-20, 32-32, 36-36, 38-39, 44-44, 100-101, 117-117, 137-137, 148-148, 188-188, 226-226, 232-232, 238-238, 240-242, 250-250, 273-274, 293-293


48-48: Verify pre-release version availability and release timeline.

The dependency uses a pre-release version v0.2.0-b2. Before merging, confirm:

  1. This pre-release tag actually exists in the pkg.akt.dev/go repository
  2. There's a clear timeline for upgrading to the stable release (referenced as pending a chain-sdk release)
  3. The pre-release version is stable enough for the intended use

48-48: This review comment is incorrect. The specific type errors cited do not exist in the codebase.

The code correctly imports and uses market/v1 types (OrderID, BidID, LeaseID) as required by the keeper methods. No v2beta1 imports exist, and the helper function calls at the cited lines (40, 95, 142) pass the correct types. The v1, v1beta4, and v1beta5 versions coexist without the claimed conflicts.

Likely an incorrect or invalid review comment.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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
go.mod Outdated
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
@vertex451 vertex451 changed the title fix!: moved ErrInternal to the chain-sdk refactor!: moved ErrInternal to the chain-sdk Jan 12, 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