feat(frontend/recs): surface VCPU + MemoryGB in table (closes #219)#840
feat(frontend/recs): surface VCPU + MemoryGB in table (closes #219)#840cristim wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 71 minutes and 29 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
Rebased onto
@coderabbitai review |
|
🧠 Learnings used✅ Action performedReview finished.
|
|
Rebased on Conflict resolution: only Verification (frontend): @coderabbitai review |
|
🧠 Learnings used✅ Action performedReview finished.
|
#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
|
Rebased on Conflict resolution:
Verification post-rebase:
No CR pass yet on this branch - prior @coderabbitai review |
|
🧠 Learnings used✅ Action performedReview finished.
|
|
@coderabbitai review |
Rate Limit Exceeded
|
…s (refs #219) The Capacity column rendered "—" for every recommendation in production. The frontend reads top-level rec.vcpu / rec.memory_gb, but the API never emitted them: VCPU/MemoryGB live nested inside the opaque Details JSON (common.ComputeDetails). The existing tests stayed green because they injected top-level vcpu/memory_gb the real API never produces. Backend (Option A from the issue): buildRecommendationsResponse now decodes each rec's Details via common.DecodeServiceDetailsFor and, when it resolves to a ComputeDetails with a known size (VCPU>0 && MemoryGB>0), stamps top-level VCPU/MemoryGB pointers on the record. The api layer may import pkg/common; config may not, so the fields are derived-on-read (dynamodbav:"-") and use pointers + omitempty so non-compute, legacy, and unknown-size recs omit them rather than emit a misleading 0. Frontend: add vcpu/memory_gb to the Recommendation type. The existing column code (formatCapacity, renders "—" on absent/0, escapes the value) needed no change once the backend actually populates the fields. Tests: - Backend regression on buildRecommendationsResponse feeds the REAL shape (Details = marshalled ComputeDetails VCPU=8/MemoryGB=32) and asserts the response JSON carries top-level vcpu=8/memory_gb=32; non-compute, unknown-size, and empty-Details recs omit them. Fails against the pre-fix code (no top-level fields emitted). - Frontend render-path test loads a rec with top-level vcpu/memory_gb (the post-fix response shape) and asserts the Capacity cell renders "8 vCPU / 32 GB", while a rec without them renders "—".
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Capacitycolumn to the recommendations table positioned immediately afterResource Type, renderingN vCPU / M GBwhen the backend suppliesComputeDetails.VCPU+ComputeDetails.MemoryGB(populated by PRs feat(azure/recs): populate ComputeDetails.VCPU/MemoryGB via cached SKU lookup (closes #217) #810/feat(aws/recs): populate ComputeDetails.VCPU/MemoryGB via DescribeInstanceTypes (closes #218) #816/perf(azure): wire VCPU/MemoryGB enrichment across providers (closes #98) #833 for Azure/AWS/GCP).—rather than0 vCPU / 0 GB, followingfeedback_nullable_not_zero.Changes
frontend/src/types.ts- addvcpu?: number | nullandmemory_gb?: number | nulltoLocalRecommendationfrontend/src/state.ts- add'capacity'toRecommendationsColumnIdfrontend/src/recommendations.ts-COLUMN_DEFSentry,formatCapacity()helper (exported, mirrors GoGetDetailDescription), cases incategoricalCellValue,numericCellValue,displayPrecision,renderColumnCell; all values go throughescapeHtml()frontend/src/__tests__/recommendations.test.ts- +11 new tests; update 5 hardcodedtd-index and column-list assertions that shifted with the new columnTest plan
npx tsc --noEmit- cleannpx jest src/__tests__/recommendations.test.ts- 330 pass, 0 fail (+11 vs baseline 319)8 vCPU / 32 GBfor a compute rec with populated fields—in the Capacity cell