From 9172b1ec8a3c544f0eef5a9fc9dc81488a8f0c1c Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 19 Jul 2026 13:56:44 +0200 Subject: [PATCH] Fix CI-only failure: avoid dating a test entry "today" without HMAC has_logged_today treats an unsigned today-dated entry as "logged" only when no HMAC key is configured on the machine (CI has none; this dev box has a real key), so the test's precondition diverged between environments. Reach the new weekly minimum via Jan 1-4 instead of adding a same-day entry. Co-Authored-By: Claude Sonnet 5 --- screen_locker/tests/test_status_data.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/screen_locker/tests/test_status_data.py b/screen_locker/tests/test_status_data.py index 3b685a1..08bc185 100644 --- a/screen_locker/tests/test_status_data.py +++ b/screen_locker/tests/test_status_data.py @@ -156,18 +156,20 @@ class TestGatherStatus: assert snap.lock_explanation.stage == "relaxed_day" def test_weekly_minimum_met_stops_lock(self, tmp_path: Path) -> None: + # Avoid dating anything "today" (2024-01-05): an unsigned today entry + # trips already_logged before weekly_minimum_met, and does so only + # when no HMAC key is configured (env-dependent) -- Jan 4 holds two. files = _files(tmp_path) files["log_file"].write_text( json.dumps( { - d: {"workout_data": {"type": "phone_verified"}} - for d in ( - "2024-01-01", - "2024-01-02", - "2024-01-03", - "2024-01-04", - "2024-01-05", - ) + "2024-01-01": {"workout_data": {"type": "phone_verified"}}, + "2024-01-02": {"workout_data": {"type": "phone_verified"}}, + "2024-01-03": {"workout_data": {"type": "phone_verified"}}, + "2024-01-04": [ + {"workout_data": {"type": "phone_verified"}}, + {"workout_data": {"type": "phone_verified"}}, + ], } ) )