feat(payments): EN-484 Update pools query#149
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA new Changes
Sequence DiagramsequenceDiagram
participant CLI as CLI Command
participant Ctrl as UpdateQueryController
participant Auth as Profile/Auth
participant Stack as Stack Client
participant API as Payments API
CLI->>Ctrl: Run(cmd, args)
Ctrl->>Auth: Load & authenticate profile
Auth-->>Ctrl: Profile loaded
Ctrl->>Stack: Create Stack client
Stack-->>Ctrl: Client ready
Ctrl->>Ctrl: Fetch & set API version from context
Ctrl->>Ctrl: Validate version >= v3.1.0
Ctrl->>Ctrl: Prompt user for approval
Ctrl->>Ctrl: Read script (file or stdin)
Ctrl->>Ctrl: Unmarshal JSON to V3UpdatePoolQueryRequest
Ctrl->>API: UpdatePoolQuery(poolID, request)
API-->>Ctrl: Response
Ctrl->>Ctrl: Check HTTP status < 300
Ctrl->>Ctrl: Store PoolID, render confirmation
Ctrl-->>CLI: Renderable result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cmd/payments/pools/update_query.go (1)
87-90: Reject unknown keys in the input payload.
json.Unmarshalsilently ignores unknown fields, so a misspelled field in the JSON input gets dropped instead of failing fast. For an update command, this makes typos easy to miss and can result in partial or empty requests.Suggested change
var request shared.V3UpdatePoolQueryRequest - if err := json.Unmarshal([]byte(script), &request); err != nil { + decoder := json.NewDecoder(strings.NewReader(script)) + decoder.DisallowUnknownFields() + if err := decoder.Decode(&request); err != nil { return nil, err }Add
stringsto the imports.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmd/payments/pools/update_query.go` around lines 87 - 90, Replace the permissive json.Unmarshal call that populates request (shared.V3UpdatePoolQueryRequest) with a json.Decoder configured to reject unknown fields: create a decoder from the input string (using strings.NewReader(script)), call decoder.DisallowUnknownFields(), then decoder.Decode(&request) and return any decode error; also add "strings" to the imports. This ensures unknown/misspelled JSON keys cause a fast error instead of being silently ignored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cmd/payments/pools/update_query.go`:
- Around line 87-90: Replace the permissive json.Unmarshal call that populates
request (shared.V3UpdatePoolQueryRequest) with a json.Decoder configured to
reject unknown fields: create a decoder from the input string (using
strings.NewReader(script)), call decoder.DisallowUnknownFields(), then
decoder.Decode(&request) and return any decode error; also add "strings" to the
imports. This ensures unknown/misspelled JSON keys cause a fast error instead of
being silently ignored.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8f9b6b73-8a6c-4a70-9ce0-2dac68f26fec
📒 Files selected for processing (2)
cmd/payments/pools/root.gocmd/payments/pools/update_query.go
fguery
left a comment
There was a problem hiding this comment.
Assuming the asnswer to my comment is yes I can approve it :)
No description provided.