← Back to Pull requests

[19.0][IMP] base_tier_validation: warn at definition save if reviewer lacks model ACL #31

Closed
unknown closed this pull request without merging on Sep 21, 2026 15:15 UTC
View on GitHub
unknown unknown commented on May 13, 2026 21:50 UTC
Author

Summary

Catch the "invalid tier definition" misconfiguration at config time instead of letting it fail silently later.

When an admin sets a reviewer (individual user or group) that has no ir.model.access read on the tier's target model, an onchange warning explains the problem and names the affected user(s). The warning is non-blocking — the record can still be saved. Legitimate workflows (admin is about to add the user to the group, ir.rule grants per-record access on demand, multi-company quirks) keep working; the warning just makes it impossible to misconfigure this silently.

Scope

| review_type | Behaviour |
|---|---|
| individual | Check reviewer_id |
| group | Check every member of reviewer_group_id.user_ids |
| field | Skipped — the reviewer only resolves at validation time from a field on the document. The chatter notification at request_validation time (separate PR) catches that case. |

Tradeoff (worth calling out for review)

check_access('read') is a model-level check. Per-record ir.rule can grant or revoke access at runtime. So:

  • False positive: the warning fires, but ir.rule would have allowed access on specific records → admin sees the warning and ignores it. Fine; non-blocking.

  • False negative: no warning, but ir.rule blocks access on some records → still silently broken for those. The chatter PR catches this.
  • The message is worded "may not be able to read" on purpose. Better than silent failure.

    Test plan

    Three tests cover the three branches:

  • test_definition_onchange_warns_when_reviewer_lacks_access (individual)

  • test_definition_onchange_warns_when_group_member_lacks_access (group)

  • test_definition_onchange_skips_field_review_type (field — no warning)
  • Each unlinks the tester model's ir.model.access, builds a tier.definition.new(...) with the relevant reviewer config, and asserts the onchange returns / does not return a warning dict.

    Follow-up

    A separate PR will add a chatter notification on request_validation for the cases this onchange can't cover (field reviewer, dynamic group membership that changed after the definition was saved, ir.rule-only restrictions).

    Diff: 276 lines (+207 / -69) across 3 files Reviewer: bofiltd Review duration: 188244m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 276 lines diff across 3 files
    0.40
    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.336
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #31"
    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: 39.6% (MEDIUM) · Higher = larger blast radius
    39.6%
    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.6% · Safe to merge
    15.6%