hyperswitch
767deee4 - feat(revenue_recovery): mathmodel retry-time predictor

Commit
2 days ago
feat(revenue_recovery): mathmodel retry-time predictor Fills in the MathModel half of the Cascading retry strategy: computes when to retry a failed subscription payment from a cluster's day-of-week / day-of-month / hour-of-day success stats (dense-array `retry_stats` StatsDocument). - `compute_mathmodel_retry_time(stats, budget, grace_days) -> Option<OffsetDateTime>` in `workflows/revenue_recovery.rs`. - Confidence-interval scoring (Laplace p̂, SE, pairwise Φ, logit-average), candidate-day softmax + max combine, budget-aware probabilistic day/hour pick with a runway guard. - Restricted exploration: n=0 (never attempted) and corrupt (k>n) slots are excluded from scoring, so they can't hijack the pick. - Window starts the NEXT day; `grace_days` counts the failure day, so the window is `grace_days - 1` future days (capped at 31); returns `None` when `grace_days <= 1` (v1). - Remove dangling `pub mod stub;` from `retry_stats.rs` (its file was deleted). - Unit tests inline (`mod mathmodel_retry_time_tests`). Not yet wired into the Cascading branch (min() with the static schedule) — follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Committer
Parents
Loading