Skip to content

fix(analytics): normalize health score for missing contributor data - #365

Open
rishiiicreates wants to merge 1 commit into
AOSSIE-Org:mainfrom
rishiiicreates:fix/health-score-missing-contributor-normalization
Open

rishiiicreates wants to merge 1 commit into
AOSSIE-Org:mainfrom
rishiiicreates:fix/health-score-missing-contributor-normalization

Conversation

@rishiiicreates

@rishiiicreates rishiiicreates commented Oct 17, 2026 •

Copy link
Copy Markdown

Addressed Issues

Fixes #361

Additional Notes

distinguishes between un-fetched contributor data and a genuine count of zero contributors. in no-pat mode contributor data is fetched only for the top 10 repos, so other repos were falling back to an empty array and getting scored with 0 diversity, penalizing active repos by 30 points.

now if contributor data was never fetched for a repo, activity (40%) and issue health (30%) are renormalized to 100% so scores stay fair and comparable. if contributor data was fetched and actually has 0 contributors, the diversity penalty is preserved as expected.

verified with unit tests in healthMetrics.test.js and buildAnalyticalModel.test.js, and production build passes cleanly.

Summary by CodeRabbit

  • Bug Fixes
    • Health scores now distinguish between unavailable contributor data and a repository with no contributors. Scores are normalized when contributor data is unavailable, while the diversity penalty remains when an empty contributor list is available.

Distinguish between un-fetched contributor data and a genuine count of zero contributors. When contributor data is un-fetched in No-PAT mode, renormalize Activity (40%) and Issue Health (30%) to 100%. When contributor data is fetched, retain existing weights including diversity penalties for zero contributors.

Fixes AOSSIE-Org#361
Copilot AI balanced review requested due to automatic review settings October 17, 2026 15:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions github-actions Bot added the bug Something isn't working label Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: AOSSIE-Org/OrgExplorer/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3212f704-a1a3-43e5-80fb-7d71006f27d5
📥 Commits

Reviewing files that changed from the base of the PR and between 766c4e3 and d16c0ca.

📒 Files selected for processing: 3
  • src/services/analytics.buildAnalyticalModel.test.js
  • src/services/analytics.healthMetrics.test.js
  • src/services/analytics.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The health score calculation now distinguishes unavailable contributor data from a fetched count of zero. The analytical model passes this distinction to the calculation. Tests cover both cases.

Changes

Contributor Data Health Scoring

Layer / File(s) Summary
Health score calculation
src/services/analytics.js, src/services/analytics.healthMetrics.test.js
computeHealthScore normalizes Activity and Issue Health weights when the contributor count is unavailable. For a supplied count, it clamps the Diversity score to 0–100. Tests cover unavailable data and a fetched count of zero.
Contributor data availability
src/services/analytics.js, src/services/analytics.buildAnalyticalModel.test.js
buildAnalyticalModel passes null when contributor data is missing or undefined. It passes the contributor list length when data is present, including an empty list. Tests assert scores of 100 for unavailable data and 70 for an empty fetched list.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: Typescript Lang

Suggested reviewers: ri1tik

Merge Risk: ⚪ Minimal · up to d16c0

Repository health scores now distinguish unavailable contributor data from a confirmed zero count. No identified issue blocks merging after normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: normalizing health scores when contributor data is missing.
Linked Issues check Passed Issue #361 requires separate handling for unavailable contributor data and a valid zero count. buildAnalyticalModel checks whether the repository key exists in contribsPerRepo. It passes null fo…
Out of Scope Changes check Passed The changed production code is limited to contributor-data detection and health-score calculation in src/services/analytics.js. The added tests verify the linked issue behavior. The input guards in …
Full details: Linked Issues check

Explanation

Issue #361 requires separate handling for unavailable contributor data and a valid zero count. buildAnalyticalModel checks whether the repository key exists in contribsPerRepo. It passes null for missing or undefined data and passes contribs.length for available data, including an empty list. computeHealthScore renormalizes Activity and Issue Health when the count is nullish and retains the 40%/30%/30% weights for a valid count. Tests cover both paths in analytics.healthMetrics.test.js and analytics.buildAnalyticalModel.test.js.

Full details: Out of Scope Changes check

Explanation

The changed production code is limited to contributor-data detection and health-score calculation in src/services/analytics.js. The added tests verify the linked issue behavior. The input guards in the same calculation path do not establish an unrelated change.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the scores at dawn
Missing counts no longer weigh them down
A fetched zero keeps its place
Activity and issues set the pace
The burrow hops along its way

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

@github-actions github-actions Bot added javascript JavaScript/TypeScript changes tests Test changes size/M 51-200 lines changed first-time-contributor First time contributor and removed size/M 51-200 lines changed labels Oct 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working first-time-contributor First time contributor javascript JavaScript/TypeScript changes size/M 51-200 lines changed tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Missing Contributor Data Incorrectly Lowers Repository Health Score

2 participants