Compare commits

...

3 Commits

Author SHA1 Message Date
a79ccc523b Workout handoff clears gatelock's Claim.grab_held while the app has input
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (flutter, flutter-analyze, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,flutter-analyze) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / lock-popup-safety (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (0) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (1) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (2) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (3) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (4) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (5) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (6) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (7) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (8) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (9) (push) Waiting to run
Tests / flutter-coverage (push) Blocked by required conditions
Tests / web-coverage (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Lending the X grab to the workout app stops recovery and releases it with
the claim still live, so gatelock 0.11 held_grabs (leisure-watch C2) read
"held" for the whole workout. release() now reports held=False before
grab_release; reacquire()'s grab_input() sets it true once the grab lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dsh4Znwh2KnC7q6vbGpX1N
2026-10-19 12:04:48 +02:00
77d3866ee7 Pin earned-time-v0.14.0 (dependency-freshness)
0.14.0 adds LEISURE_FROM (parked 2027-01-01) and resolve(leisure=True);
enforced output for every day before LEISURE_FROM is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dsh4Znwh2KnC7q6vbGpX1N
2026-10-19 11:55:32 +02:00
e2b1a980cc Pin gatelock-v0.11.0 (Claim.grab_held + held_grabs)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dsh4Znwh2KnC7q6vbGpX1N
2026-10-19 11:47:24 +02:00
4 changed files with 15 additions and 7 deletions

View File

@ -7,10 +7,10 @@ requires-python = ">=3.14"
# crdt-sync: shared CRDT merge scheme + sync transports, also used by
# diet_guard; here for phone-workout sync, Firebase RTDB only since 2026-10-09
dependencies = [
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.10.0#subdirectory=gatelock",
"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.13.2#subdirectory=earned_time",
"earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.14.0#subdirectory=earned_time",
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.3.0#subdirectory=sickdays",
]

View File

@ -4,9 +4,9 @@ bandit==1.9.4
codespell==2.4.3
coverage==7.16.2
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.13.2#subdirectory=earned_time
earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.14.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.10.0#subdirectory=gatelock
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.11.0#subdirectory=gatelock
mcp==2.3.0
mypy==2.4.0
pre-commit==4.7.0

View File

@ -42,6 +42,10 @@ def lock_grab_handoff(lock: LockWindow) -> GrabHandoff:
# Stop first: a watchdog tick between the release and the app's own
# grab would take the screen straight back off it.
lock._recovery.stop()
# Claim.grab_held false BEFORE the release (fail closed), so
# leisure-watch never reads "held" while the workout app has input.
# reacquire() -> grab_input() sets it true once the grab lands.
lock.report_grab_held(held=False)
with contextlib.suppress(tk.TclError):
lock.root.grab_release()
_logger.warning(

View File

@ -43,6 +43,10 @@ class _FakeLock:
self.root = _Root()
def report_grab_held(self, *, held: bool) -> None:
"""gatelock 0.11: what leisure-watch reads via ``held_grabs``."""
self.events.append(f"held={held}")
def grab_input(self) -> None:
self.events.append("grab_input")
self._recovery.running = True
@ -59,14 +63,14 @@ class TestLockGrabHandoff:
lock = _FakeLock()
lock_grab_handoff(lock).release()
assert lock._recovery.events == ["stop"]
assert lock.events == ["grab_release"]
assert lock.events == ["held=False", "grab_release"]
assert not lock._recovery.running
def test_reacquire_restores_the_grab_and_the_watchdog(self) -> None:
handoff = lock_grab_handoff(lock := _FakeLock())
handoff.release()
handoff.reacquire()
assert lock.events == ["grab_release", "grab_input"]
assert lock.events == ["held=False", "grab_release", "grab_input"]
assert lock._recovery.running
def test_never_closes_the_lock_window(self) -> None:
@ -81,7 +85,7 @@ class TestLockGrabHandoff:
handoff = lock_grab_handoff(lock := _FakeLock(release_raises=True))
handoff.release()
handoff.reacquire()
assert lock.events == ["grab_release", "grab_input"]
assert lock.events == ["held=False", "grab_release", "grab_input"]
class TestStartWorkout: