← Back to Pull requests

Infra: Add custom lexers for PEP 823 + 824 #5125

Closed
unknown closed this pull request without merging on Oct 01, 2026 05:19 UTC
View on GitHub
unknown unknown commented on Sep 15, 2026 18:31 UTC
Author

<!--
This template is for an infra or meta change not belonging to another category.
Please read our Contributing Guidelines (CONTRIBUTING.rst)
to make sure this repo is the right place for your proposed change. Thanks!
-->

Even minimal syntax highlighting can improve the readability of code snippets and examples in a PEPs. For syntax changes the default Python lexer provided by pygments can sometimes fail to parse the code having to fall back to pure text.

This PR adds new custom lexers which extends the default one to support the examples in PEP 823 and 824. The sphinx directives for these will be .. code-block:: py823 and py824 respectively.

  • #4798

  • #4799
  • | | Before | After |
    | - | - | - |
    | 823 | <img width="450" height="60" alt="Screenshot 2026-09-15 at 19 13 48" src="https://github.com/user-attachments/assets/c625d051-b91a-41ae-9b63-f946fe0c2af5" /> | <img width="445" height="60" alt="Screenshot 2026-09-15 at 19 13 57" src="https://github.com/user-attachments/assets/d93edb6b-1783-4453-af74-1dbc60fb53c9" /> |
    | 824 | <img width="343" height="81" alt="Screenshot 2026-09-15 at 19 15 25" src="https://github.com/user-attachments/assets/dd82f42a-3ad9-4b50-b196-ca55ca81a347" /> | <img width="342" height="81" alt="Screenshot 2026-09-15 at 19 15 45" src="https://github.com/user-attachments/assets/6d69a14d-01df-456f-ba74-6f4149e295ce" /> |

    Diff: 174 lines (+130 / -44) across 2 files Reviewer: encukou Review duration: 22248m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.59) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.59 · 174 lines diff across 2 files
    0.59
    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%
    60%
    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.309
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.059
    Real PR Conversation Timeline
    1 comments
    "Review active on #5125"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 58.5% (MEDIUM) · Higher = larger blast radius
    58.5%
    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: 60.5% · Lower = rushed or shallow review
    60.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: 23.1% · Safe to merge
    23.1%
    Repository