Skip to content

Discussion mentor counting silently caps at 100 comments (no pagination) #798

Description

@jmeridth

Context

Surfaced during review of #776.

discussions.get_discussions fetches discussion comments with comments(first: 100) and does not paginate that sub-list (only the outer search connection is paginated). count_comments_per_user then evaluates up to max_comments_to_eval of those nodes.

Problem

MAX_COMMENTS_EVAL (config, default "20") has no upper-bound validation. If an operator sets it above 100, the discussion mentor-counting branch can never see more than the 100 comment nodes GraphQL returned. It silently stops, with no error or warning.

This diverges from the issue and pull-request branches, where issue.get_comments() / pull_request.get_reviews() are PyGithub PaginatedLists that keep fetching until max_comments_to_eval is satisfied.

For the default value (20 < 100) this is harmless, which is why it is documented inline rather than fixed in #776.

Proposed fix

Add cursor-based pagination to the comments sub-list in get_discussions (page until hasNextPage is false or MAX_COMMENTS_EVAL nodes are collected), so discussions behave consistently with issues and PRs.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions