feat(adoption-insights): add time-saved backend enrichment and notifications - #3946
feat(adoption-insights): add time-saved backend enrichment and notifications#3946rajin-kichannagari wants to merge 5 commits into
Conversation
…cations - Enrich scaffolder create events with rhdh.redhat.com/time-saved annotation value from catalog entity at write time (RHIDP-15190) - Add time_saved_totals query aggregating by template with SUM/AVG/COUNT - Add periodic notification summary via NotificationService (AC3) - Scheduler runs daily at 9am, lookback per frequency tier - shouldSendForFrequency checks day-of-week/month - Add per-user notification frequency settings (AC4) - notification_preferences DB table with atomic upsert - GET/PUT /notification-preferences REST endpoints - Add admin config flag: adoptionInsights.notifications.enabled (defaults to true, set false to disable notifications entirely) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
PR Summary by QodoAdoption Insights: enrich time-saved events and add notification preferences + scheduler
AI Description
Diagram
High-Level Assessment
Files changed (19)
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3946 +/- ##
========================================
Coverage 57.35% 57.35%
========================================
Files 2384 2385 +1
Lines 95616 95732 +116
Branches 26734 26770 +36
========================================
+ Hits 54838 54909 +71
- Misses 40544 40590 +46
+ Partials 234 233 -1
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
11 rules✅ Cross-repo context Explored:
repo: redhat-developer/rhdh (sha: d090bd1a) Explored:
repo: redhat-developer/rhdh-operator (sha: cde4968e) Explored:
repo: redhat-developer/rhdh-local (sha: 2ae9e8c8) Not relevant to this PR:
redhat-developer/rhdh-chart 1.
|
- Make notificationService optional so plugin doesn't crash when notifications backend isn't installed - Fix CSV export for time_saved_totals (data is object, not array) - Add per-user error isolation in notification scheduler - Guard PUT /notification-preferences against null/undefined body - Parallelize catalog enrichment in event ingestion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The installed @backstage/backend-plugin-api version doesn't expose .optional() on ServiceRef. Keep notificationService as a required dep; the config flag adoptionInsights.notifications.enabled already allows disabling the feature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/fs-review |
|
🤖 Finished Review · ❌ Failure · Started 3:26 AM UTC · Completed 3:44 AM UTC |
ReviewFindingsHigh
Medium
Low
|
- Move auditEvent.success() after enrichment to prevent audit/processing mismatch when a later event in the batch fails validation - Add RBAC authorization to notification-preferences endpoints - Document time_saved_totals query type in Events API table - Document adoptionInsights.notifications.enabled config option - Document notification-preferences REST endpoints - Document @backstage/plugin-notifications-backend prerequisite - Document rhdh.redhat.com/time-saved catalog annotation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
/fs-review |
|
🤖 Finished Review · ❌ Failure · Started 1:50 PM UTC · Completed 2:27 PM UTC |
…ormat Remove useTimeSavedTotals backend API call (API doesn't exist without PR redhat-developer#3946) and compute time saved client-side from entity annotations. Display in compact "1d 6h" format instead of "1 d 6 h". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove NotificationSettings component, useNotificationPreference hook, and notification-related API methods/types (moved to PR redhat-developer#3946) - Delete dead useTimeSavedTotals.tsx hook - Translate compact time units via i18n keys instead of hardcoded d/h/m - Add unit tests for formatTimeSavedCompact - Regenerate API reports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>



Summary
Backend support for the Estimated Time Saved feature in Adoption Insights.
rhdh.redhat.com/time-savedannotation value from catalog entity at write time (RHIDP-15190)time_saved_totalsquery aggregating by template with SUM/AVG/COUNTshouldSendForFrequencychecks day-of-week/monthnotification_preferencesDB table with atomic upsert/notification-preferencesREST endpointsadoptionInsights.notifications.enabled(defaults to true, set false to disable notifications entirely)Hey, I just made a Pull Request!
Backend enrichment and notification scheduler for the Est. Time Saved feature. Reads the
rhdh.redhat.com/time-savedannotation from template entities at event write time and stores the value. Adds a daily notification scheduler that summarizes time saved per user, respecting their frequency preference (daily/weekly/monthly/none). Admins can disable notifications entirely via config.✔️ Checklist