Weekly retention bug: same ISO week number across years treated as duplicates #33
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?
Bug Description
The weekly retention policy incorrectly treats backups from the same ISO week number in different years as duplicates. For example, backups from week 52 of 2021 and week 52 of 2022 are treated as the same week, causing one to be removed.
Root Cause
cleanup_old_backups()compares only the ISO week number when determining weekly duplicates:This compares only
isocalendar()[1](week number 0-53) without checkingisocalendar()[0](ISO year).Impact
keep_weeklypolicyEvidence
Test
test_iso_week_number_across_yearsdemonstrates the bug:keep_weekly=10, both should be kept (different ISO weeks)Proposed Fix
Compare both ISO year and week number:
This compares the tuple
(ISO_year, ISO_week)instead of just the week number.Related
@pytest.mark.xfailuntil fixed