feat(analytics): distinguish live from fallback learner-progress data - #1074
Merged
ayomideadeniran merged 1 commit intoAug 3, 2026
Conversation
Enhance the performance-metrics dashboard so users can always tell whether displayed data is live, cached, or fallback: - Track a dataSource state (live | cached | fallback) in usePerformanceMetrics. A failed refresh keeps the last verified live snapshot (cached) instead of silently showing fake numbers; only with no prior live data does it show deterministic sample (fallback) values. - Surface structured AnalyticsError + lastVerifiedAt provenance. - Add DataSourceNotice: an accessible (role=status) live/cached/fallback indicator with a retry action for non-live states. - Export gating: fallback sample data cannot be exported; cached exports are clearly labelled non-live with provenance via createMetricsExport. Adds unit tests covering live, empty, failed, cached, and recovered states. Closes StellarDevHub#888
|
@mubby4 is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@mubby4 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
pr under review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #888
Learner-progress dashboards can now always tell the difference between live, cached, and fallback data. Instead of silently swapping in sample numbers when the analytics API is unavailable, the performance-metrics dashboard states exactly what it is showing.
What changed
Data-source transparency
usePerformanceMetricsnow tracks adataSourcestate:live | cached | fallback.live— freshly verified from the analytics API.cached— the most recent refresh failed, so the last verified snapshot is kept on screen (stale-but-real, never replaced with fake numbers).fallback— no live snapshot has ever been verified; deterministic sample data is shown purely so the UI stays explorable.AnalyticsError(network/timeout/HTTP classification + retriability) viatoAnalyticsError, andlastVerifiedAtprovenance is surfaced.UI (
DataSourceNotice)role="status") indicator that distinguishes:Export integrity
createMetricsExportwithsource: "cached",isLive: false, andlastVerifiedAt, so a downstream consumer can never mistake non-live numbers for a verified record.Tests
usePerformanceMetrics.test.ts).toAnalyticsErrorandcreateMetricsExportlabelling (performanceMetrics.test.ts).All new tests pass (
26/26in the touched suites); the only failing suites in the repo are pre-existing and unrelated (theme/keyboard/tutorial/editor/monaco).