feat(reshape): surface staleness banner when Cost Explorer cache is old#576
feat(reshape): surface staleness banner when Cost Explorer cache is old#576cristim wants to merge 1 commit into
Conversation
…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.
|
Warning Review limit reached
Your plan currently allows 2 reviews/hour. Refill in 26 minutes and 53 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, 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 have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
getReshapeRecommendationsnow readsGetRecommendationsFreshnessand populatesrecs_staleness(""/"soft"/"hard") andrecs_collected_aton the response; freshness failures are non-fatal (logged, staleness fields omitted)loadReshapeRecommendationscalls the newrenderReshapeStalenessBannerwhich inserts a banner slot above the recommendations table usingwarning/errorCSS classes with a relative-time age labelclassifyRecsAgeunit tests pin the 12h/24h thresholds; frontend banner snapshot tests cover all three staleness statesCloses #150
Test plan
go test ./internal/api/...passescd frontend && npx jest riexchangepasses (37 tests)cd frontend && npx tsc --noEmitpasses