Repository navigation
refactor(azure): consolidate AzureRetailPrice into shared pricing package (closes #594) - #843
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR consolidates Azure Retail Prices API type definitions across six service clients by extracting duplicated struct definitions into a shared canonical type in the pricing package, then replacing each service's local types with type aliases. The search service additionally refactors its pricing fetch logic to use the shared pagination helper instead of manual HTTP/JSON handling. ChangesAzure Retail Pricing Type Consolidation
🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review Generated by Claude Code |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR details
gh pr view 843 --repo LeanerCloud/CUDly
echo "=== PR FILES ==="
gh pr diff 843 --repo LeanerCloud/CUDlyLength of output: 25104 🏁 Script executed: #!/bin/bash
echo "=== pricing package files ==="
find providers/azure/internal/pricing -type f | sort
echo ""
echo "=== pricing package contents ==="
find providers/azure/internal/pricing -type f -name "*.go" | sort | while read f; do
echo "--- $f ---"
cat "$f"
echo ""
done
echo "=== savingsplans credential usage ==="
grep -n "cred\|credential\|Bearer\|GetToken\|policy\." providers/azure/services/savingsplans/client.go
echo "=== managedredis parsePriceItems termStr ==="
grep -n "termStr\|termYears\|azureTermString\|Years\|Term" providers/azure/services/managedredis/client.go
echo "=== search encoding/json usage ==="
grep -n "json\." providers/azure/services/search/client.go | head -20
echo "=== search fetchAzurePricing callers ==="
grep -n "fetchAzurePricing\|\.Items" providers/azure/services/search/client.go | head -20
echo "=== pricing.FetchAll signature ==="
grep -rn "func FetchAll" providers/azure/internal/pricing/
echo "=== pricing.Page definition ==="
grep -rn "type Page\|Page\[" providers/azure/internal/pricing/
echo "=== DefaultPageTimeout DefaultMaxPages ==="
grep -rn "DefaultPageTimeout\|DefaultMaxPages" providers/azure/internal/pricing/
echo "=== azureTermString usage ==="
grep -rn "azureTermString" providers/azure/Length of output: 19008
Medium —
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
…kage (closes #594) Add pricing.RetailPriceItem (union of all per-service item fields) to providers/azure/internal/pricing/types.go and alias AzureRetailPrice to pricing.Page[pricing.RetailPriceItem] in all six service clients (compute, cache, database, cosmosdb, search, savingsplans) plus managedredis. Replace the three manual pagination loops in search, savingsplans, and managedredis with pricing.FetchAll calls. Remove the seven per-service struct definitions and their duplicated field lists.
…dalignment - Remove CacheRetailPriceItem and DatabaseRetailPriceItem type aliases that triggered revive var-naming; replace all call sites with pricing.RetailPriceItem directly and add azpricing import alias to test files that shadow "pricing" as a local variable name - Fix em-dash and double-space in RetailPriceItem doc comment (types.go) - Reorder struct fields for optimal alignment per betteralign (RetailPriceItem: 184->168 bytes, Page[T]: 32->24 pointer bytes)
Summary
pricing.RetailPriceItemtoproviders/azure/internal/pricing/types.goas the canonical union of all per-service retail price item fieldsAzureRetailPricestruct definitions (compute, cache, database, cosmosdb, search, savingsplans, managedredis) with type aliases pointing topricing.Page[pricing.RetailPriceItem]search,savingsplans, andmanagedredisto usepricing.FetchAll, aligning them with the other four servicesTest plan
go build ./...passesgo test github.com/LeanerCloud/CUDly/providers/azure/...passes (660 tests across 14 packages)Summary by CodeRabbit