Skip to content

fix(gcp): reject CPU and memory amounts that target different resources - #256

Merged
cristim merged 2 commits into
mainfrom
fix/gcp-cpu-memory-same-resource
Oct 6, 2026
Merged

cristim merged 2 commits into
mainfrom
fix/gcp-cpu-memory-same-resource

Conversation

@cristim

@cristim cristim commented Oct 6, 2026

Copy link
Copy Markdown
Member

Closes #165

The Compute Engine converter picked the VCPU and MEMORY amounts independently, so a payload whose two operations name different commitment resources became one recommendation with mismatched amounts. It now returns a structural error (not errBadAmount, so it fails the batch like other structural payload problems). Same-resource payloads are unchanged. Covers operations in one group and across groups.

Tests: TestConvertGCPRecommendationRejectsCrossResourceAmounts fails on main (no error returned) and passes here.

🤖 Generated with Claude Code

The converter paired the VCPU and MEMORY amounts without checking that their operations name the same resource, so a payload with amounts for two commitments became one recommendation. Fail the conversion as a structural error instead; same-resource payloads are unchanged. Closes #165
@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged urgency/this-quarter Within the quarter impact/few Limited audience effort/m Days type/bug Defect labels Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 43 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 63 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-go/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 4cc73a8f-f860-48bb-af49-6dbc55c5ea7e
📥 Commits

Reviewing files that changed from the base of the PR and between e04c227 and de5d4a6.

📒 Files selected for processing (2)
  • providers/gcp/services/computeengine/client.go
  • providers/gcp/services/computeengine/client_test.go
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

… path

Pin that an empty memory resource next to a populated VCPU resource is rejected, that two empty resources are still accepted, and that GetRecommendations surfaces the cross-resource error.
@cristim
cristim merged commit 86e4b0c into main Oct 6, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/few Limited audience priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(gcp): keep CPU and memory recommendation amounts on the same resource

1 participant