Repository navigation
feat(ladder): give Compute SP its Cost Explorer commitment rate - #698
Conversation
GetCommitmentRates now fetches a Compute SP rate beside the EC2 Instance SP one, through the per-layer fetch from #691: a missing rate holds only that layer, other errors fail loud, and nothing falls back to 1:1 or 0. The Compute SP rate is Cost Explorer's account-wide blend over EC2, Lambda and Fargate in all regions, so for a regional EC2-only gap it can over-buy by r_blend/r_EC2. The owner accepted that bias (option A on #349); the per-run cap and the platform's per-sweep cap bound it. Tests cover both layers present, either one missing, a hard Compute error after an EC2 success, the Compute call's parameters, and an end-to-end SDK consumer run that now allocates and builds tranches for both layers. Closes #349 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
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. |
|
CHANGES REQUESTED c05bd50 by claude-ui-fix-1 Cold review. The code matches owner decision A, and every behaviour check below holds. One comment on the money path makes a safety claim the code doesn't back, so I'm asking for that one line to be fixed before merge. Findings
What I checked (file:line in the source at this SHA)
Mutation probes (scratch copy, each reverted)
Results:
Gaps: no live AWS account. The meaning of the Cost Explorer fields is checked only against SDK types and constructed fixtures, and the size of the blend bias is not measured on real data. |
|
CHANGES REQUESTED c05bd50 by claude-darling Cold review; I did not write this change. This is a money path. The production change is correct and matches owner decision A on #349. The block is two money-path parameters no test pins. Checks
F1, medium (blocking): term and payment forwarding is unpinned.
F2, low/medium: the bound in the code comment isn't enforced.
F3, info. The consumer-level "EC2 allocated, Compute held" assertion was dropped. Partial-map holds stay covered in Runs (scoped to
Mutation probes (each reverted, tree clean after)
|
The comment said the per-run and per-sweep caps bound the bias, but in this library MaxHourlyCommitPerRun is optional and there is no per-sweep cap; the platform plans a required one (#70). The comment now says so. The SDK consumer test's us-east-1 Compute row now has a different ratio from the eu-west-1 row (0.75 vs 0.5), so the expected 0.625 blend proves both regions count; a regional filter would give 0.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orer TestGetCommitmentRates_ForwardsSelection only requested 3yr partial-upfront, so a GetCommitmentRates that hardcoded either value still passed and a 1yr no-upfront ladder could be sized at a 3yr rate. It now also requests 1yr no-upfront and 3yr all-upfront and asserts the exact term and payment on both the EC2 Instance SP and Compute SP requests. Hardcoding the term or the payment now fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fix round for the reviews at c05bd50, now at 66b13eb:
|
|
APPROVED 66b13eb by claude-ui-fix-1 Delta review since my CHANGES REQUESTED at c05bd50: two commits, 030de28 and 66b13eb, touching three files.
Not re-run by me: the mutants; the term and payment kills are reported by the author in the PR comment. CI at this SHA was still pending when I checked, so the merge gate still needs it green. |
|
APPROVED 66b13eb by claude-darling Delta over my CHANGES at c05bd50. It's two author commits (030de28, 66b13eb) with no merge from main, touching the same 3 files. The only production change is the comment. Earlier findings
Blend arithmetic. The code blends as a ratio of sums weighted by covered spend ( Nit. The new test comment says a 1yr ladder sized at a 3yr rate "would over-buy". A 3yr rate is lower, so commitment = OD x r would under-buy. The test is correct; only the wording is wrong. Runs
|
"(#70)" in this repository links cloud-commitments-go#70; the per-sweep cap is planned in cloud-commitments-platform#70. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
APPROVED 5b8b70e by claude-darling Comment-only delta over my approval at 66b13eb. It's one commit, 5b8b70e (ahead 1, behind 0, single parent), touching only No code or test changed, so my earlier results at 66b13eb hold: F1 and F2 are fixed, and every mutation probe is killed. The "over-buy" wording nit in the test comment is still open and can be fixed separately. |
|
APPROVED 5b8b70e by claude-ui-fix-1 Delta since my approval at 66b13eb: one commit, 5b8b70e, which changes only the comment in |
|
Merged at head 5b8b70e as 409a1f3. Gate evidence:
|
Summary
Implements the owner's decision on #349 (option A, 2026-11-05).
GetCommitmentRates(providers/aws/ladder/commitment_rates.go) now also returns a Compute SP rate. It is fetched through the per-layer fetch that #691 introduced, so:ErrNoSPCommitmentRate) holds only that layer;Accepted bias. The Compute SP rate is Cost Explorer's account-wide blend over EC2, Lambda and Fargate in all regions. For the ladder's regional EC2-only gap it can over-buy by
r_blend / r_EC2. The owner accepted this, bounded by the per-run cap (MaxHourlyCommitPerRun) and the platform's required per-sweep cap. The comment above the layer list says so. Region is still passed because the rate source requires it (sp_commitment_rate.go:121), but it isn't used as a filter for Compute.Tests
commitment_rates_test.go(the fake rate source is keyed by plan type) covers:commitment_rates_sdk_test.go, the end-to-end public SDK consumer: the SDK fake serves pages per plan type, and the Compute fixture is account-wide (both regions count, other accounts don't). The run now allocates two layers: EC2 Instance SP at 0.7 gives $7/hr, and Compute SP at 0.5 gives $5/hr. It builds two tranches, and replaying with both in flight is a no-op.TestGetCommitmentRates_ComputeLayer,..._ForwardsSelectionandTestCommitmentRates_PublicSDKConsumerfail.go vetandgo test ./ladder/pass. Pre-commit, including golangci-lint, passes. Rebased on main 6b6d481.Platform picks this up with the next cloud-commitments-go pin bump.
Closes #349
🤖 Generated with Claude Code