Daily auto-fix log on NA Ingest's Desktop
~/Desktop/Auto-Fix Logs/<YYYY-MM-DD Weekday> Auto-Fix.log, written line by line as it happens: auto-fix on/off, each problem and what was done (try n of 2), the result, when the fault cleared, give-ups, and when it held back (network problem, several Dante devices gone). Tests write to a temp folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,7 @@ CONFIG["service_windows"] = [{"days": ["sun"], "start": "07:00", "end": "12:30"}
|
||||
CONFIG["tiles"] = [dict(t, label="SERVICE") if t["id"] == "service" else t for t in CONFIG["tiles"]]
|
||||
# A Sunday 08:00 (inside the service window) and a Wednesday 15:00 (outside it).
|
||||
SUNDAY = datetime(2026, 10, 11, 8, 0).timestamp()
|
||||
CONFIG["auto_fix"]["log_dir"] = tempfile.mkdtemp(prefix="sp-autolog-") # never the real Desktop
|
||||
WEDNESDAY = datetime(2026, 10, 7, 15, 0).timestamp()
|
||||
|
||||
|
||||
@@ -585,8 +586,9 @@ class TestFixes(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.snap = healthy_snapshot(SUNDAY)
|
||||
self.engine = sp.Engine(CONFIG)
|
||||
# Safety net: a hold in these tests must never reach a real machine.
|
||||
# Safety net: a hold in these tests must never reach a real machine (or write a real log).
|
||||
self.engine.executor = self.engine.poe_executor = lambda *a: True
|
||||
self.engine.autolog = sp.AutoLog(tempfile.mkdtemp())
|
||||
|
||||
def plan(self, tile):
|
||||
run_steps(self.engine, self.snap, SUNDAY, 4)
|
||||
@@ -699,6 +701,27 @@ class TestFixes(unittest.TestCase):
|
||||
self.assertEqual(self.engine.notes["apps"]["text"], "AUTO-FIXING\nABLETON")
|
||||
gate.set()
|
||||
|
||||
def test_auto_fix_writes_a_daily_log(self):
|
||||
ran, comp = self.auto_setup()
|
||||
t = SUNDAY
|
||||
self.snap.remote["tracks\0pgrep -xq Live"] = False
|
||||
run_steps(self.engine, self.snap, t, 25)
|
||||
self.engine.auto_fix(self.snap, comp, t + 25)
|
||||
time.sleep(0.2)
|
||||
self.snap.remote["tracks\0pgrep -xq Live"] = True # Ableton is back
|
||||
run_steps(self.engine, self.snap, t + 40, 1)
|
||||
path = self.engine.autolog.path(t)
|
||||
self.assertTrue(path.endswith("2026-10-11 Sunday Auto-Fix.log"))
|
||||
lines = open(path).read().splitlines()
|
||||
self.assertTrue(lines[0].startswith("Status panel auto-fixes - Sunday 11 October 2026"))
|
||||
body = [l for l in lines if l[:2].isdigit()]
|
||||
self.assertIn("PANEL auto-fix on until 13:30", body.pop(0))
|
||||
self.assertEqual(body[0][:8], "08:00:25")
|
||||
self.assertIn("APPS problem: ABLETON NOT RUNNING - fixing: start Ableton", body[0])
|
||||
self.assertIn("(try 1 of 2)", body[0])
|
||||
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_tries_twice_then_leaves_it_to_you(self):
|
||||
ran, comp = self.auto_setup()
|
||||
self.snap.remote["tracks\0pgrep -xq Live"] = False
|
||||
|
||||
Reference in New Issue
Block a user