Auto-fix day logs are deleted a calendar month after their date

Only files named exactly '<YYYY-MM-DD> <Weekday> Auto-Fix.log' in that
folder; checked when a new day's file starts and when the watchdog starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 07:13:19 -04:00
co-authored by Claude Opus 5.5
parent f7a98f4dec
commit a0cefe8428
3 changed files with 52 additions and 1 deletions
+15
View File
@@ -722,6 +722,21 @@ class TestFixes(unittest.TestCase):
self.assertIn("-> done, checking it comes back", body[1])
self.assertIn("OK again: ABLETON NOT RUNNING (15 s after the auto-fix)", body[2])
def test_auto_fix_logs_go_after_a_month(self):
d = tempfile.mkdtemp()
names = ["2026-09-10 Thursday Auto-Fix.log", "2026-09-11 Friday Auto-Fix.log", # a month old
"2026-09-12 Saturday Auto-Fix.log", "2026-10-04 Sunday Auto-Fix.log", # not yet
"notes.txt", "2026-01-01 Thursday Auto-Fix.log.bak"] # not ours
for n in names:
open(os.path.join(d, n), "w").close()
removed = sp.AutoLog(d).cleanup(SUNDAY) # Sunday 11 Oct 2026
self.assertEqual(sorted(removed), names[:2])
self.assertEqual(sorted(os.listdir(d)), sorted(names[2:]))
open(os.path.join(d, "2026-01-31 Saturday Auto-Fix.log"), "w").close() # month ends: 28 Feb
self.assertEqual(sp.AutoLog(d).cleanup(datetime(2026, 2, 27, 9).timestamp()), [])
self.assertEqual(sp.AutoLog(d).cleanup(datetime(2026, 2, 28, 9).timestamp()),
["2026-01-31 Saturday Auto-Fix.log"])
def test_auto_fix_tries_twice_then_leaves_it_to_you(self):
ran, comp = self.auto_setup()
self.snap.remote["tracks\0pgrep -xq Live"] = False