[BUG]: computeHealthScore: NaN when repo.open_issues_count is missing and computeHealthScore: NaN when repo.pushed_at is missing or invalid

未关闭 适合新手
#287 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

@PrithvijitBose 已经在做这个了。

开始于 2026年10月2日。

  • #288 来自 @PrithvijitBose —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript
领域
analytics

调研方向

从 analytics.js 中的 computeHealthScore 开始,跟踪 repo.open_issues_count 和 repo.pushed_at 在分数计算中的完整路径。使用这些字段的缺失值、null 值和无效值测试该函数,然后验证它返回的是有效整数而不是 NaN,并确认按 health-score 排序以及显示的值仍然可用。

由索引模型根据 Issue 内容生成。

描述

bug
Bug Description

First Issue

In analytics.js

Image
  • the code guards against missing values with (repo.open_issues_count || 0)
  • but the Next line it uses the raw repo.open_issues_count
  • If open_issues_count is undefined or null: undefined / 10 evaluates to NaN, poisoning issueHealth and causing computeHealthScore to return NaN.

Second Issue

In analytics.js

Image
  • If repo.pushed_at is null, undefined, or invalid, new Date(repo.pushed_at) produces Invalid Date.
  • Date.now() - NaN is NaN, causing activity and the entire score to become NaN.
Why it's a Problem?
  • Silent Data Corruption: When open_issues_count is undefined or null (e.g., partial API responses, synthetic repos, or mock data), computeHealthScore returns NaN instead of an integer.
  • Breaks Sorting & UI: In JavaScript, NaN in array sorting (b.healthScore - a.healthScore) yields NaN, which breaks the sort order across the table. In the UI, the repository health bar and cards render broken NaN% values.
  • Clear Logical Defect: The author intended to guard against this on line 6 ((repo.open_issues_count || 0)), but accidentally bypassed the guard on line 7.
    (It is not "Critical" only because it doesn't cause a fatal app crash or server downtime, but for the feature itself, it's a high-impact defect).
Environment Details
  • OS: Windows 11
  • Browser: Microsoft Edge
Impact

High - Major feature is broken

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
主要语言
JavaScript
星标
48
派生
169
平均合并
4 天 13 小时
30 天内合并 PR
25

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AOSSIE-Org/OrgExplorer 的其他 Issue

查看 AOSSIE-Org/OrgExplorer 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。