fastapi - 💡(How to fix) Fix scripts/people.py still ignores minimized top-level discussions in People stats [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
fastapi/fastapi#15237Fetched 2026-04-08 01:40:15
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
converted_to_discussion ×1locked ×1

The recent change in scripts/people.py that excludes minimized comments/replies from the FastAPI People statistics is incomplete for top-level discussions.

The GraphQL query now fetches minimizedReason for each discussion node, but DiscussionsNode does not model that field and get_discussions_experts() never checks it before processing the discussion's comments/replies.

As a result, a minimized discussion can still contribute participants to the People stats through its non-minimized replies/comments, even though the thread itself has already been moderation-minimized.

Root Cause

If a discussion is minimized for spam / abuse / off-topic / duplicate reasons, the script still traverses that discussion and can count participants from replies/comments under that thread.

So the recent fix is only partial: it excludes minimized comments, but not minimized discussions.

Code Example

if discussion.minimizedReason in MINIMIZED_COMMENTS_REASONS_TO_EXCLUDE:
    continue
RAW_BUFFERClick to expand / collapse

Summary

The recent change in scripts/people.py that excludes minimized comments/replies from the FastAPI People statistics is incomplete for top-level discussions.

The GraphQL query now fetches minimizedReason for each discussion node, but DiscussionsNode does not model that field and get_discussions_experts() never checks it before processing the discussion's comments/replies.

As a result, a minimized discussion can still contribute participants to the People stats through its non-minimized replies/comments, even though the thread itself has already been moderation-minimized.

Relevant recent change

  • Commit: 0227991 (🔨 Exclude spam comments from statistics in scripts/people.py)

What I observed

In scripts/people.py:

  1. The GraphQL query includes minimizedReason on the discussion node itself.
  2. DiscussionsNode only defines:
    • number
    • author
    • title
    • createdAt
    • comments
  3. get_discussions_experts() filters comment.minimizedReason and reply.minimizedReason, but never filters the discussion/thread itself.

That means the top-level moderation state is fetched but ignored.

Why this matters

If a discussion is minimized for spam / abuse / off-topic / duplicate reasons, the script still traverses that discussion and can count participants from replies/comments under that thread.

So the recent fix is only partial: it excludes minimized comments, but not minimized discussions.

Expected behavior

If a discussion itself is minimized for one of the excluded reasons, the script should skip the entire discussion when computing People statistics.

Possible fix

  • Add minimizedReason: LowerStr | None = None to DiscussionsNode
  • In get_discussions_experts(), skip processing when:
if discussion.minimizedReason in MINIMIZED_COMMENTS_REASONS_TO_EXCLUDE:
    continue

Extra note

Because the GraphQL query already requests the field, this looks like an accidental omission rather than a design decision.

extent analysis

Fix Plan

To fix the issue, we need to modify the DiscussionsNode model and the get_discussions_experts() function. Here are the steps:

  • Add minimizedReason to the DiscussionsNode model:
class DiscussionsNode:
    # existing fields...
    minimizedReason: LowerStr | None = None
  • Modify the get_discussions_experts() function to skip processing minimized discussions:
def get_discussions_experts():
    # existing code...
    for discussion in discussions:
        if discussion.minimizedReason in MINIMIZED_COMMENTS_REASONS_TO_EXCLUDE:
            continue
        # existing code to process discussion comments and replies...
  • Ensure that the MINIMIZED_COMMENTS_REASONS_TO_EXCLUDE list includes the reasons for which discussions should be skipped.

Verification

To verify that the fix worked, you can:

  • Run the scripts/people.py script and check that minimized discussions are no longer included in the People statistics.
  • Test with a sample dataset that includes minimized discussions and verify that the script correctly skips them.

Extra Tips

  • Make sure to update the GraphQL query to include the minimizedReason field for discussion nodes, if it's not already included.
  • Consider adding a test case to ensure that the get_discussions_experts() function correctly handles minimized discussions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

If a discussion itself is minimized for one of the excluded reasons, the script should skip the entire discussion when computing People statistics.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING