refactor: clean up unused plugin policy methods and update return typ…#116
Conversation
…es in fees handling
WalkthroughThe changes primarily update Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant VerifierApi
participant HTTPServer
Client->>VerifierApi: GetPluginPolicyFees(policyId)
VerifierApi->>HTTPServer: HTTP GET /fees/{policyId}
HTTPServer-->>VerifierApi: FeeHistoryDto (with PolicyId)
VerifierApi-->>Client: *FeeHistoryDto or error
Client->>VerifierApi: GetPublicKeysFees(ecdsaPublicKey)
VerifierApi->>HTTPServer: HTTP GET /fees/publickey/{ecdsaPublicKey}
HTTPServer-->>VerifierApi: FeeHistoryDto (with PolicyId)
VerifierApi-->>Client: *FeeHistoryDto or error
Client->>VerifierApi: GetAllPublicKeysFees()
VerifierApi->>HTTPServer: HTTP GET /fees/all
HTTPServer-->>VerifierApi: map[string]FeeHistoryDto
VerifierApi-->>Client: map[string]FeeHistoryDto or error
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (1.64.8)level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package session: could not load export data: no export data for "github.com/vultisig/go-wrappers/go-dkls/sessions"" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
Clean up unused plugin policy methods and enhance fees handling by updating return types and ensuring proper resource cleanup
- Removed commented-out plugin policy method stubs
- Changed fees API methods to return pointers and added deferred
response.Body.Close() - Reformatted comments in
verifierapi.gofor consistency
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/verifierapi/verifierapi.go | Replaced block comments with inline comments and updated struct documentation |
| internal/verifierapi/fees.go | Deleted unused plugin policy methods, refactored return types to pointers, and added deferred closing of HTTP response bodies |
Comments suppressed due to low confidence (1)
internal/verifierapi/fees.go:23
- Field
PolicyIdshould be renamed toPolicyIDto follow Go’s acronym capitalization conventions.
PolicyId uuid.UUID `json:"policy_id" validate:"required"`
| defer func() { | ||
| if err := response.Body.Close(); err != nil { | ||
| v.logger.WithError(err).Error("Failed to close response body") | ||
| } | ||
| }() |
There was a problem hiding this comment.
The defer response.Body.Close() is placed after JSON decoding, but earlier return paths (e.g., non-OK status or decode error) won't close the body, causing a resource leak. Move the defer immediately after obtaining the response.
…t logging and ensuring proper response body closure
…es in fees handling
Summary by CodeRabbit
Refactor
Bug Fixes