Use the search API to count issues - #829
Conversation
a0b0bba to
14a957c
Compare
The repo issues list endpoint now uses cursor-based pagination, which no longer exposes the last page number. FetchIssueCount relied on that number (with per_page=1) to count issues, so it silently returned 0 for every repository, which also zeroed issue_comment_frequency. Count issues via the search API's total_count instead, preserving the existing semantics: both issues and PRs are counted, filtered on updated time within the lookback, with the closed state expressed as is:closed. The 5xx fallback to MaxIssuesLimit is unchanged. Fixes ossf#816 Signed-off-by: Cameron Urban <camerongurban@gmail.com>
14a957c to
6da1c69
Compare
|
+1 on this — I hit the same bug independently and can confirm both the diagnosis The so Some measurements on top of the
The 690/572 figures match what the search API reports for the same 90-day Worth emphasising how much this distorts things: WarpX moves by +0.086. The Two small things I noticed while looking at the same code, both arguing that the
I also opened #830 with a paging-based fix before seeing how far along this one |
Summary
Fixes #816.
The three legacy issue signals (
updated_issues_count,closed_issues_count, andissue_comment_frequency) currently report 0 for every repository.GitHub's repo issues list endpoint (
/repos/{owner}/{repo}/issues) now uses cursor-based pagination: itsLinkheader contains only arel="next"entry with an opaque cursor, and norel="last"entry.FetchIssueCountrelied on requestingper_page=1and reading the total from the last page number, so it now always seesLastPage == 0and returns 0. Sinceissue_comment_frequencydivides the comment count by the updated-issues count, it is zeroed as well.This change counts issues with a single search API request instead, reading the exact
total_countfrom the response. The original semantics are preserved:updated:>=<timestamp>), matching the list endpoint'ssinceparameter.is:closed, matchingstate=closedcombined withsince(closed-state items updated within the window).MaxIssuesLimitis unchanged.FetchIssueCommentCountis untouched. The comments endpoint still uses page-number pagination.Testing
make testpasses.make lintpasses.camUrban/PteraSoftware(a repo with recent issue activity): before this change the three signals were 0/0/0; after, they are 117/100/1.19, matching direct queries to the search API for the same 90-day window.