[BUG]: Governance "Issue Resolution Rate" counts pull requests as issues

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

维护者通常 4 天内回复

@amangupta-12 已经在做这个了。

开始于 2026年10月25日。

  • #413 来自 @amangupta-12 —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
86/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
github, javascript, react

调研方向

在 src/pages/GovernancePage.jsx 中,检查第338–343行附近的 Issue Resolution Rate 计算,并将其筛选逻辑与 issue 中提到的治理检查进行比较。从 repo issue 列表中排除 pull request,然后确认卡片的分母和比率只使用 issue;报告中的 OrgExplorer 示例应统计44个 issue,而不是获取到的100个项目。

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

描述

bug
Bug Description

The Governance "Issue Resolution Rate" card computes each repo's rate from GitHub's
/issues data without excluding pull requests. GitHub's /issues?state=all returns PRs as
well as issues (every PR is also an issue object, identified by a pull_request key), so
merged/closed PRs are counted as resolved issues and the rate is wrong.

In src/pages/GovernancePage.jsx (~lines 338-343):

const repoIssues = allIssues.filter(i => i.repoName === r.name)
const closed = repoIssues.filter(i => i.state === 'closed').length
const total = repoIssues.length
const rate = total ? Math.round(closed / total * 100) : null

allIssues (built ~lines 107-114) includes PRs and is never filtered with !i.pull_request.
Every other governance check DOES filter PRs out — Dead Issues (line 126), Zombie PRs
(line 144), and the stale-issues stats (AppContext.jsx line 422) — so this widget is the
outlier.

Verified on live data for AOSSIE-Org/OrgExplorer (first 100 of state=all): 56 of the 100
"issues" are actually PRs, so the denominator is inflated 44 -> 100 and the rate reads 42%
instead of the correct 39%.

Steps to Reproduce
  1. Explore any active org (e.g. AOSSIE-Org) and open the Governance page.
  2. Click "Run Audit".
  3. Look at the "Issue Resolution Rate" bars — closed/total includes pull requests.
  4. Compare any repo's number with GitHub's real issue count and it won't match.

Deterministic check (same logic as the page, on live data):

node f1_resolution.mjs
# fetched items (issues + PRs): 100  (PRs among them: 56)
# CURRENT (buggy, counts PRs) : 42/100 closed -> 42%
# CORRECT (issues only)       : 17/44  closed -> 39%
Logs and Screenshots

Reproducible script output (replicates GovernancePage.jsx:338-343 on live GitHub data):

=== F1 Issue Resolution Rate — AOSSIE-Org/OrgExplorer (first 100 of state=all) ===
fetched items (issues + PRs): 100 (PRs among them: 56)

CURRENT (buggy, counts PRs) : 42/100 closed -> 42%
CORRECT (issues only) : 17/44 closed -> 39%

=> PRs inflate the denominator by 56 and skew the rate by 3 points.

📎 Image file:

Image
Environment Details
  • OS: macOS (also reproduces on the live site, any OS/browser)
  • Browser: Chrome
  • Site: https://orgexplorer.aossie.org/ and local dev (npm run dev), main @ d91d2b8
  • Node.js: v20 (for the repro script)
  • Suggested fix: add && !i.pull_request to the repoIssues filter.
  • Related but separate: #302's open PR #304 rewrites this exact line for org-scoping
    (issuesData?.[${r.orgLogin}/${r.name}] || []) but still counts PRs — so this defect
    survives #304 and should be fixed on top of / within that change.
Impact

Medium - Feature works but has issues

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 摘要。