Repository navigation
feat(common): cross-provider compute capacity ranking via VCPU+Memory (closes #82) - #841
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 2 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 (2)
✨ 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 review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Add frontend/src/lib/capacity.ts exporting compareByCapacity, a sort comparator that ranks compute recommendations by vCPU (primary), MemoryGB (secondary), and resource_type lexical (tie-break). Absent, null, or zero capacity values sort to the end per the ComputeDetails "0 = unknown" contract and feedback_nullable_not_zero guidance. Adds 16 tests covering basic ordering, null/zero sentinel handling, mixed AWS/Azure/GCP scenarios, reflexivity, and sort symmetry. pkg/common/types.go VCPU+MemoryGB fields were already present (PR #97); this commit wires the cross-provider ranking utility those fields enable. Refs #82
Number.isFinite() replaces the typeof === 'number' guard in extractCapacity so that NaN values (which pass typeof but cause NaN subtraction in compareNullable) are folded into the unknown/null bucket and sort last alongside absent/zero/null fields. The previous code would produce NaN from the subtraction path, violating the Array.prototype.sort contract and causing unstable ordering whenever a details blob contained a NaN vcpu or memory_gb. Adds three discriminating tests via a recRaw() helper that bypasses the existing rec() guard to inject NaN directly into the details blob: NaN vcpu sorts after known vcpu, NaN memory_gb sorts after known memory_gb when vcpu ties, and two all-NaN recs fall back to the resource_type tiebreaker without any NaN-comparison instability. compareByCapacity is left as a utility without wiring to the recommendations table sort: adding a vcpu/memory column requires a UX decision (new RecommendationsColumnId, rendered column header, default direction). See the extractCapacity docstring and issue #82.
Summary
frontend/src/lib/capacity.tsexportingcompareByCapacity, a sort comparator that ranks compute recommendations by vCPU (primary key), MemoryGB (secondary key), andresource_typelexical tie-break -- enabling cross-provider compute capacity ranking across AWS, Azure, and GCP.pkg/common/types.goComputeDetails.VCPU+MemoryGBwere already present (PR perf(common): extend ComputeDetails with VCPU + MemoryGB #97); this commit wires the ranking utility those fields were added to enable.ComputeDetails"0 = unknown" contract andfeedback_nullable_not_zeroguidance.Test plan
frontend/src/__tests__/capacity.test.ts: 16 tests covering vCPU primary sort, MemoryGB secondary sort, resource_type tie-break, null/zero sentinel-last behaviour, mixed AWS/Azure/GCP scenario, reflexivity, and sort symmetrygo build ./...cleantsc --noEmitcleanpkg/commonGo tests: 172 passedCloses #82