Skip to content

feat(reshape): surface staleness banner when Cost Explorer cache is old - #576

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
feat/issue-150-staleness-banner
May 28, 2026
Merged

cristim merged 1 commit into
feat/multicloud-web-frontendfrom
feat/issue-150-staleness-banner

Conversation

@cristim

@cristim cristim commented May 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Backend: getReshapeRecommendations now reads GetRecommendationsFreshness and populates recs_staleness ("" / "soft" / "hard") and recs_collected_at on the response; freshness failures are non-fatal (logged, staleness fields omitted)
  • Frontend: loadReshapeRecommendations calls the new renderReshapeStalenessBanner which inserts a banner slot above the recommendations table using warning/error CSS classes with a relative-time age label
  • Tests: classifyRecsAge unit tests pin the 12h/24h thresholds; frontend banner snapshot tests cover all three staleness states

Closes #150

Test plan

  • go test ./internal/api/... passes
  • cd frontend && npx jest riexchange passes (37 tests)
  • cd frontend && npx tsc --noEmit passes
  • Dev env: pause the scheduler, wait 12h, open RI Exchange tab, verify soft banner appears

@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

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 59 minutes and 50 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: 36c748ab-4cf7-4793-9cd9-f0f2ba75390a

📥 Commits

Reviewing files that changed from the base of the PR and between 9321a59 and 106d4ef.

📒 Files selected for processing (7)
  • 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/riexchange.ts
  • 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/issue-150-staleness-banner

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

@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/s Hours type/feat New capability triaged Item has been triaged labels May 20, 2026
@cristim

cristim commented May 20, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 20, 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 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 22, 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 25, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 25, 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.

…ld (closes #150)

The reshape-recommendations page silently showed alternatives sourced
from a potentially-hours-old Cost Explorer cache with no freshness
signal. This adds a backend staleness classifier and a frontend banner
to warn users when the underlying data is stale.

Backend:
- classifyRecsAge maps an age duration to "" / "soft" / "hard" using
  12 h and 24 h thresholds (mirrors dashboard freshness rule).
- getReshapeRecommendations calls GetRecommendationsFreshness (already
  on StoreInterface) and populates recs_staleness + recs_collected_at
  on ReshapeRecommendationsResponse; freshness failures are non-fatal
  (logged, response ships without staleness metadata).
- getReshapeRecommendations returns the same recs in all cases so no
  existing behaviour changes for the reshape table itself.

Frontend:
- getReshapeRecommendations now returns ReshapeRecommendationsResponse
  instead of a bare array; existing callers updated.
- renderReshapeStalenessBanner inserts a banner slot immediately before
  the recommendations table with "warning" / "error" CSS classes and
  a relative-time age label.
- Test mocks updated to the new response shape; banner unit tests added.
@cristim
cristim force-pushed the feat/issue-150-staleness-banner branch from a027e4d to 106d4ef Compare May 27, 2026 11:23
@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 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 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 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 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@cristim

cristim commented May 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@cristim
cristim merged commit 4529d59 into feat/multicloud-web-frontend May 28, 2026
6 checks passed
@cristim
cristim deleted the feat/issue-150-staleness-banner 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/s Hours impact/many Affects most users priority/p2 Backlog-worthy severity/medium Moderate 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