Bug Description
computeHealthScore() in src/services/analytics.js computes issueHealth with an
unguarded repo.open_issues_count:
const total = (repo.open_issues_count || 0) + 10
const issueHealth = Math.max(0, 100 - (repo.open_issues_count / total) * 100)
The total line defends against a missing open_issues_count with || 0, but the
issueHealth line uses the bare repo.open_issues_count. When the field is absent,
undefined / total is NaN, so issueHealth is NaN and the whole score collapses to
NaN — which then renders in the UI and corrupts any sorting/averaging built on it.
GitHub can omit open_issues_count, and the inconsistency (guarded on one line,
unguarded on the very next) makes this a clear oversight rather than intended behavior.
Steps to Reproduce
- Open src/services/analytics.js.
- Call computeHealthScore with a repo that has a valid pushed_at but no open_issues_count:
import { computeHealthScore } from './src/services/analytics.js'
computeHealthScore({ pushed_at: new Date().toISOString() }, 2) // -> NaN
- Observe: the score is NaN, with no error thrown.
Logs and Screenshots
Reproduced locally on main (Node v22.17.0):
computeHealthScore({ pushed_at: <valid ISO>, /* no open_issues_count */ }, 2): NaN
computeHealthScore({}, 3): NaN
Environment Details
- OS: Windows (MINGW64 / Git Bash)
- Browser: Chrome
- Node.js: 22.17.0
- Branch: main
- Affected function: computeHealthScore (src/services/analytics.js, issueHealth line)
- Note: the sibling
total line already guards this field with || 0; the fix is to
apply the same guard on the issueHealth line.
Impact
Medium - Feature works but has issues
Code of Conduct
Bug Description
computeHealthScore() in src/services/analytics.js computes issueHealth with an
unguarded repo.open_issues_count:
const total = (repo.open_issues_count || 0) + 10
const issueHealth = Math.max(0, 100 - (repo.open_issues_count / total) * 100)
The
totalline defends against a missing open_issues_count with|| 0, but theissueHealth line uses the bare
repo.open_issues_count. When the field is absent,undefined / totalis NaN, so issueHealth is NaN and the whole score collapses toNaN — which then renders in the UI and corrupts any sorting/averaging built on it.
GitHub can omit open_issues_count, and the inconsistency (guarded on one line,
unguarded on the very next) makes this a clear oversight rather than intended behavior.
Steps to Reproduce
Logs and Screenshots
Reproduced locally on main (Node v22.17.0):
Environment Details
totalline already guards this field with|| 0; the fix is toapply the same guard on the issueHealth line.
Impact
Medium - Feature works but has issues
Code of Conduct