Yearly retention overrides monthly retention, violating keep_monthly guarantee #32
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When retention policies are combined, coarser tiers can remove backups already protected by finer tiers, violating documented guarantees. Affects multiple tier interactions, not just yearly/monthly.
Expected Behavior
Per docstrings: retention policies should honor their thresholds
keep_daily=7should keep 7 dayskeep_weekly=4should keep 4 weekskeep_monthly=6should keep 6 monthskeep_yearly=3should keep 3 yearsActual Behavior - THREE BUGS FOUND
Bug 1: Weekly overrides daily
Bug 2: Monthly overrides weekly
Bug 3: Yearly overrides monthly
Root Cause
Algorithm in
backup.py:258-296processes backups newest→oldest:Reproduction
Run test added in commit (updated):
Test now validates expected behavior and catches all 3 bug patterns.
Impact
Proposed Fix
Prevent coarser retention tiers from removing backups within finer thresholds:
Context
Discovered while adding comprehensive combined retention policy test.
Initial investigation found monthly/yearly bug, deeper analysis revealed
systematic issue affecting all tier interactions.