← Back to Pull requests

[20.0][MIG] auth_api_key: Migration to 20.0 #1071

Open
unknown opened this pull request with 614 lines diff across 7 files
View on GitHub
unknown unknown commented on Nov 19, 2026 15:33 UTC
Author

Migration changes


- Bump version to 20.0.1.0.0.
- Convert ir.model.access.csv to the new security/ir.access.csv (same rights: base.group_system, crud).
- _auth_method_api_key now takes the routing argument passed by ir.http._authenticate_explicit.
- Import Dispatcher from odoo.http.dispatcher (no longer re-exported by odoo.http).
- Replace removed registry.clear_cache() with env.transaction.invalidate_ormcache() (model and tests).
- Use api.ormcache instead of deprecated tools.ormcache.
- Remove readme/CREDITS.md (past migration funding note), per 20.0 guidelines.
- Lint fixes required by the 20.0 pre-commit config (single-line manifest summary, ruff C419).

### Fix included
The API key lookup cache was only cleared when key or user_id changed, so a deleted or archived key could keep authenticating until the cache was cleared by something else. The model now uses _clear_cache_name
/ _clear_cache_on_fields = ("key", "user_id", "active"), so the ORM clears the cache on create, unlink and on writes of those fields. Two tests added (archive, unlink).

### Known issues (pre-existing, not addressed here)
1. Toggling "Disable API key for archived user" on a company does not clear the cache. Turning the option on recomputes active = False on keys of already-archived users, but the recompute does not go through
write(), so a cached key keeps working until the cache is cleared. Note that the field help says the option is not retroactive, while the stored compute (depends on the company option) does make it retroactive —
maintainers' input welcome on the intended behavior.
2. _compute_active reads self.user_id.company_id.archived_user_disable_auth_api_key on the whole recordset, which may raise "Expected singleton" when keys of users from different companies are recomputed together
(not reproduced).

### Tests
15 tests, 0 failures (local run).

Diff: 614 lines (+460 / -154) across 7 files Reviewer: thomaspaulb Review duration: 16573m
All Vouch review confidence checks passed
Residual risk 0.39 = Change Risk (0.73) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.73 · 614 lines diff across 7 files
0.73
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%
46%
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.384
Shallow Review Depth shallow_review_depth
0.344
Sensitive Paths sensitive_paths
0.073
Real PR Conversation Timeline
1 comments
"Review active on #1071"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: medium confidence: 46.7% 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: 73.4% (HIGH) · Higher = larger blast radius
73.4%
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: 46.7% · Lower = rushed or shallow review
46.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: 39.1% · Moderate risk
39.1%