Repository navigation
chore(ri-exchange): forward the source RI availability zone to the go offering lookups - #1018
Conversation
… offering lookups Bump all four cloud-commitments-go modules from 740dfbd72456 to 551be568dc21 (cloud-commitments-go#427 zone-aware EC2 offering lookups, LeanerCloud#428 LookupOfferingParams and RIMetadataInfo.AvailabilityZone) and adapt: - convertForAutoExchange sets RIMetadataInfo.AvailabilityZone from the source convertible RI, for both the scheduled reshape and the ladder exchange runner. - One shared newConvertibleOfferingLookup adapts the EC2 client to the new exchange.LookupOfferingFunc and forwards AvailabilityZone into FindConvertibleOfferingParams; it replaces the two duplicated closures. - GET /api/ri-exchange/target-offerings passes the source RI's AZ into ListTargetOfferingsParams, and maps the provider's zone refusals (zonal without an AZ, regional with one) to a 422 instead of a 500. Closes LeanerCloud#921 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00. Or wait 56 minutes for your next included review. View limit details
Comment |
Independent review verdict: CLEAN at 2dd8d6aReviewer: 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. Callers. All three take AZ, tenancy and scope from the source RI.
Failure paths: an empty or unknown scope also fails loud ( Notes (non-blocking):
What was attacked and how:
Gate:
|
|
Closing and reopening to refresh CI on the current main merge ref: main changed this PR's packages after its last CI run. The branch is untouched. (claude-cc-pr-merge-3) |
|
Closing and reopening to refresh CI again: #1019 changed internal/api on main during the previous run. Branch untouched. (claude-cc-pr-merge-3) |
|
Refreshing CI a third time: main changed internal/api again during the previous run. Branch untouched. (claude-cc-pr-merge-3) |
|
Refreshing CI: #1015 (same package, internal/api) merged after this PR's last CI run. Branch untouched. (claude-cc-pr-merge-3) |
|
Refreshing CI: #1006 (internal/api) merged during the previous run. Branch untouched. (claude-cc-pr-merge-3) |
Merge gate record: #1018 at 2dd8d6a
Merged by claude-cc-pr-merge-3 with |
Closes #921.
Go pin bump
All four cloud-commitments-go modules move from
v0.0.0-20261015143912-740dfbd72456tov0.0.0-20261016145956-551be568dc21, the merge commit of go#428.origin/main, and 740dfbd is an ancestor of 0e95e9fc.replacedirectives and no other upgrades, andgo mod verifypasses.go.mod. The earlier bump PR (fix(ladder): bump cloud-commitments-go and plan tranches in commitment dollars #976) is already merged.Adaptation (the issue's items)
convertForAutoExchangecopies the source RI'sAvailabilityZoneintoRIMetadataInfo. That's the only place the metadata is built, for both the scheduled reshape and the ladder exchange runner.newConvertibleOfferingLookupreplaces the two copied lookup closures, usesLookupOfferingParams, and passes the AZ intoFindConvertibleOfferingParams.GET /api/ri-exchange/target-offeringspasses the source AZ to the provider. The provider's two zone refusals (zonal without an AZ, regional with one) now return a 422 naming the source RI, instead of a 500. The provider has no exported error value for these, so the match is on message text. The tests use the real provider client, so a reworded message would fail them.internal/server/handler_ri_exchange_reservation_integration_test.go.Tests
The new tests are
internal/server/ri_exchange_zone_test.goandinternal/api/target_offerings_zone_test.go. They run the real EC2 client against a fake EC2 API, so nothing reaches AWS and no exchange is made.Verification
All runs used
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/null.go build ./...,go vet ./...andgo vet -tags integration ./...are clean.TestAuthPublicRoutes_EveryRouteIsCSRFGuardedOrExempt. That test also fails on main, and test(api): classify the approval-details route in the AuthPublic CSRF guard (fixes red main) #1003 fixes it.go test ./internal/mocks/andmake tidy-checkpass.gocyclo -over 10is clean after splitting outtargetOfferingsForSource.Out of scope
🤖 Generated with Claude Code