From 124f0506e278cf4b05546a14e8eb59526455ac51 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Mon, 2 Nov 2026 08:34:03 +0100 Subject: [PATCH] Pin earned-time v0.19.0 (focus project) Tests isolate FOCUS_PROJECT_DATA so a live project never leaks in. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WzxdWYcmik6APnHfc9gEVy --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 2 +- requirements.txt | 2 +- screen_locker/tests/_real_state_fixtures.py | 6 ++++++ screen_locker/tests/conftest.py | 8 ++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8305335..d789fe9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -137,7 +137,7 @@ repos: # than merely an old one. - gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.11.0#subdirectory=gatelock - crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.2#subdirectory=crdt-sync - - earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.18.0#subdirectory=earned_time + - earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.19.0#subdirectory=earned_time - freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.0#subdirectory=freedays - sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.3.0#subdirectory=sickdays # Same pin as workout_app/tools/render_finish_chime.sh installs. @@ -160,7 +160,7 @@ repos: # than merely an old one. - gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.11.0#subdirectory=gatelock - crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.2#subdirectory=crdt-sync - - earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.18.0#subdirectory=earned_time + - earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.19.0#subdirectory=earned_time - freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.0#subdirectory=freedays - sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.3.0#subdirectory=sickdays - mcp>=2,<3 diff --git a/pyproject.toml b/pyproject.toml index 36ec48a..e889747 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ dependencies = [ "gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.11.0#subdirectory=gatelock", "crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.2#subdirectory=crdt-sync", "freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.0#subdirectory=freedays", - "earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.18.0#subdirectory=earned_time", + "earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.19.0#subdirectory=earned_time", "sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.3.0#subdirectory=sickdays", ] diff --git a/requirements.txt b/requirements.txt index cac268c..2628d70 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ bandit==1.9.4 codespell==2.4.3 coverage==7.17.0 crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.2#subdirectory=crdt-sync -earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.18.0#subdirectory=earned_time +earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.19.0#subdirectory=earned_time freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.0#subdirectory=freedays gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.11.0#subdirectory=gatelock mcp==2.3.0 diff --git a/screen_locker/tests/_real_state_fixtures.py b/screen_locker/tests/_real_state_fixtures.py index cd153c0..a9d298b 100644 --- a/screen_locker/tests/_real_state_fixtures.py +++ b/screen_locker/tests/_real_state_fixtures.py @@ -215,3 +215,9 @@ def _no_real_ntp() -> Iterator[None]: """ with patch("screen_locker._time_check._query_ntp_offset", return_value=None): yield + + +@pytest.fixture(autouse=True) +def _no_live_focus_project(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + """No live focus project reshapes the registry (earned_time >= 0.19).""" + monkeypatch.setenv("FOCUS_PROJECT_DATA", str(tmp_path / "focus_project")) diff --git a/screen_locker/tests/conftest.py b/screen_locker/tests/conftest.py index e640ead..ebcc244 100644 --- a/screen_locker/tests/conftest.py +++ b/screen_locker/tests/conftest.py @@ -21,7 +21,7 @@ import pytest from screen_locker import _sync_client from screen_locker._degraded_sources import clear_degraded_sources -from screen_locker._earned import flat_earners +from screen_locker._earned import watched_earners from screen_locker.tests._gatelock_fixtures import ( FAKE_OUTPUTS, TWO_OUTPUTS, @@ -183,8 +183,8 @@ def _isolate_state_files(tmp_path: Path) -> Iterator[None]: yield -# Every registered flat earner's live-pass stamp, so a future one is seeded too. -_SEEDED_STAMPS = ("last_reset_date", *(f"{e.name}_bonus_date" for e in flat_earners())) +# Every registry's flat earners (a live focus project hides some today). +_BONUS = [f"{e.name}_bonus_date" for e in watched_earners() if e.kind == "flat"] @pytest.fixture(autouse=True) @@ -200,7 +200,7 @@ def _isolate_shutdown_base(tmp_path: Path) -> Iterator[None]: """ target = tmp_path / "shutdown_base.json" today = datetime.now(tz=UTC).strftime("%Y-%m-%d") - target.write_text(json.dumps(dict.fromkeys(_SEEDED_STAMPS, today))) + target.write_text(json.dumps(dict.fromkeys(["last_reset_date", *_BONUS], today))) with ( patch("screen_locker._constants.SHUTDOWN_BASE_FILE", target), patch("screen_locker._startup_checks.SHUTDOWN_BASE_FILE", target),