feat(azure/recs): populate ComputeDetails.VCPU/MemoryGB via cached SKU lookup (closes #217) - #810
feat(azure/recs): populate ComputeDetails.VCPU/MemoryGB via cached SKU lookup (closes #217)#810cristim wants to merge 1 commit into
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated documentation and test for ChangesSKU Catalogue Cancellation Semantics
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
…217) Treat context.Canceled/DeadlineExceeded as hard stops in the fetchSKUCatalogue pagination loop per feedback_ctx_cancel_terminal.md. VCPU/MemoryGB fall back to 0 on cancellation, matching the existing pager-error graceful-degradation contract. New test pins the invariant: a pre-cancelled context skips all NextPage calls and returns a nil catalogue.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
#219) Add a new "Capacity" column to the recommendations table immediately after "Resource Type". The column renders "N vCPU / M GB" when the backend populates ComputeDetails.VCPU and ComputeDetails.MemoryGB (populated by PRs #810/#816/#833 for Azure/AWS/GCP). Recs without those fields show a dash, matching the feedback_nullable_not_zero rule. Changes: - types.ts: add vcpu/memory_gb optional fields to LocalRecommendation - state.ts: add 'capacity' to RecommendationsColumnId - recommendations.ts: add COLUMN_DEFS entry, formatCapacity() helper, and cases in categoricalCellValue/numericCellValue/displayPrecision/ renderColumnCell; all innerHTML values go through escapeHtml() - tests: +11 tests (formatCapacity unit, capacity filter, column count and position assertions); update 5 hardcoded td-index/column-list assertions shifted by the new column
#219) Add a new "Capacity" column to the recommendations table immediately after "Resource Type". The column renders "N vCPU / M GB" when the backend populates ComputeDetails.VCPU and ComputeDetails.MemoryGB (populated by PRs #810/#816/#833 for Azure/AWS/GCP). Recs without those fields show a dash, matching the feedback_nullable_not_zero rule. Changes: - types.ts: add vcpu/memory_gb optional fields to LocalRecommendation - state.ts: add 'capacity' to RecommendationsColumnId - recommendations.ts: add COLUMN_DEFS entry, formatCapacity() helper, and cases in categoricalCellValue/numericCellValue/displayPrecision/ renderColumnCell; all innerHTML values go through escapeHtml() - tests: +11 tests (formatCapacity unit, capacity filter, column count and position assertions); update 5 hardcoded td-index/column-list assertions shifted by the new column
#219) Add a new "Capacity" column to the recommendations table immediately after "Resource Type". The column renders "N vCPU / M GB" when the backend populates ComputeDetails.VCPU and ComputeDetails.MemoryGB (populated by PRs #810/#816/#833 for Azure/AWS/GCP). Recs without those fields show a dash, matching the feedback_nullable_not_zero rule. Changes: - types.ts: add vcpu/memory_gb optional fields to LocalRecommendation - state.ts: add 'capacity' to RecommendationsColumnId - recommendations.ts: add COLUMN_DEFS entry, formatCapacity() helper, and cases in categoricalCellValue/numericCellValue/displayPrecision/ renderColumnCell; all innerHTML values go through escapeHtml() - tests: +11 tests (formatCapacity unit, capacity filter, column count and position assertions); update 5 hardcoded td-index/column-list assertions shifted by the new column
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
…tanceTypes (closes #218) Add a per-Client instance-type SKU catalogue fetched once per scheduler tick via ec2:DescribeInstanceTypes (paginated, sync.Once cached). parseEC2Details now enriches ComputeDetails.VCPU and MemoryGB from the catalogue; catalogue miss or fetch failure leaves both fields at 0 (graceful degradation, mirrors Azure PR #810). Context is threaded through parseRecommendations/parseRecommendationDetail/ parseServiceSpecificDetails so the paginator walk honours cancellation (ctx_cancel_terminal pattern). IAM: ec2:DescribeInstanceTypes is covered by the existing ec2:Describe* wildcard; no new policy statement required. Tests: 293 pass (+13 new) including one-call-per-lifetime invariant, page-error graceful degradation, and ctx-cancel short-circuit.
…tanceTypes (closes #99) Add a per-Client instance-type SKU catalogue fetched once per lifetime via ec2:DescribeInstanceTypes (paginated, sync.Once), cached as a map[string]instanceTypeSKUEntry. parseEC2Details now enriches ComputeDetails.VCPU and MemoryGB from the catalogue; falls back to 0 on cache miss or fetch failure (graceful degradation, mirrors Azure #810). Context cancellation is treated as a hard stop per feedback_ctx_cancel_terminal.md. Thread context.Context through parseRecommendations -> parseRecommendationDetail -> parseServiceSpecificDetails -> all service parsers so cancellation propagates to the catalogue walk. New tests: TestExtractInstanceTypeSKUEntry, TestFetchInstanceTypeCatalogue_* (3 cases), TestInstanceTypeLookup_CachedOnce, TestParseEC2Details_VCPUAndMemoryPopulated, _CatalogueMiss, _NoCatalogueConfigured (293 tests total, +13 new).
|
Verification note: the #217 deliverable (populate ComputeDetails.VCPU/MemoryGB via cachedSKULookup) and its positive acceptance test (Standard_D2s_v3 -> VCPU=2, MemoryGB=8) already exist on base feat/multicloud-web-frontend (landed via #148/#229), and the ctx.Err() guard this PR's body claims to add is also already present. The diff here is effectively a doc-comment reword + a cancellation-path regression test; it does not implement the population. Suggest retitling to reflect the real content (cancellation-path test + comment) and NOT auto-closing #217 on the premise of population work it doesn't contain. Leaving for a human to decide. |
…tanceTypes (closes #99) Add a per-Client instance-type SKU catalogue fetched once per lifetime via ec2:DescribeInstanceTypes (paginated, sync.Once), cached as a map[string]instanceTypeSKUEntry. parseEC2Details now enriches ComputeDetails.VCPU and MemoryGB from the catalogue; falls back to 0 on cache miss or fetch failure (graceful degradation, mirrors Azure #810). Context cancellation is treated as a hard stop per feedback_ctx_cancel_terminal.md. Thread context.Context through parseRecommendations -> parseRecommendationDetail -> parseServiceSpecificDetails -> all service parsers so cancellation propagates to the catalogue walk. New tests: TestExtractInstanceTypeSKUEntry, TestFetchInstanceTypeCatalogue_* (3 cases), TestInstanceTypeLookup_CachedOnce, TestParseEC2Details_VCPUAndMemoryPopulated, _CatalogueMiss, _NoCatalogueConfigured (293 tests total, +13 new).
…tanceTypes (closes #99) Add a per-Client instance-type SKU catalogue fetched once per lifetime via ec2:DescribeInstanceTypes (paginated, sync.Once), cached as a map[string]instanceTypeSKUEntry. parseEC2Details now enriches ComputeDetails.VCPU and MemoryGB from the catalogue; falls back to 0 on cache miss or fetch failure (graceful degradation, mirrors Azure #810). Context cancellation is treated as a hard stop per feedback_ctx_cancel_terminal.md. Thread context.Context through parseRecommendations -> parseRecommendationDetail -> parseServiceSpecificDetails -> all service parsers so cancellation propagates to the catalogue walk. New tests: TestExtractInstanceTypeSKUEntry, TestFetchInstanceTypeCatalogue_* (3 cases), TestInstanceTypeLookup_CachedOnce, TestParseEC2Details_VCPUAndMemoryPopulated, _CatalogueMiss, _NoCatalogueConfigured (293 tests total, +13 new).
|
Closing as a no-op: the #217 Azure ComputeDetails VCPU/MemoryGB enrichment already shipped on base via #148/#229 (cachedSKULookup populates the fields). This PR only adds a doc-comment reword + a ctx-cancel test that passes against pre-PR code, and 'closes #217' would be misleading. The cancellation-path test is worth keeping - feel free to re-propose it standalone. |
Summary
ctx.Err()guard at the top of thefetchSKUCataloguepagination loop so context cancellation is terminal, matchingfeedback_ctx_cancel_terminal.md.Details.VCPUandDetails.MemoryGBgracefully fall back to 0 on cancellation (same contract as the pager-error path from PR perf(azure): batched SKU catalogue lookup eliminates N+1 in recommendation converters #81).TestComputeClient_FetchSKUCatalogue_CancelledContextFallsBackpins the invariant: a pre-cancelled context skips allNextPagecalls and returns a nil catalogue.The underlying VCPU/MemoryGB population via
armcompute.ResourceSKUsClient.NewListPagerwas landed in PR #229 (closes #148). This PR adds the missing context-cancellation guard and the test that pins it.Test plan
go build ./...fromproviders/azure/— cleango test ./services/compute/— 62 passed (1 new)go test ./...fromproviders/azure/— 661 passed across 14 packagesSummary by CodeRabbit
Documentation
Tests