← Back to Pull requests

[19.0][FIX] base_tier_validation: don't promote later tiers out of sequence #53

Closed
unknown closed this pull request without merging on Oct 01, 2026 10:04 UTC
View on GitHub
unknown unknown commented on Jun 23, 2026 10:40 UTC
Author

Problem


With approve_sequence, a later-tier review could be promoted to pending before its predecessor is approved, which then:
  • hides it from that reviewer's own systray (can_review is False while the lower tier still holds the minimum sequence), and

  • mis-routes the notify_on_pending chatter message to the previous reviewer instead of the intended one.
  • Root cause


    tier.review._update_review_status gates promotion on min(self.mapped("sequence")) — the minimum over the recordset it happens to be called on, not the whole record. res.users.review_user_count calls it as user.review_ids._update_review_status(), i.e. on a single user's reviews. For a second-tier reviewer that subset contains only their own (higher-sequence) review, so it becomes the "minimum" and is promoted prematurely the moment they open their systray.

    The premature pending then cascades: can_review evaluates False (the lower tier holds the min sequence) → hidden from the systray; the notify_on_pending message is posted in that reviewer's own transaction → they are excluded as its author and the alert lands on the previous reviewer; and when the first tier is finally approved the review is already pending, so it is skipped and no correct notification ever fires.

    Fix


    Compute the gating sequence over the whole record's open reviews (per res_id), not the passed recordset. No behaviour change for the normal full-recordset call (request_validation → _update_review_status).

    Test


    Adds test_19c_no_premature_promotion_on_subset, which runs _update_review_status on only the later-tier reviewer's review (the review_user_count path) and asserts it stays waiting and posts no message. test_19a only exercised the full-recordset path, so the regression slipped through.

    <!-- Independent, pre-existing bug (the method is untouched by other open PRs). Complements the notify_on_pending routing work in #22. -->

    Diff: 246 lines (+184 / -62) across 3 files Reviewer: bofiltd Review duration: 143963m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 246 lines diff across 3 files
    0.39
    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.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #53"
    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: 38.9% (MEDIUM) · Higher = larger blast radius
    38.9%
    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: 15.4% · Safe to merge
    15.4%