Merged PR role count can double-count when the current PR is outside the first search page
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- github, typescript
调研方向
找到 countMergedPrs 和 onPullRequest,然后阅读有关搜索结果和 exceptUrl 情况的现有测试。使用 total_count: 101 和不包含当前 PR 的 100 个项目重现问题;确保即使当前 PR 不在第一页中,之前的计数也会将其排除。webhook 使用正确的计数评估角色阈值时即为完成。
由索引模型根据 Issue 内容生成。
描述
Bug
countMergedPrs requests only the first 100 GitHub search results, then uses total_count for the full result set. When called from the merged-PR webhook with exceptUrl, it subtracts one only if the current PR is present in those first 100 items.
For a linked contributor with more than 100 merged PRs, GitHub can include the just-merged PR in total_count but omit it from the first page. In that case countMergedPrs(..., pr.html_url) returns a count that already includes the current PR. onPullRequest then adds one again (earlier + 1), which can grant a contributor role one merge earlier than its configured threshold.
Reproduction
- Mock a GitHub search response with
total_count: 101and 100 items that do not include the current PR URL. - Call
countMergedPrswithexceptUrlset to that current PR URL. - The function returns 101 instead of 100 because it cannot tell whether the omitted 101st result is the current PR.
- The webhook adds one and evaluates role tiers using 102.
Expected behavior
The webhook's earlier-PR count should exclude the current PR even when it is not on the first search page, so role thresholds are evaluated against an accurate count.
- 主要语言
- TypeScript
- 星标
- 0
- 派生
- 1
- 平均合并
- 2 小时 38 分钟
- 30 天内合并 PR
- 73
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codercops/discord-bot 的其他 Issue
-
`/leaderboard`, the page and the share image say "be the first" for a program that hasn't started未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 84/100
codercops/discord-bot#152 ·
维护者通常 1 天内回复
-
Keep the slash command list in one module, and test that `/help` and the registered commands match未关闭help wanted testing
难度 3/5 1-2 天 新手友好度 78/100
codercops/discord-bot#154 ·
维护者通常 1 天内回复
-
enhancement help wanted
难度 3/5 1-2 天 新手友好度 74/100
codercops/discord-bot#153 ·
维护者通常 1 天内回复
-
Contributing to discord-bot: start here可能重新可做 @sank8-2 于 21 天前认领,目前没有进行中的 PR。 未关闭
难度 1/5 1 小时以内 新手友好度 15/100
codercops/discord-bot#15 · 4 条评论 ·
维护者通常 1 天内回复
查看 codercops/discord-bot 的全部 Issue
相似的 Issue
-
Out of order / duplicate key error shows the key bytes as decimal or UTF-8, not hex可能已有人在做 @bardrop 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 86/100
-
bug i18n
难度 2/5 1-3 小时 新手友好度 74/100
endora-commerce/endora-commerce#1315 ·
维护者通常 1 天内回复
-
area:data-quality importer size:S
难度 2/5 1-3 小时 新手友好度 72/100
enorm-labs/event-junkie#5136 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
WenyuChiou/agent-board#1518 ·
维护者通常 1 天内回复