fix(scripts): paginate comments and reactions in auto-close-duplicates - #80508
Open
Serhii-Leniv wants to merge 1 commit into
Open
fix(scripts): paginate comments and reactions in auto-close-duplicates#80508Serhii-Leniv wants to merge 1 commit into
Serhii-Leniv wants to merge 1 commit into
Conversation
Both reads used GitHub's default page size of 30 and never followed pagination, unlike the issues list in the same script and every list call in sweep.ts. A thumbs-down past the first 30 reactions, or human replies after a dupe notice sitting at comment position 30, were invisible to the guards, so issues auto-closed despite objections. Add a githubRequestAllPages helper (per_page=100, follows pages until a short page) and use it for both reads. Fixes anthropics#80506
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #80506
Problem
auto-close-duplicates.tspaginates the issues list, but its other two list reads rely on GitHub's default page size of 30 and never follow pagination:commentsAfterDupeactivity guardsweep.tsin the same directory passesper_page=100on every list call, so this is an outlier. The result is that the two guards protecting reporters from wrongful auto-close degrade exactly on high-engagement issues: a 👎 past the first 30 reactions is ignored (real dupe notices are already at 23 👎 — see the notice on #44252), and human objections after a dupe notice sitting at comment position 30 are invisible (notices deep in threads are a supported path viabackfill-duplicate-comments.tsdispatch). This also composes with #79146/#79151 — counting any user's 👎 doesn't help if that 👎 is on page 2.Fix
Add a
githubRequestAllPageshelper (per_page=100, follows pages until a short page, same 20-page safety cap as the existing issues loop) and use it for the comments and reactions reads. No behavior change for issues with ≤30 comments/reactions.Testing
Mock-fetch harness emulating GitHub pagination semantics (30 items when
per_pageis absent), three fixture issues: author's-1at reaction position 33 (#101), five human objections after a dupe notice at comment position 30 (#102), and a clean candidate (#103).main:closed: [101, 102, 103]— two wrongful closesclosed: [103]— objections honored, legitimate close still happensThis PR was written with the assistance of Claude Code; all changes were reviewed and the tests run by me.