Repository navigation
fix(azure): treat reservation purchaseDate as a calendar date in the duplicate guard - #453
Conversation
|
@coderabbitai review |
|
|
Warning Review limit reached
This review includes 5 billable files and costs up to $1.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 6 minutes for your next included review. View limit details
Comment |
Independent review verdict: CLEAN at c2849d2Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. SDK (armreservations v1.1.0, module cache):
The guard:
Consumers:
Non-blocking, already present before this PR: a nil What was attacked and how (providers/azure,
Gate: labels are mirrored from #277. Merge once CI is green at this SHA. |
|
CI is green on head |
Moves providers/azure from pkg 3838efd to 4566498 so the module sees common.Commitment.StartDateIsDay and the recfilter change from b69a17e. pkg commits in between that touch packages azure imports: b69a17e fix(recfilter): treat a date-only commitment start as any time that d... 498b74f feat(common): preserve proven commitment currency metadata (#410) 77bc8a9 feat(common): add ExperimentalGCPPlanTerm to RecommendationParams (#402) 6fd189f fix(recfilter): coverage drop reason, EC2 platform engine filter, mon... 9551cce fix(scorer): compute break-even so --max-break-even-months filters e9a33bb feat(pkg): add recurring monthly cost to the audit record cdcdc7f feat(common): add RecommendationParams.SPAccountScope (step 1 of 2) Azure build and race tests pass on the bumped pin before any code change. Refs #277 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reservations API returns purchaseDate as a date, so a reservation bought late yesterday decoded to 00:00 UTC yesterday and fell outside the 24h duplicate guard. Set StartDateIsDay so the guard treats the instant as anywhere in that day. Adds an SDK-decode regression through DuplicateChecker with the real clock, and a partial-overlap test that checks ResizeCount scales the recommendation costs. Refs #277 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c2849d2 to
21b70e0
Compare
Summary
Part 2 of #277, the Azure side. Part 1 (#447,
b69a17e) addedcommon.Commitment.StartDateIsDayand the day-resolution check in the recent-commitment duplicate guard.The two commits are kept separate so the pin bump can be judged on its own:
build(azure)bumps the azurepkgpin fromv0.0.0-20261012192523-3838efd56668tov0.0.0-20261016163842-4566498f2a08.DuplicateChecker. The one behaviour change there is fix(recfilter): coverage drop reason, EC2 platform engine filter, money scaling on dedupe #379'scommon.ResizeCount: a partial overlap now scales cost and savings, and a source count of 0 or less is an error.fix(azure)setsStartDateIsDay = truein the shared reservation inventory (providers/azure/services/internal/reservations/inventory.go), whereStartDatecomes from the date-onlyPurchaseDate.format: date.EffectiveDateTimeand stays precise, and a test now pins that.Effect: a reservation bought late yesterday now suppresses a matching duplicate recommendation. Before, it decoded to UTC midnight and looked older than the 24h window.
Wire shape: Azure reservation commitments now serialize
"start_date_is_day":true.Closes #277
Verification (macOS, Go 1.26.9)
Commands
(cd providers/azure && GOWORK=off go test -race -short ./...): pass.make build,make vet: pass.gocyclo -over 10: clean.SDK-decode regression (
compute/purchase_date_guard_sdk_test.go)GetExistingCommitments, thenNewDuplicateChecker(24).AdjustRecommendationsForExisting, using the real clock.Fail-before: without the inventory line,
purchased_yesterdayfails.Other tests
TestPurchaseDateGuardSDKPartialOverlapScalesCosts: existing 1 against recommended 3 gives count 2, and cost, on-demand and savings scale by 2/3. This pins the fix(recfilter): coverage drop reason, EC2 platform engine filter, money scaling on dedupe #379 change the pin bump brings in.TestGetExistingCommitments_Happyasserts the flag is false. Forcing it on fails the test.Review
512e42fand re-tested.All of this uses SDK-shaped fixtures. No Azure call or purchase was made.
🤖 Generated with Claude Code