← Back to Pull requests

feat(erpact): alert when the copy's backup stops succeeding #1549

Closed
unknown closed this pull request without merging on Oct 04, 2026 01:09 UTC
View on GitHub
unknown unknown commented on Oct 04, 2026 00:58 UTC
Author

Why


The ERPact copy is getting its first backup: CronJob erpact-backup in git.mctl.ai/erpact/mctl-apps#1, which uploads daily to R2 bucket erpact-backups. Its credential landed in #1546. The job refuses to upload a truncated dump or one missing a site's database, but a failed Job is visible only in its own logs. A reviewer of that PR found no alert anywhere in the cluster that would notice a missed day.

What


New group erpact.backup in vm-rules/erpact-alerts.yaml. It uses the same three-way split as the Forgejo backup alerts in backup-alerts.yaml:
  • ErpactBackupStale: last success is older than 25h.

  • ErpactBackupNeverSucceeded: the CronJob is older than 26h and has never succeeded. last_successful_time only exists after a first success, so Stale alone cannot see this case.

  • ErpactBackupMetricAbsent: no kube_cronjob_created series for 30m. Without this, a deleted or unscraped CronJob would silence the other two.
  • All three are warning with service: erpact, like the existing erpact availability alerts. The copy is not production.

    Tests


    New cases are appended to tests/erpact-alerts_test.yaml; the existing availability tests are unchanged:
  • a backup 24h old stays quiet;

  • a backup 25h+ old fires Stale;

  • a fresh CronJob stays quiet;

  • a CronJob 26h+ old with no success fires NeverSucceeded;

  • an absent CronJob is quiet at 20m and fires at 45m.
  • scripts/check-vm-rules.sh passes. Mutation-verified twice: raising the Stale threshold, and turning unless into or in NeverSucceeded, each fail the suite.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_013QnVjZsjQyJQs4zDLUcNWP

    Diff: 210 lines (+157 / -53) across 2 files Reviewer: claude[bot] Review duration: 11m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 210 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%
    56%
    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.320
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1549"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 36.5% (MEDIUM) · Higher = larger blast radius
    36.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: 56.8% · Lower = rushed or shallow review
    56.8%
    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.8% · Safe to merge
    15.8%