Skip to content

feat(common): cross-provider compute capacity ranking via VCPU+Memory (closes #82) - #841

Merged
cristim merged 2 commits into
mainfrom
fix/82-wave13
Jul 19, 2026
Merged

cristim merged 2 commits into
mainfrom
fix/82-wave13

Conversation

@cristim

@cristim cristim commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds frontend/src/lib/capacity.ts exporting compareByCapacity, a sort comparator that ranks compute recommendations by vCPU (primary key), MemoryGB (secondary key), and resource_type lexical tie-break -- enabling cross-provider compute capacity ranking across AWS, Azure, and GCP.
  • pkg/common/types.go ComputeDetails.VCPU + MemoryGB were already present (PR perf(common): extend ComputeDetails with VCPU + MemoryGB #97); this commit wires the ranking utility those fields were added to enable.
  • Absent, null, or zero capacity values sort to the end (not the front) per the ComputeDetails "0 = unknown" contract and feedback_nullable_not_zero guidance.

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 symmetry
  • go build ./... clean
  • tsc --noEmit clean
  • pkg/common Go tests: 172 passed

Closes #82

@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/few Limited audience effort/m Days type/feat New capability labels May 28, 2026
@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7de50f57-04b6-4375-a534-60a86f5d29ab

📥 Commits

Reviewing files that changed from the base of the PR and between 1d9f1b8 and e090cc7.

📒 Files selected for processing (2)
  • frontend/src/__tests__/capacity.test.ts
  • frontend/src/lib/capacity.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/82-wave13

Comment @coderabbitai help to get the list of available commands.

@cristim

cristim commented May 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@cristim

cristim commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@cristim have exceeded the limit for the number of chat messages per hour. Please wait 39 minutes and 36 seconds before sending another message.

@cristim

cristim commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@cristim
cristim changed the base branch from feat/multicloud-web-frontend to main June 9, 2026 15:44
@cristim

cristim commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

cristim added 2 commits July 17, 2026 21:21
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.
@cristim
cristim merged commit 222b450 into main Jul 19, 2026
20 checks passed
@cristim
cristim deleted the fix/82-wave13 branch July 27, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/few Limited audience priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/feat New capability urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(common): extend ComputeDetails with vCPU + MemoryGB to unlock Azure compute SKU enrichment

1 participant