← Back to Pull requests

bump sqla to 2.1 #20650

Open
JacobCoffee opened this pull request with 182 lines diff across 12 files
View on GitHub
JacobCoffee JacobCoffee commented on Oct 02, 2026 16:45 UTC
Author

Bump to 2.1, adjust to new syntax

Here is a breakdown of the new 2.1 stuff that was required to change:

| Change | Simple explanation |
| --- | --- |
| .distinct(column) → .ext(distinct_on(column)) | New supported syntax for PostgreSQL
DISTINCT ON. .ext() attaches that SQL feature to the query. Same SQL behavior. |
| Row[tuple[int, str]] → Row[int, str] | SQLAlchemy 2.1 takes each column’s type separately.
Remove the outer tuple. |
| Select[tuple[int]] → Select[int] | Same change: this query returns one integer column. |
| Select[Any] → Select[tuple[Any, ...]] | Means “a query returning any number of columns.”
The
unpacks the column types. Same idea for Row. |
| NotNullable(column) | Tells the type checker the value cannot be None. The existing query
already excludes nulls; this adds no filtering. |
| desc(column) → column.desc() | Same ordering, with a more precise type annotation. Likewise
for .nulls_last(). |
| Alias = ... → type Alias = ... | Explicitly declares a Python type alias. Optional style
improvement from @Alc-Alc , not required by SQLAlchemy. |

Diff: 182 lines (+98 / -84) across 12 files Reviewer: Alc-Alc Review duration: 8262m
All Vouch review confidence checks passed
Residual risk 0.10 = Change Risk (0.50) × (1 − Review Confidence (0.81)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 182 lines diff across 12 files
0.50
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.70 · 4 substantive comment(s)
0.70
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
80%
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.312
Real PR Conversation Timeline
6 items
chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Oct 02, 2026 16:45 UTC
Bot

<!-- codex-pull-request-review-summary -->

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-10-02T16:48:37.031276Z">2026-10-02T16:48:37.031276Z</relative-time> | 7393fd8 | PR opened |

<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    JacobCoffee JacobCoffee commented on Oct 02, 2026 16:46 UTC
    Author

    @alc-alc please review 🥹

    Alc-Alc Alc-Alc commented on code on Oct 02, 2026 16:56 UTC
    Code Review
    warehouse/admin/user_export.py:1
    @@ -327,7 +325,7 @@ def _capped_total(
     
     # One uploaded release, as selected by `_membership_sections`:
     # project_id, version, created, uploaded_via.
    -_UploadRow = Row[tuple[UUID, str, datetime.datetime, str | None]]
    +_UploadRow = Row[UUID, str, datetime.datetime, str | None]

    just my personal preference, I like to use type statement for aliases, only noticed because the diff highlighted it 😅, unsure if there are other places where aliases are used.

    Alc-Alc Alc-Alc approved these changes on Oct 02, 2026 16:56 UTC
    Approved Reviewer

    Approved these changes.

    JacobCoffee JacobCoffee commented on code on Oct 02, 2026 17:26 UTC
    Code Review
    warehouse/admin/user_export.py:1
    @@ -327,7 +325,7 @@ def _capped_total(
     
     # One uploaded release, as selected by `_membership_sections`:
     # project_id, version, created, uploaded_via.
    -_UploadRow = Row[tuple[UUID, str, datetime.datetime, str | None]]
    +_UploadRow = Row[UUID, str, datetime.datetime, str | None]

    Changed to a type statement in 028724a9f. TypoCheckMatch already uses this style; left the other aliases alone.

    Reviewers
    Assignees
    JacobCoffee JacobCoffee
    Labels
    risk: low confidence: 80.5% 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: 50.3% (MEDIUM) · Higher = larger blast radius
    50.3%
    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: 80.5% · Lower = rushed or shallow review
    80.5%
    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: 9.8% · Safe to merge
    9.8%
    Repository