Skip to content

feat(inventory/ri-exchange): honor Main Header global filter (closes #871)#906

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
feat/871-riexchange-global-filter
Jun 1, 2026
Merged

feat(inventory/ri-exchange): honor Main Header global filter (closes #871)#906
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
feat/871-riexchange-global-filter

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented Jun 1, 2026

Summary

Makes the Inventory & Coverage > RI Exchange sub-tab honor the Main Header global Provider/Account filter, resolving QA Main Header 2.9 (#871). RI Exchange was the last Inventory sub-tab that ignored the global chips; Active Commitments and Coverage already honor them via the wireChipSubscriptions / isInventoryTabActive / queueMicrotask-coalescing + subscribeProvider/subscribeAccount pattern landed in #866 / #881. This PR mirrors that pattern for RI Exchange.

Behavior

  • Provider = AWS -> AWS exchangeable convertible RIs only (existing flow), scoped to the selected account.
  • Provider = Azure -> Azure exchangeable VM reservations only; reshape recommendations show a provider-aware "not available for Azure" note (reshape is an AWS Cost Explorer concept).
  • Provider = GCP -> "RI Exchange isn't available for GCP" empty state across all sections; no list endpoint is called, no stale rows remain.
  • Account/subscription chip -> narrows the list; empty states name the scope ("No exchangeable reservations for /").
  • Filter change clears the in-progress exchange selection -> the quote/execute modal closes synchronously on any chip change so the user can't act on a now-hidden RI (mutating workflow).

Backend

  • GET /api/ri-exchange/instances now accepts ?account_id=. Convertible RIs come from the deployment's ambient AWS credentials (one account); when the chip selects a different account, the handler returns an empty list (not an error). A real STS resolution failure fails closed (propagates the error) rather than leaking the ambient account's RIs.
  • Azure already scopes by subscription_id. GCP has no endpoint; the frontend short-circuits to the empty state.

Tests

  • Frontend: chip change reloads the scoped list; GCP not-available state; Azure path renders reservations; selection cleared on filter change; scoped empty-state copy.
  • Backend: account-scope mismatch returns an empty list; resolve-error fails closed.

tsc, full jest (2172 pass), and go test ./internal/api/... (1359 pass) all green.

Closes #871.

…871)

RI Exchange was the last Inventory sub-tab that ignored the Main Header
Provider/Account chips; Active Commitments and Coverage already honor them
(PR #866/#881). QA 2.9.

Frontend (riexchange.ts):
- loadRIExchange is now provider-aware. AWS shows convertible RIs + reshape
  recs + history; Azure shows exchangeable VM reservations + history with a
  provider-aware "reshape not available" note; GCP shows a "RI Exchange isn't
  available for GCP" empty state across all sections and calls no list
  endpoint.
- The convertible-RI list is scoped to the single-selected account chip and
  renders scoped, provider-aware empty states (named account/subscription).
- An in-progress exchange modal is closed synchronously on any filter change
  so the user can't act on a now-hidden RI (mutating workflow).
- New Azure table built via DOM/textContent (no innerHTML).

Backend (handler_ri_exchange.go):
- listConvertibleRIs accepts ?account_id= and returns an empty list when the
  chip selects an account other than the running ambient AWS account; a real
  STS failure fails closed. Azure already scopes by subscription_id; GCP has
  no endpoint (frontend short-circuits to empty).

Tests: frontend chip-scoping, GCP not-available state, Azure path, and
selection-clear on filter change; backend account-scope mismatch returns
empty and resolve-error fails closed.
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/m Days type/feat New capability labels Jun 1, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 55 minutes and 15 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e1c0d7a9-dbc7-4bde-b6b2-f24d90519747

📥 Commits

Reviewing files that changed from the base of the PR and between 9476456 and afa3691.

📒 Files selected for processing (9)
  • frontend/src/__tests__/riexchange-permissions.test.ts
  • frontend/src/__tests__/riexchange.test.ts
  • frontend/src/api/index.ts
  • frontend/src/api/riexchange.ts
  • frontend/src/api/types.ts
  • frontend/src/riexchange.ts
  • internal/api/handler.go
  • internal/api/handler_ri_exchange.go
  • internal/api/handler_ri_exchange_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/871-riexchange-global-filter

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

@cristim
Copy link
Copy Markdown
Member Author

cristim commented Jun 1, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

✅ 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
Copy link
Copy Markdown
Member Author

cristim commented Jun 1, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

✅ 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
Copy link
Copy Markdown
Member Author

cristim commented Jun 1, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

✅ 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 merged commit 73b3ac9 into feat/multicloud-web-frontend Jun 1, 2026
6 checks passed
@cristim cristim deleted the feat/871-riexchange-global-filter branch June 3, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/many Affects most users priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/feat New capability urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant