← Back to Pull requests

Hardcode dashboard collection retention to 90 days with opt-in controller setting #340

Closed
unknown closed this pull request without merging on Jul 13, 2026 08:31 UTC
View on GitHub
unknown unknown commented on Jul 07, 2026 16:11 UTC
Author

Summary

Already backported to 2.7.

  • Gates the get_retention_days() function (which queries the Controller's active cleanup_jobs schedules) behind a new DASHBOARD_COLLECTION['USE_CONTROLLER_RETENTION'] setting (default False)

  • Both the initial backfill window and daily cleanup retention now hardcode to 90 days (DEFAULT_RETENTION_DAYS) unless the setting is explicitly enabled

  • All existing get_retention_days() code is preserved and functional — it just requires opt-in via settings.yaml or the METRICS_SERVICE_DASHBOARD_COLLECTION__USE_CONTROLLER_RETENTION=true env var
  • Motivation

    The Controller-derived retention period was added but not fully tested. This makes the safe 90-day default unconditional while keeping the code in place for a future release once it's been validated.

    Changes

  • apps/settings/defaults.py — add USE_CONTROLLER_RETENTION: False to DASHBOARD_COLLECTION

  • apps/dashboard_reports/tasks.py — add _use_controller_retention() helper; gate get_retention_days() calls in _resolve_collection_params and cleanup_dashboard_reports_old_data

  • tests/unit/dashboard_reports/test_tasks.py — patch _use_controller_retention to True in tests that exercise the controller-retention path
  • AI Assistance


    This change was developed with assistance from Claude Code (Claude Sonnet 4.6).
    All generated code was reviewed, tested, and validated before merging.

    Diff: 180 lines (+135 / -45) across 2 files Reviewer: kcagran Review duration: 8179m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 180 lines diff across 2 files
    0.36
    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.311
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #340"
    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: 35.5% (MEDIUM) · Higher = larger blast radius
    35.5%
    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: 14% · Safe to merge
    14%