Repository navigation
feat(aws/recs): populate ComputeDetails.VCPU/MemoryGB via DescribeInstanceTypes (closes #218) - #816
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Coordination note: PR #842 (closes #99) implements the same DescribeInstanceTypes VCPU/MemoryGB population path independently. The two PRs are effectively duplicates. Whichever lands first should be merged; the other should be closed (or rebased to a tightening-only delta). Both currently open; flagging so the merger doesn't accidentally land both. |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
@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
|
…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.
Fix two pre-commit failures: - sku_test.go: gofmt reorders imports into canonical alphabetical order - parser_services.go: extract resolveEC2Tenancy, resolveEC2Scope, and enrichFromCatalogue helpers from parseEC2Details; complexity drops from 14 to 7, clearing the gocyclo hook
|
Rebased on feat/multicloud-web-frontend. Resolved conflict in providers/aws/recommendations/parser_services.go and parser_services_test.go (parseMemoryDBDetails signature: kept fail-loudly semantics from base, restored context.Context param for serviceParserFunc type consistency). |
|
@coderabbitai review |
✅ Action performedReview finished.
|
…ctx; drop em-dashes The ComputeDetails VCPU/MemoryGB implementation landed via the merged duplicate PR #816 (closes #218). This commit grafts the two test-coverage gaps that #816 missed, plus a comment cleanup: - TestExtractInstanceTypeSKUEntry: add sub-case "MemoryInfo present but SizeInMiB nil" -- expects VCPU populated, MemGB 0.0. - TestFetchInstanceTypeCatalogue_ContextCanceled: assert that pager.callCount remains 0 after a pre-canceled ctx returns nil (the stub already tracks the count via atomic; this makes the no-NextPage contract explicit). - Replace em-dashes (U+2014) with "--" in sku.go warn messages and in the client.go instanceTypeLookup comment. parser_services.go em-dashes left for a follow-up (out of scope here). Closes #99
…ctx; drop em-dashes The ComputeDetails VCPU/MemoryGB implementation landed via the merged duplicate PR #816 (closes #218). This commit grafts the two test-coverage gaps that #816 missed, plus a comment cleanup: - TestExtractInstanceTypeSKUEntry: add sub-case "MemoryInfo present but SizeInMiB nil" -- expects VCPU populated, MemGB 0.0. - TestFetchInstanceTypeCatalogue_ContextCanceled: assert that pager.callCount remains 0 after a pre-canceled ctx returns nil (the stub already tracks the count via atomic; this makes the no-NextPage contract explicit). - Replace em-dashes (U+2014) with "--" in sku.go warn messages and in the client.go instanceTypeLookup comment. parser_services.go em-dashes left for a follow-up (out of scope here). Closes #99
…ctx; drop em-dashes The ComputeDetails VCPU/MemoryGB implementation landed via the merged duplicate PR #816 (closes #218). This commit grafts the two test-coverage gaps that #816 missed, plus a comment cleanup: - TestExtractInstanceTypeSKUEntry: add sub-case "MemoryInfo present but SizeInMiB nil" -- expects VCPU populated, MemGB 0.0. - TestFetchInstanceTypeCatalogue_ContextCanceled: assert that pager.callCount remains 0 after a pre-canceled ctx returns nil (the stub already tracks the count via atomic; this makes the no-NextPage contract explicit). - Replace em-dashes (U+2014) with "--" in sku.go warn messages and in the client.go instanceTypeLookup comment. parser_services.go em-dashes left for a follow-up (out of scope here). Closes #99
…ctx; drop em-dashes The ComputeDetails VCPU/MemoryGB implementation landed via the merged duplicate PR #816 (closes #218). This commit grafts the two test-coverage gaps that #816 missed, plus a comment cleanup: - TestExtractInstanceTypeSKUEntry: add sub-case "MemoryInfo present but SizeInMiB nil" -- expects VCPU populated, MemGB 0.0. - TestFetchInstanceTypeCatalogue_ContextCanceled: assert that pager.callCount remains 0 after a pre-canceled ctx returns nil (the stub already tracks the count via atomic; this makes the no-NextPage contract explicit). - Replace em-dashes (U+2014) with "--" in sku.go warn messages and in the client.go instanceTypeLookup comment. parser_services.go em-dashes left for a follow-up (out of scope here). Closes #99
…ctx; drop em-dashes The ComputeDetails VCPU/MemoryGB implementation landed via the merged duplicate PR #816 (closes #218). This commit grafts the two test-coverage gaps that #816 missed, plus a comment cleanup: - TestExtractInstanceTypeSKUEntry: add sub-case "MemoryInfo present but SizeInMiB nil" -- expects VCPU populated, MemGB 0.0. - TestFetchInstanceTypeCatalogue_ContextCanceled: assert that pager.callCount remains 0 after a pre-canceled ctx returns nil (the stub already tracks the count via atomic; this makes the no-NextPage contract explicit). - Replace em-dashes (U+2014) with "--" in sku.go warn messages and in the client.go instanceTypeLookup comment. parser_services.go em-dashes left for a follow-up (out of scope here). Closes #99

Summary
Clientinstance-type SKU catalogue fetched once per lifetime viaec2:DescribeInstanceTypes(paginated), cached withsync.OnceComputeDetails.VCPUandMemoryGBinparseEC2Detailsfrom the catalogue; falls back to 0 on cache miss or fetch failure (graceful degradation, mirrors Azure PR feat(azure/recs): populate ComputeDetails.VCPU/MemoryGB via cached SKU lookup (closes #217) #810)context.ContextthroughparseRecommendations->parseRecommendationDetail->parseServiceSpecificDetails-> service parsers to carry cancellation to the catalogue walkIAM
ec2:DescribeInstanceTypesis covered by the existingec2:Describe*wildcard in the deploy SAs; no new policy statement required.Test plan
go build ./...cleango test github.com/LeanerCloud/CUDly/providers/aws/recommendations/...-- 293 tests pass (280 before + 13 new)TestExtractInstanceTypeSKUEntry-- field extraction fromInstanceTypeInfoTestFetchInstanceTypeCatalogue_PopulatesMap-- paginator walk produces correct mapTestFetchInstanceTypeCatalogue_PageError-- nil on page error (graceful degradation)TestFetchInstanceTypeCatalogue_ContextCanceled-- nil when ctx already canceled (ctx_cancel_terminal)TestInstanceTypeLookup_CachedOnce-- pager factory called exactly once per client lifetime (N+1 invariant)TestParseEC2Details_VCPUAndMemoryPopulated-- VCPU/MemoryGB populated from catalogueTestParseEC2Details_CatalogueMiss-- 0/0 on miss, conversion succeedsTestParseEC2Details_NoCatalogueConfigured-- 0/0 when no factory set, conversion succeeds