Fix CI-only failure: avoid dating a test entry "today" without HMAC
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run

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 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-07-19 13:56:44 +02:00
parent 298daf028d
commit 9172b1ec8a

View File

@ -156,18 +156,20 @@ class TestGatherStatus:
assert snap.lock_explanation.stage == "relaxed_day" assert snap.lock_explanation.stage == "relaxed_day"
def test_weekly_minimum_met_stops_lock(self, tmp_path: Path) -> None: 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 = _files(tmp_path)
files["log_file"].write_text( files["log_file"].write_text(
json.dumps( json.dumps(
{ {
d: {"workout_data": {"type": "phone_verified"}} "2024-01-01": {"workout_data": {"type": "phone_verified"}},
for d in ( "2024-01-02": {"workout_data": {"type": "phone_verified"}},
"2024-01-01", "2024-01-03": {"workout_data": {"type": "phone_verified"}},
"2024-01-02", "2024-01-04": [
"2024-01-03", {"workout_data": {"type": "phone_verified"}},
"2024-01-04", {"workout_data": {"type": "phone_verified"}},
"2024-01-05", ],
)
} }
) )
) )