Bug Description
computeHealthScore() and computeActivityClassification() in src/services/analytics.js
parse repo.pushed_at with an unguarded new Date(repo.pushed_at). GitHub can return
pushed_at as null or omit it (e.g. a newly created or empty repository), and in those
cases both functions produce incorrect output with no error:
- pushed_at missing (undefined) -> computeHealthScore returns NaN, which renders in the
UI and corrupts any sorting/averaging that consumes the score.
- pushed_at: null -> new Date(null) resolves to the Unix epoch (1970), so
computeHealthScore returns a plausible-looking but wrong value and
computeActivityClassification labels the repo "Hibernating" — a confidently incorrect
classification for what may be a brand-new repo.
getTopRepositories() in the same file already guards this exact case:
Number.isFinite(pushedAtMs) ? ... : Infinity. The guard just wasn't applied to the two
functions above, so the codebase is internally inconsistent about handling the same field.
Steps to Reproduce
- Open src/services/analytics.js.
- Call the functions with a repo that has no valid pushed_at, e.g. in a node REPL:
import { computeHealthScore, computeActivityClassification } from './src/services/analytics.js'
computeHealthScore({ open_issues_count: 2 }, 1) // -> NaN
computeHealthScore({ pushed_at: null, open_issues_count: 0 }, 3) // -> 39 (misleading)
computeActivityClassification({ pushed_at: null }) // -> "Hibernating" (wrong)
- Observe: no error is thrown; the NaN / epoch-derived values flow into the analytics model and the UI.
Logs and Screenshots
Reproduced locally on main (Node v22.17.0):
computeHealthScore({ pushed_at: null }): 39 (plausible but wrong)
computeActivityClassification({ pushed_at: null }): Hibernating (wrong label)
computeHealthScore({ pushed_at: undefined }): NaN
Environment Details
- OS: Windows (MINGW64 / Git Bash)
- Browser: Chrome
- Node.js: 22.17.0
- Branch: main
- Affected functions: computeHealthScore, computeActivityClassification (src/services/analytics.js)
- Existing tests in src/services/analytics.healthMetrics.test.js only feed valid dates,
so this path is currently uncovered.
Impact
Medium - Feature works but has issues
Code of Conduct
Bug Description
computeHealthScore() and computeActivityClassification() in src/services/analytics.js
parse repo.pushed_at with an unguarded
new Date(repo.pushed_at). GitHub can returnpushed_at as null or omit it (e.g. a newly created or empty repository), and in those
cases both functions produce incorrect output with no error:
UI and corrupts any sorting/averaging that consumes the score.
computeHealthScore returns a plausible-looking but wrong value and
computeActivityClassification labels the repo "Hibernating" — a confidently incorrect
classification for what may be a brand-new repo.
getTopRepositories() in the same file already guards this exact case:
Number.isFinite(pushedAtMs) ? ... : Infinity. The guard just wasn't applied to the twofunctions above, so the codebase is internally inconsistent about handling the same field.
Steps to Reproduce
Logs and Screenshots
Reproduced locally on main (Node v22.17.0):
Environment Details
so this path is currently uncovered.
Impact
Medium - Feature works but has issues
Code of Conduct