fix(radar): replace fake nightOwl/diversity with real calendar data#6250
Conversation
|
@vivek0369 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod-Dev
left a comment
There was a problem hiding this comment.
Replacing the synthetic deterministicRandom values for nightOwl and diversity with actual data-driven metrics in lib/svg/radar.ts makes the Radar visualization significantly more valuable and trustworthy. Removing the obsolete seed parameter is also a great cleanup step. Approved!
|
🎉 Congratulations @vivek0369! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
|
Hi @Aamod-Dev and @JhaSourav07 , add label Type bonuses type:bug type:feature type:docs type:testing type:refactor type:design type:accessibility type:performance type:devops type:security |
fix(radar): replace fabricated nightOwl & diversity metrics with real contribution analytics
Description
Closes #5995
This PR removes two placeholder metrics from the Radar visualization and replaces them with values derived from real contribution data.
Previously, the
nightOwlanddiversityaxes were generated using deterministic random values. While these values were stable between renders, they did not represent actual user behavior, resulting in a Radar chart where 2 of the 6 displayed metrics were synthetic rather than data-driven.This change ensures that every Radar metric is calculated from real contribution information already available in the existing
ContributionCalendarpayload, with no additional API requests required.Why This Change?
The Radar chart is intended to provide meaningful insights into a user's contribution patterns. However, the current implementation relies on deterministic random values for two metrics:
This creates a data integrity issue because:
33% of the Radar chart is based on fabricated values.
Metrics can change without any corresponding change in user behavior.
Users may assume all Radar insights are backed by actual GitHub data.
The visualization becomes less trustworthy as an analytics tool.
What Changed?
Replace
nightOwlwith a real behavioral proxyThe new implementation derives a score from actual weekday contribution patterns:
Implementation details:
Iterates through existing contribution calendar data.
Counts contributions made Monday–Thursday (
weeknightCommits).Compares them against total weekday contributions (
weekdayCommits).Produces a normalized value between
0and1.Benefits:
Uses real contribution activity.
Requires no new data sources.
Provides a meaningful proxy for consistent weekday coding behavior.
Replace
diversitywith repository contribution diversityThe new metric uses repository participation data already available in the calendar payload:
Implementation details:
Uses the existing
repoContributionsfield.Measures repository participation breadth.
Normalizes the value using 20 repositories as the upper threshold.
Benefits:
Reflects actual contribution diversity.
Rewards activity across multiple repositories.
Eliminates synthetic scoring.
Requires no API or schema changes.
Additional Cleanup
As part of this refactor:
Removed the unused
deterministicRandomimport.Removed the obsolete
seedvariable.Removed the associated CodeQL suppression comment.
Simplified Radar metric calculation logic.
Function Signature
Before:
After:
Since Radar metrics are now fully data-driven, the seed parameter is no longer necessary.
Files Modified
Testing
Night Owl Metric
Heavy Monday–Thursday contributors produce higher scores.
Primarily weekend contributors produce lower scores.
Users with no weekday contributions receive a score of
0.Diversity Metric
repoContributions = 10→0.5repoContributions >= 20→1.0Missing value → fallback
0.3Verification
No API changes.
No GraphQL changes.
No breaking interface changes.
Existing Radar rendering continues to work as expected.
All Radar axes are now backed by real contribution data.
Impact
This PR improves the accuracy, transparency, and reliability of CommitPulse analytics by ensuring that every Radar metric represents actual contribution behavior rather than deterministic placeholder values.
Type of Change
Bug fix (non-breaking change)
Code quality improvement
Data integrity enhancement
Analytics accuracy improvement