← Back to Pull requests

Update the DRF-like queryset holder in manager access tests #3865

Closed
unknown closed this pull request without merging on Nov 28, 2026 08:15 UTC
View on GitHub
unknown unknown commented on Nov 28, 2026 03:22 UTC
Author

I have made things!


This test was trying to mimic DRF GenericAPIView.queryset using this union queryset: models.Manager[_MT_co] | models.QuerySet[_MT_co] | None = None.

However, we define Manager as a data descriptor in django-stubs to have the nice errors on invalid MyInstance().objects access.

But this trips pyrefly and might trip other at some point because we are in a very complicated case (generic default, union of descriptor and regular class attribute)

Since DRF actually expect a queryset and document only queryset usage (which make sense for a variable named queryset), I think the type was a bit incorrect in DRF to allow manager (manager could also crash in some cases so it was already brittle)

I'll open a pr in drf to update that but first I'm changing our test here.

Related issues


See https://github.com/pyrefly-org/pyrefly/issues/5725 discussion

It should technically be possible to make it work but would require a lot of work in pyrefly and other typechercker possibly so I think it's not worth for now and it's better we guide users to simple usages

AI Policy


  • I have read and agree to the AI Policy, removed any "Co-Authored-By" lines attributing coding agents, and manually reviewed the final result
  • Diff: 181 lines (+135 / -46) across 2 files Reviewer: sobolevn Review duration: 292m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 181 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.311
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3865"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.6% (MEDIUM) · Higher = larger blast radius
    35.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.4% · Safe to merge
    15.4%