← Back to Pull requests

Compute each pull request's risk tier from its changed paths and label it #824

Closed
unknown closed this pull request without merging on Nov 26, 2026 12:33 UTC
View on GitHub
unknown unknown commented on Nov 25, 2026 14:07 UTC
Author

Fixes #821

What changed

  • Synced "Risk tier" workflow plus .github/scripts/risk-tier.py. On pull_request_target it checks out only the base SHA and reads the pull request through the API.

  • TypeSafe's Jev (jev-1.14.0, pinned) classifies each pull request with a choice question over T0, T1 and T2. It gets the title, description, labels, changed file names with line counts, the repository's T2 areas, and the changed lines of main source files (T2 areas first, about 15k tokens at most; no tests, docs, build files or context lines). The highest tier with at least 25% probability wins, so unsure answers round up.

  • Two yes/no questions on the same input ask whether the change touches public API (public or protected members of main sources, except @Internal and internal packages) and whether it breaks users. Either at 50% or more makes it T2. They never lower a tier, since the diff is text its author controls, and the build's binary compatibility check stays the definitive test.

  • The rules live in TOML: .github/risk-tiers.global.toml, synced to every repository, and an optional per-repository .github/risk-tiers.toml merged on top (values replace, lists add up, description replaces and add_description appends). They hold the tier descriptions Jev reads, path globs, T2 labels, the model and thresholds, so classification is tuned by editing text. Invalid rules fail the check.

  • A change under a T2 path, a T2 label (type: breaking by default), or a declared API change is T2 whatever Jev answers, so text in a pull request cannot talk its way down. The other path rules remain only as a per-file hint and as replay --rules-only.

  • Sets risk-tier: T0|T1|T2 and ai-use: none|assisted|agent-generated. Labels added by a reviewer or maintainer are kept, in either direction.

  • The risk-tier check fails when the declared tier is lower than the classified one, on AI tool footers in the description, and when TYPESAFE_API_KEY is missing or Jev does not answer (it never guesses a tier).
  • Why

    WP2 of micronaut-projects/.github#18. Path rules alone put 93% of core's recent pull requests in T1, so they cannot tell low-risk work apart.

    How to test

  • 65 unit tests (python3 .github/scripts/test_risk_tier.py), with Jev's HTTP call mocked; actionlint is clean.

  • A template-only job classifies each pull request with the live Jev API (dry run); for this one, jev-1.14.0 answered T0 at 97%. A one-off replay of last month's merged pull requests gave serialization 5 T0 / 2 T1 / 14 T2 and security 8 T0 / 4 T1 / 9 T2, against 0 T2 for path rules.
  • Checklist

  • Tests added

  • Documentation updated (MAINTAINING.md)

  • Targets the right branch (stacked on #823)
  • Review declaration

    | Field | Value |
    |-----------------------------|-----------------|
    | AI use | agent-generated |
    | AI tool | Claude Code |
    | Risk tier | T0 |
    | API or behaviour change | no |

    Diff: 381 lines (+285 / -96) across 4 files Reviewer: alvarosanchez Review duration: 1345m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 381 lines diff across 4 files
    0.43
    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.356
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #824"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.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: 43.0% (MEDIUM) · Higher = larger blast radius
    43.0%
    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: 17.0% · Safe to merge
    17.0%