← Back to Pull requests

[18.0][FIX] fs_storage, storage_backend: deprecated() must not override the process warning filters #694

Open
marlon-costa-dc opened this pull request with 16 lines diff across 3 files
View on GitHub
marlon-costa-dc marlon-costa-dc commented on Nov 08, 2026 05:19 UTC
Author

Problem


The deprecated decorator in fs_storage (and the copy in storage_backend) runs warnings.simplefilter("always") and then warnings.simplefilter("default", DeprecationWarning). Both calls insert a filter at the front of the process-wide list and never remove it.

After the first call to a deprecated method, every filter the server installed for DeprecationWarning stops applying. One example is Odoo's ignore for datetime.datetime.utcnow() in odoo/netsvc.py. In a test run, tests that run later then log WARNING py.warnings: ... datetime.datetime.utcnow() is deprecated, from ir_mail_server.py and mail_activity_mixin.py. The fs_storage tests also called warnings.filterwarnings("ignore") without restoring it.

Fix


  • Drop the two simplefilter calls: warnings.warn(..., DeprecationWarning) is enough, and the process filters decide.

  • Drop the leaking filterwarnings("ignore") from the tests; mute_logger("py.warnings") already keeps them quiet.
  • Tests


    New test_deprecated_keeps_warning_filters: it sets an ignore filter, calls a deprecated method, and checks the filter still applies.
  • without the fix: FAIL, 1 of 20 tests;

  • with the fix: 20 of 20 pass.

  • Run on Odoo 18.0.

    CLA


    The author signed the OCA CLA; the commit email (marlon.costa@datacosmos.com.br) is now verified on the GitHub account marlon-costa-dc.

    Diff: 16 lines (+10 / -6) across 3 files Reviewer: lmignon Review duration: 23255m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.23) × (1 − Review Confidence (0.83)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.23 · 16 lines diff across 3 files
    0.23
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.83 · 1 substantive comment(s)
    0.83
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    82%
    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.170
    Real PR Conversation Timeline
    3 items
    oca-cla-bot[bot] oca-cla-bot[bot] commented on Nov 08, 2026 05:19 UTC
    Bot

    All commit authors signed the Contributor License Agreement.

    ![CLA signed](https://clabot.odoo-community.org/)<!-- CLA BOT SIGNING COMMENT DO NOT EDIT -->

    lmignon lmignon requested changes on Nov 09, 2026 09:19 UTC
    Changes Requested Reviewer

    Thank you. Can you squash the commit in one plz.

    Reviewers
    Assignees
    marlon-costa-dc marlon-costa-dc
    Labels
    risk: low confidence: 83.0% 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: 22.9% (LOW) · Higher = larger blast radius
    22.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: 83.0% · Lower = rushed or shallow review
    83.0%
    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: 3.9% · Safe to merge
    3.9%
    Repository