Skip to content

feat(payments): EN-484 Update pools query#149

Merged
Quentin-David-24 merged 2 commits into
mainfrom
en-484
Apr 28, 2026
Merged

feat(payments): EN-484 Update pools query#149
Quentin-David-24 merged 2 commits into
mainfrom
en-484

Conversation

@Quentin-David-24
Copy link
Copy Markdown
Contributor

No description provided.

@Quentin-David-24 Quentin-David-24 requested a review from a team as a code owner April 28, 2026 11:40
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@Quentin-David-24 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 5 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5f3f120-d179-4dd1-8479-688eb6bf533d

📥 Commits

Reviewing files that changed from the base of the PR and between 373a592 and 709b8f5.

📒 Files selected for processing (1)
  • cmd/payments/pools/root.go

Walkthrough

A new update-query CLI subcommand is added to the pools payment management tool. The implementation includes authentication, API version validation (≥ v3.1.0), user confirmation, script reading, JSON unmarshaling, and API invocation with error handling.

Changes

Cohort / File(s) Summary
Command Registration
cmd/payments/pools/root.go
Registers the new update-query subcommand by invoking NewUpdateQueryCommand().
Update Query Implementation
cmd/payments/pools/update_query.go
Introduces new UpdateQueryStore, UpdateQueryController, and command factory. Handles profile authentication, API version validation, user confirmation prompts, script content reading (file or stdin), JSON unmarshaling into V3UpdatePoolQueryRequest, API invocation via stackClient.Payments.V3.UpdatePoolQuery, and response handling with error checking on HTTP status codes ≥ 300.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A command hops into the CLI,
With queries to update, oh my, oh my!
Version checks dance, profiles align,
Scripts are parsed, the API's mine—
Dynamic pools now shimmer and shine! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate whether it relates to the changeset. Add a pull request description explaining the purpose and context of the update-query command for pools management.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(payments): EN-484 Update pools query' clearly describes the main change - adding an update-query command for pools management.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch en-484

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
Copy Markdown
Contributor

@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.

🧹 Nitpick comments (1)
cmd/payments/pools/update_query.go (1)

87-90: Reject unknown keys in the input payload.

json.Unmarshal silently 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 strings to 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4b09013 and 373a592.

📒 Files selected for processing (2)
  • cmd/payments/pools/root.go
  • cmd/payments/pools/update_query.go

Copy link
Copy Markdown
Contributor

@fguery fguery left a comment

Choose a reason for hiding this comment

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

Assuming the asnswer to my comment is yes I can approve it :)

Comment thread cmd/payments/pools/update_query.go
@Quentin-David-24 Quentin-David-24 merged commit 0c9b343 into main Apr 28, 2026
5 checks passed
@Quentin-David-24 Quentin-David-24 deleted the en-484 branch April 28, 2026 12:09
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.

2 participants