← Back to Pull requests

[18.0][IMP][BCKP] base_tier_validation: clearer notify_on_pending chatter body #1291

Open
unknown opened this pull request with 260 lines diff across 3 files
View on GitHub
unknown unknown commented on May 17, 2026 16:58 UTC
Author

Backport of OCA/tier-validation#22 to 18.0.

Problem

The chatter message posted when a tier reaches `pending (from
_notify_review_available) has two UX problems:

1. Wrong attribution on later tiers. self.env.user.name inside
_notify_requested_review_body resolves to whichever user
triggered the promotion. On second-and-later tiers that is the
approver of the previous tier, not the person who pressed
Request Validation -- so the message credits the wrong user.
2. No way to tell who the message is for. Chatter system
notifications do not render the "Notified to" pill the way
user-typed comments do. A recipient seeing "A review has been
requested by Administrator"
cannot tell whether it was meant for
them.

Fix

  • Source the requester from review.requested_by (set once at

  • request_validation time, never reassigned) so attribution is
    consistent across all tiers.
  • Reuse the existing tier.review.todo_by field for the assignee

  • label -- it already handles every review type (individual /
    res.users field, group, res.groups field) with the same
    abbreviation rules as the Reviews table.
  • New wording: "Review pending for Mike, requested by Administrator."
  • Backwards-compatible: _notify_requested_review_body() still works
    with no arguments and returns the previous short body for any
    downstream overrider that calls it that way.

    Notes on backport scope

    The upstream PR also extends test_19a_notify_on_pending_sequence_negative,
    which was introduced by its dependency OCA/tier-validation#21 and does
    not exist on this branch (18.0's nearest equivalent,
    test_19_waiting_tier, deliberately runs with notify_on_pending
    off). Only the
    test_20_no_sequence adaptation -- which asserts the
    assignee and the original requester are present in the body -- has been
    ported here.

    Test plan

  • test_20_no_sequence updated to assert both the assignee

  • (
    review_1.todo_by) and the original requester
    (
    review_1.requested_by`) are present in the chatter body.

    Diff: 260 lines (+195 / -65) across 3 files Reviewer: bofiltd Review duration: 264598m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.46) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 260 lines diff across 3 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.333
    Real PR Conversation Timeline
    1 comments
    "Review active on #1291"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% 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: 46.2% (MEDIUM) · Higher = larger blast radius
    46.2%
    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: 44.7% · Lower = rushed or shallow review
    44.7%
    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: 25.6% · Safe to merge
    25.6%
    Repository